示例#1
0
        /// <summary>
        /// 根据关键字生成字典编码
        /// </summary>
        /// <param name="key"></param>
        /// <param name="order">该字典顺序号</param>
        /// <returns></returns>
        public string GenerateDictCode(string key, bool IsChildNode, string pCode, ref int order)
        {
            //Dictionary<string, int> dic = new Dictionary<string, int>();
            int maxNum = TypeConverter.ObjectToInt(instance.GetMax("Dict_ID", key)) + 1;

            //DataTable dt = instance.idb.RunProcReturnDatatable("qx_find_dictkeycode", new List<SqlParameter>() { new SqlParameter("sTable", key) }.ToArray());
            //Modify By QB

            string code = string.Empty;

            if (pCode == "root" || pCode == "")
            {
                pCode = "";
            }

            code = Bll_Comm.GetTableKey("", key, pCode, code);

            return(code);
        }
示例#2
0
        /// <summary>
        /// 审核单据
        /// </summary>
        /// <param name="VerfiyKey">模块名称</param>
        /// <param name="KeyCode">编码字段名称</param>
        /// <param name="RecordId">编码单据号</param>
        /// <param name="AuditSuggest">备注</param>
        /// <param name="UserId">用户ID</param>
        /// <param name="NextAuditNode">下一审核节点</param>
        /// <param name="IsLastAuditNode">是否为最后一个节点</param>
        /// <returns></returns>
        public bool Audit(string VerfiyKey,
                          string RecordId,
                          string AuditSuggest,
                          string UserId,
                          string Agree,
                          string VerfiyNodeCode, out string _ProResult
                          )
        {
            bool   result    = false;
            string ProResult = "";

            _ProResult = "";
            //审核单据,判断是否终审
            VerifyProcess_Records Records = new VerifyProcess_Records()
            {
                Module_Code     = VerfiyKey.ToString(), //模块编码
                VRecord_Code    = Bll_Comm.GetTableKey("VerifyProcess_Records"),
                Record_ID       = RecordId,             //单据ID
                VRecord_Opinion = AuditSuggest,         //审理意见
                VRecord_VCode   = VerfiyNodeCode,       //审核阶段编码
                VRecord_Flag    = Agree,
                VRecord_Owner   = UserId,
                Stat            = 2
            };
            int Temp_result = AuditProcessRecordsInstance.Add(Records);

            if (Temp_result > 0)
            {
                SqlParameter x1 = new SqlParameter("@auditCode", SqlDbType.VarChar, 50);
                x1.Value = Records.VRecord_Code;
                SqlParameter[]     param   = new SqlParameter[] { x1 };
                IDbDataParameter[] parames = param as IDbDataParameter[];
                DataTable          dt      = AuditProcessRecordsInstance.idb.RunProcReturnDatatable("qx_sp_audit", parames);
                ProResult = dt.Rows[0][0].ToString();
                if (!string.IsNullOrEmpty(ProResult))
                {
                    result     = true;
                    _ProResult = ProResult;
                }
            }

            return(result);
        }
示例#3
0
        public string CreateDictNode(Bse_Dict Node, bool IsChildNode, ref int order)
        {
            //获取关键字
            string codeKey = Node.Dict_Key;

            //获取父编码
            string parentCode = Node.Dict_Code;

            if (codeKey == parentCode)//如果是最顶级,即其父编码为空
            {
                parentCode = "";
            }

            //throw new NotImplementedException();
            //var dict = GetModelByCode(parentCode,);
            order = 0;
            //var newCode = GenerateDictCode(dict.Dict_Key,IsChildNode, ref order);
            string Code    = "";
            var    newCode = Bll_Comm.GetTableKey("", codeKey, parentCode, Code);

            return(newCode);
        }
示例#4
0
        // Modify BY QB
        // Modify:
        // Modify Date:2011-3-12
        /// <summary>
        /// 通用字典转换
        /// </summary>
        /// <param name="Module"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static DataTable ConvertDict(string Module, DataTable dt)
        {
            QX.DAL.ADOBse_Dict       dictInstance = new QX.DAL.ADOBse_Dict();
            Sys_Config_ListPage      M_Model      = new Sys_Config_ListPage();
            List <Sys_Config_Fieled> D_List       = new List <Sys_Config_Fieled>();

            Bll_Comm.GetListConfig(Module, out M_Model, out D_List);
            if (M_Model != null && D_List.Count > 0 && dt.Rows.Count > 0)
            {
                List <Sys_Config_Fieled> newDList = D_List.Where(o => !string.IsNullOrEmpty(o.D_DictKey)).ToList();
                for (var i = 0; i < dt.Rows.Count; i++)
                {
                    foreach (var item in newDList)
                    {
                        var model = dictInstance.GetListByWhere(" AND Dict_Key='" + item.D_DictKey + "' AND Dict_Code='" + dt.Rows[i][item.D_Index] + "'");
                        if (model.Count > 0)
                        {
                            dt.Rows[i][item.D_Index] = model.First().Dict_Name;
                        }
                    }
                }
            }
            return(dt);
        }
示例#5
0
 public DataTable GetNextVerifyUser(string node,string curUser)
 {
     DataTable dt = new DataTable();
     Dictionary<string, object> dic = new Dictionary<string, object>();
     dic.Add("Node", node);
     dic.Add("User", curUser);
     dt = new Bll_Comm().GetDataTablebyProc("qx_sp_nextuser", dic);
     return dt;
 }
示例#6
0
 /// <summary>
 /// 生成员工编码
 /// </summary>
 /// <returns></returns>
 public string GenerateEmpCode()
 {
     var val = new Bll_Comm().GetMax("Bse_Employee", "Emp_ID");
     int re=Common.C_Class.Utils.TypeConverter.ObjectToInt(val)+1;
     return re.ToString();
 }
        public ActionResult GetData(int page, int rows, string search, string sidx, string sord)
        {
            string Name = Request["name"] == null ? "" : Request["name"].ToString();
            string filters = Request["filters"] == null ? "" : Request["filters"].ToString();
            string filter = Request["filter"] == null ? "" : Request["filter"].ToString();
            string ModuleName = Request["m"] == null ? "" : Request["m"].ToString();
            string NameSpace = Request["n"] == null ? "" : Request["n"].ToString();

            string filtersSql = string.Empty;
            string mapSqlFilter = string.Empty;
            if (!string.IsNullOrEmpty(filters))
            {
                filtersSql = BulidJqGridSearch.BuildSearch(filters);
            }
            BLL.Bll_Sys_Config_Refer configRefer = new QX.BLL.Bll_Sys_Config_Refer();
            BLL.Bll_Sys_Config_Field_Refer configReferList = new Bll_Sys_Config_Field_Refer();
            Sys_Config_Refer model = configRefer.GetListByCode(" AND  R_ModuleName='"
                + ModuleName + "'")[0];
            var referList = configReferList.GetListByCode(" AND  D_ModuleName='" + ModuleName + "'").Where(o=>!string.IsNullOrEmpty(o.D_DictKey));
            BLL.Bll_Bse_Dict DictInstance = new Bll_Bse_Dict();

            DataTable dt = new DataTable();
            if (!string.IsNullOrEmpty(model.R_SQL))
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    model.R_SQL = model.R_SQL + filter;
                }
                if (!string.IsNullOrEmpty(filtersSql))
                {
                    model.R_SQL = model.R_SQL + " AND " + filtersSql;
                }
                dt = configRefer.ListBySql(model.R_SQL);
            }
            else
            {
                string _filtersql = !String.IsNullOrEmpty(model.R_FilterSql) ? model.R_FilterSql : "";
                _filtersql = _filtersql + filter;

                #region  特殊映射处理
                if (ModuleName=="HR_StuffModule")
                {
                    //读取映射配置表中公司配置
                    Bll_Comm comm = new Bll_Comm();
                    string mapFilter = "";
                    var mapModel = comm.CommMap(ModuleName, "Company");
                    if (mapModel!=null)
                    {
                        var deptList = comm.GetChildListDeptNon(comm.CommMap(ModuleName, "Company").Map_Object);
                        if (deptList.Count()>0)
                        {
                            foreach (var item in deptList)
                            {

                            }
                            for (int i = 0; i < deptList.Count;i++ )
                            {
                                if (i==(deptList.Count-1))
                                {
                                    mapFilter += "'" + deptList[i].Dept_Code+"'";
                                }
                                else
                                {
                                    mapFilter += "'" + deptList[i].Dept_Code+ "',";
                                }
                            }
                            mapFilter.TrimEnd(',');
                        }
                        mapSqlFilter = " Stuff_DepCode in(" + mapFilter + ")";
                    }
                }
                #endregion

                //为空时不初始化
                //if (!string.IsNullOrEmpty(filter))
                //{
                //    dt = configRefer.ListDataByCode(Name, _filtersql, filtersSql + mapSqlFilter);
                //}
                dt = configRefer.ListDataByCode(Name, _filtersql, filtersSql + mapSqlFilter);
            }

            DataTable newdt = DataTablePage.GetPagedTable(dt, page, rows);

            #region 字典进行转换
            //对字典进行转换

            for (int i = 0; i < newdt.Rows.Count; i++)
            {
                foreach (var item in referList.ToList())
                {
                    var value = newdt.Rows[i][item.D_Index] != null ? newdt.Rows[i][item.D_Index].ToString() : "";
                    var DictResult = DictInstance.GetListByCode(" AND Dict_Code='" + value
                                                                 + "' AND Dict_Key='" + item.D_DictKey + "' ");
                    if (DictResult.Count > 0)
                    {
                        newdt.Rows[i][item.D_Index] = DictResult.FirstOrDefault().Dict_Name;
                    }
                }
            }

            #endregion

            var json = DataTablePage.JsonForJqgrid(newdt, page, rows, dt.Rows.Count);
            return JavaScript(json);
        }
示例#8
0
 public string GenerateTemplateConfigCode()
 {
     return(Bll_Comm.GetTableKey("Verify_TemplateConfig"));
 }
示例#9
0
        // private Bll_HR_Department deptInstance = new Bll_HR_Department();


        /// <summary>
        /// 同步公司物料类别
        /// </summary>
        /// <param name="itype"></param>
        /// <param name="companycode"></param>
        /// <param name="deptCode"></param>
        /// <returns></returns>
        public bool SyncMaterialTypeFromDict(string itype, string companyCode)
        {
            bool result = false;

            List <WH_MaterialType> list      = new List <WH_MaterialType>();
            List <Bse_Dict>        dictList  = new List <Bse_Dict>();
            List <string>          Union     = new List <string>();
            List <string>          InterSect = new List <string>();

            if (!string.IsNullOrEmpty(companyCode) && !string.IsNullOrEmpty(itype))
            {
                try
                {
                    //dictList = dictInstance.GetListByCode(" AND Dict_Key!=Dict_Code AND Dict_PCode='" + itype + "'");
                    // Modify BY QB
                    // Modify:同步字典中所有子类别
                    // Modify Date:2011-3-22
                    dictList = dictInstance.GetListByCode(" AND Dict_Key!=Dict_Code AND Dict_Key='" + itype + "'");
                    list     = instance.GetListByCode(" AND MT_CompanyCode='" + companyCode + "' ");

                    IEnumerable <string> listStrList = list.Select(o => o.MT_TCode);
                    IEnumerable <string> dictStrList = dictList.Select(o => o.Dict_Code);

                    //取Dict与MaterialType中的并集,并比对Maertitype中是否存在,不存在则插入数据,
                    Union = dictStrList.Union(listStrList).ToList <string>();

                    //取交集
                    InterSect = dictStrList.Intersect(listStrList).ToList <string>();

                    //逻辑删除关系类别
                    foreach (var listItem in listStrList)
                    {
                        if (!InterSect.Contains(listItem))
                        {
                            var typeModel = list.Where(o => o.MT_TCode == listItem);
                            if (typeModel.Count() > 0)
                            {
                                typeModel.First().Stat = 1;
                                instance.Update(typeModel.First());
                            }
                        }
                    }

                    //更新和插入Type
                    foreach (var item in Union)
                    {
                        var typeModel = list.Where(o => o.MT_TCode == item);
                        var dictModel = dictList.Where(o => o.Dict_Code == item);
                        if (typeModel.Count() > 0)
                        {
                            //更新
                            if (dictModel.First().Dict_Name != typeModel.First().MT_TName)
                            {
                                typeModel.First().MT_TName  = dictModel.First().Dict_Name;
                                typeModel.First().MT_TPCode = dictModel.First().Dict_PCode;
                                typeModel.First().MT_Order  = dictModel.First().Dict_Order;
                                instance.Update(typeModel.First());
                            }
                        }
                        else
                        {
                            //插入
                            WH_MaterialType model = new WH_MaterialType();
                            model.MT_Code  = Bll_Comm.GetTableKey("WH_MaterialType");
                            model.MT_TCode = dictModel.First().Dict_Code;
                            if (!string.IsNullOrEmpty(dictModel.First().Dict_PCode) && dictModel.First().Dict_PCode != itype)
                            {
                                model.MT_TPCode = dictModel.First().Dict_PCode;
                            }

                            model.MT_TName       = dictModel.First().Dict_Name;
                            model.MT_Order       = dictModel.First().Dict_Order;
                            model.MT_CompanyCode = companyCode;
                            var deptModel = deptInstance.GetModel(" AND Dept_Code='" + companyCode + "' ");
                            model.MT_Company = deptModel != null ? deptModel.Dept_Name : "";
                            instance.Insert(model);
                        }
                    }

                    result = true;
                }
                catch (System.Exception e)
                {
                    throw;
                }
            }
            return(result);
        }
示例#10
0
 public string GetDeptCode(string DeptPCode)
 {
     return(Bll_Comm.GetTableKey("", "HR_Department", DeptPCode, ""));
 }
示例#11
0
 public ActionResult GetProjectCode()
 {
     string key = new Bll_Comm().GetTableKeyCode("SD_Project");
     return Json(new { SDI_Code = key });
 }