Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #4
0
 public string GenerateTemplateConfigCode()
 {
     return(Bll_Comm.GetTableKey("Verify_TemplateConfig"));
 }
Example #5
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);
        }
Example #6
0
 public string GetDeptCode(string DeptPCode)
 {
     return(Bll_Comm.GetTableKey("", "HR_Department", DeptPCode, ""));
 }