Ejemplo n.º 1
0
        /// <summary>
        /// UpdateInfo
        /// </summary>
        /// <param name="fields"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdateInfo(string fields, long id)
        {
            ///包装器具基础数据同步VMI系统标记
            string vmiBasPackageSyncFlag = new ConfigBLL().GetValueByCode("VMI_BAS_PACKAGE_SYNC_FLAG");
            string sql = string.Empty;

            if (vmiBasPackageSyncFlag.ToLower() == "true")
            {
                string supplierNum = CommonBLL.GetFieldValue(fields, "SUPPLIER_NUM");
                if (!string.IsNullOrEmpty(supplierNum))
                {
                    Guid   logFid       = Guid.NewGuid();
                    string packageNo    = CommonBLL.GetFieldValue(fields, "PACKAGE_NO");
                    string packageCname = CommonBLL.GetFieldValue(fields, "PACKAGE_CNAME");
                    string packageType  = CommonBLL.GetFieldValue(fields, "PACKAGE_TYPE");
                    string loginUser    = CommonBLL.GetFieldValue(fields, "MODIFY_USER");
                    sql += "insert into [LES].[TI_IFM_WMS_VMI_PACKAGE] (" +
                           "[FID],[LOG_FID],[SKU],[SKUDESCR],[SKUCLS],[SUPPLYCODE]," +
                           "[VALID_FLAG],[CREATE_USER],[CREATE_DATE],[PROCESS_FLAG]) values (" +
                           "NEWID(),N'" + logFid + "',N'" + packageNo + "',N'" + packageCname + "',N'" + packageType + "',N'" + supplierNum + "'," +
                           "1,N'" + loginUser + "',GETDATE()," + (int)ProcessFlagConstants.Untreated + ");";
                    sql += CommonBLL.GetCreateOutboundLogSql("VMI", logFid, "LES-WMS-015", packageNo, loginUser);
                }
            }
            using (var trans = new TransactionScope())
            {
                if (!string.IsNullOrEmpty(sql))
                {
                    CommonDAL.ExecuteNonQueryBySql(sql);
                }
                dal.UpdateInfo(fields, id);
                trans.Complete();
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// InsertInfo
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public long InsertInfo(PackageApplianceInfo info)
        {
            int count = dal.GetCounts("[PACKAGE_NO] = N'" + info.PackageNo + "'");

            if (count > 0)
            {
                throw new Exception("MC:0x00000296");///器具型号不能重复
            }
            ///包装器具基础数据同步VMI系统标记
            string vmiBasPackageSyncFlag = new ConfigBLL().GetValueByCode("VMI_BAS_PACKAGE_SYNC_FLAG");
            string sql = string.Empty;

            if (vmiBasPackageSyncFlag.ToLower() == "true")
            {
                if (!string.IsNullOrEmpty(info.SupplierNum))
                {
                    Guid logFid = Guid.NewGuid();
                    sql += "insert into [LES].[TI_IFM_WMS_VMI_PACKAGE] (" +
                           "[FID],[LOG_FID],[SKU],[SKUDESCR],[SKUCLS],[SUPPLYCODE]," +
                           "[VALID_FLAG],[CREATE_USER],[CREATE_DATE],[PROCESS_FLAG]) values (" +
                           "NEWID(),N'" + logFid + "',N'" + info.PackageNo + "',N'" + info.PackageCname + "',N'" + info.PackageType + "',N'" + info.SupplierNum + "'," +
                           "1,N'" + info.CreateUser + "',GETDATE()," + (int)ProcessFlagConstants.Untreated + ");";
                    sql += CommonBLL.GetCreateOutboundLogSql("VMI", logFid, "LES-WMS-015", info.PackageNo, info.CreateUser);
                }
            }
            using (var trans = new TransactionScope())
            {
                if (!string.IsNullOrEmpty(sql))
                {
                    CommonDAL.ExecuteNonQueryBySql(sql);
                }
                info.Id = dal.Add(info);
                trans.Complete();
            }
            return(info.Id);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取同步VMI供应商物料关系接口同步语句
        /// </summary>
        /// <param name="supplierPartQuotaInfo"></param>
        /// <param name="deleteFlag"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        private string GetSyncVmiSupplierPartSql(SupplierPartQuotaInfo supplierPartQuotaInfo, bool deleteFlag, string loginUser)
        {
            StringBuilder sql = new StringBuilder();
            ///供应商名称
            string supplierName = new SupplierDAL().GetSupplierName(supplierPartQuotaInfo.SupplierNum);
            ///物料中文描述
            string partCname = new MaintainPartsDAL().GetPartCname(supplierPartQuotaInfo.PartNo, supplierPartQuotaInfo.Plant);

            if (!string.IsNullOrEmpty(partCname))
            {
                partCname = partCname.Replace("'", "''");
            }

            ///供应商对应的外部仓库
            List <WarehouseInfo> warehouseInfos = new WarehouseBLL().GetList("[WAREHOUSE] in (select [WM_NO] from [LES].[TM_BAS_VMI_SUPPLIER] with(nolock) " +
                                                                             "where [SUPPLIER_NUM] = N'" + supplierPartQuotaInfo.SupplierNum + "' and [VALID_FLAG] = 1) and " +
                                                                             "[WAREHOUSE_TYPE] = " + (int)WarehouseTypeConstants.VMI + "", string.Empty);

            if (warehouseInfos.Count == 0)
            {
                return(string.Empty);
            }
            ///是否启用SRM系统标记
            string enable_srm_flag = new ConfigDAL().GetValueByCode("ENABLE_SRM_FLAG");

            if (enable_srm_flag.ToLower() == "true")
            {
                ///TI_IFM_SRM_VMI_SUPPLIER_PART
                SrmVmiSupplierPartInfo srmVmiSupplierPartInfo = new SrmVmiSupplierPartInfo();
                srmVmiSupplierPartInfo.LogFid       = Guid.NewGuid();
                srmVmiSupplierPartInfo.Plant        = supplierPartQuotaInfo.Plant;
                srmVmiSupplierPartInfo.SupplierCode = supplierPartQuotaInfo.SupplierNum;
                srmVmiSupplierPartInfo.SupplierName = supplierName;
                srmVmiSupplierPartInfo.PartNo       = supplierPartQuotaInfo.PartNo;
                srmVmiSupplierPartInfo.PartCname    = partCname;
                srmVmiSupplierPartInfo.DeleteFlag   = deleteFlag;
                srmVmiSupplierPartInfo.ProcessFlag  = (int)ProcessFlagConstants.Untreated;
                srmVmiSupplierPartInfo.CreateUser   = loginUser;


                foreach (WarehouseInfo warehouseInfo in warehouseInfos)
                {
                    srmVmiSupplierPartInfo.VmiWarehouseCode = warehouseInfo.Warehouse;
                    srmVmiSupplierPartInfo.VmiWarehouseName = warehouseInfo.WarehouseName;
                    if (string.IsNullOrEmpty(srmVmiSupplierPartInfo.Plant))
                    {
                        srmVmiSupplierPartInfo.Plant = warehouseInfo.Plant;
                    }
                    ///
                    sql.AppendLine(SrmVmiSupplierPartDAL.GetInsertSql(srmVmiSupplierPartInfo));
                }
                sql.AppendLine(CommonBLL.GetCreateOutboundLogSql(
                                   "SRM",
                                   srmVmiSupplierPartInfo.LogFid.GetValueOrDefault(),
                                   "LES-SRM-001",
                                   srmVmiSupplierPartInfo.PartNo + "|" + srmVmiSupplierPartInfo.SupplierCode + "|" + string.Join("|", warehouseInfos.Select(d => d.Warehouse).ToArray()),
                                   loginUser));
            }
            ///Log.WriteLogToFile("enable_srm_flag.ToLower();"+ enable_srm_flag.ToLower() +"; \r" + sql.ToString(), AppDomain.CurrentDomain.BaseDirectory + @"\SQL-Log\", DateTime.Now.ToString("yyyyMMddHH"));

            ///是否启用WMS系统标记
            string enable_vmi_flag = new ConfigDAL().GetValueByCode("ENABLE_VMI_FLAG");

            //if (enable_vmi_flag.ToLower() == "true")
            //{
            //    ///TI_IFM_SRM_VMI_SUPPLIER_PART
            //    WmsVmiSupplierPartInfo wmsVmiSupplierPartInfo = new WmsVmiSupplierPartInfo();
            //    wmsVmiSupplierPartInfo.LogFid = Guid.NewGuid();
            //    wmsVmiSupplierPartInfo.Werks = supplierPartQuotaInfo.Plant;///TODO:SAP工厂代码?
            //    wmsVmiSupplierPartInfo.SupplierCode = supplierPartQuotaInfo.SupplierNum;
            //    wmsVmiSupplierPartInfo.SupplierName = supplierName;
            //    wmsVmiSupplierPartInfo.PartNo = supplierPartQuotaInfo.PartNo;
            //    wmsVmiSupplierPartInfo.PartCname = partCname;
            //    wmsVmiSupplierPartInfo.Cartoncode = supplierPartQuotaInfo.TransPackageModel;
            //    wmsVmiSupplierPartInfo.Cartonqty = supplierPartQuotaInfo.TransPackage;
            //    wmsVmiSupplierPartInfo.DeleteFlag = deleteFlag;
            //    wmsVmiSupplierPartInfo.ProcessFlag = (int)ProcessFlagConstants.Untreated;
            //    wmsVmiSupplierPartInfo.CreateUser = loginUser;
            //    foreach (WarehouseInfo warehouseInfo in warehouseInfos)
            //    {
            //        wmsVmiSupplierPartInfo.VmiWarehouseCode = warehouseInfo.Warehouse;
            //        wmsVmiSupplierPartInfo.VmiWarehouseName = warehouseInfo.WarehouseName;
            //        ///
            //        sql.AppendLine(WmsVmiSupplierPartDAL.GetInsertSql(wmsVmiSupplierPartInfo));
            //    }
            //    sql.AppendLine(CommonBLL.GetCreateOutboundLogSql(
            //        "VMI",
            //        wmsVmiSupplierPartInfo.LogFid.GetValueOrDefault(),
            //        "LES-WMS-008",
            //        wmsVmiSupplierPartInfo.PartNo + "|" + wmsVmiSupplierPartInfo.SupplierCode + "|" + string.Join("|", warehouseInfos.Select(d => d.Warehouse).ToArray()),
            //        loginUser));
            //}
            ///
            return(sql.ToString());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取同步VMI供应商物料关系接口同步语句
        /// </summary>
        /// <param name="supplierName"></param>
        /// <param name="partCname"></param>
        /// <param name="warehouseInfos"></param>
        /// <param name="supplierPartQuotaInfo"></param>
        /// <param name="enable_srm_flag"></param>
        /// <param name="enable_vmi_flag"></param>
        /// <param name="deleteFlag"></param>
        /// <param name="loginUser"></param>
        /// <returns></returns>
        public static string GetSyncVmiSupplierPartSql(string supplierName, string partCname, List <WarehouseInfo> warehouseInfos, SupplierPartQuotaInfo supplierPartQuotaInfo, string enable_srm_flag, string enable_vmi_flag, bool deleteFlag, string loginUser)
        {
            StringBuilder @string = new StringBuilder();

            ///
            if (!string.IsNullOrEmpty(enable_srm_flag) && enable_srm_flag.ToLower() == "true")
            {
                ///TI_IFM_SRM_VMI_SUPPLIER_PART
                SrmVmiSupplierPartInfo srmVmiSupplierPartInfo = new SrmVmiSupplierPartInfo();
                srmVmiSupplierPartInfo.LogFid       = Guid.NewGuid();
                srmVmiSupplierPartInfo.Plant        = supplierPartQuotaInfo.Plant;
                srmVmiSupplierPartInfo.SupplierCode = supplierPartQuotaInfo.SupplierNum;
                srmVmiSupplierPartInfo.SupplierName = supplierName;
                srmVmiSupplierPartInfo.PartNo       = supplierPartQuotaInfo.PartNo;
                srmVmiSupplierPartInfo.PartCname    = partCname;
                srmVmiSupplierPartInfo.DeleteFlag   = deleteFlag;
                srmVmiSupplierPartInfo.ProcessFlag  = (int)ProcessFlagConstants.Untreated;
                srmVmiSupplierPartInfo.CreateUser   = loginUser;

                if (warehouseInfos.Count > 0)
                {
                    foreach (WarehouseInfo warehouseInfo in warehouseInfos)
                    {
                        srmVmiSupplierPartInfo.VmiWarehouseCode = warehouseInfo.Warehouse;
                        srmVmiSupplierPartInfo.VmiWarehouseName = warehouseInfo.WarehouseName;
                        ///
                        @string.AppendLine(SrmVmiSupplierPartDAL.GetInsertSql(srmVmiSupplierPartInfo));
                    }
                }
                else
                {
                    @string.AppendLine(SrmVmiSupplierPartDAL.GetInsertSql(srmVmiSupplierPartInfo));
                }
                @string.AppendLine(CommonBLL.GetCreateOutboundLogSql(
                                       "SRM",
                                       srmVmiSupplierPartInfo.LogFid.GetValueOrDefault(),
                                       "LES-SRM-001",
                                       srmVmiSupplierPartInfo.PartNo + "|" + srmVmiSupplierPartInfo.SupplierCode + "|" + string.Join("|", warehouseInfos.Select(d => d.Warehouse).ToArray()),
                                       loginUser));
            }
            ///如果没有仓库信息则不发送给WMS
            if (warehouseInfos.Count == 0)
            {
                return(@string.ToString());
            }
            ///
            //if (!string.IsNullOrEmpty(enable_vmi_flag) && enable_vmi_flag.ToLower() == "true")
            //{
            //    ///TI_IFM_SRM_VMI_SUPPLIER_PART
            //    WmsVmiSupplierPartInfo wmsVmiSupplierPartInfo = new WmsVmiSupplierPartInfo();
            //    wmsVmiSupplierPartInfo.LogFid = Guid.NewGuid();
            //    wmsVmiSupplierPartInfo.Werks = supplierPartQuotaInfo.Plant;///TODO:SAP工厂代码?
            //    wmsVmiSupplierPartInfo.SupplierCode = supplierPartQuotaInfo.SupplierNum;
            //    wmsVmiSupplierPartInfo.SupplierName = supplierName;
            //    wmsVmiSupplierPartInfo.PartNo = supplierPartQuotaInfo.PartNo;
            //    wmsVmiSupplierPartInfo.PartCname = partCname;
            //    wmsVmiSupplierPartInfo.Cartoncode = supplierPartQuotaInfo.TransPackageModel;
            //    wmsVmiSupplierPartInfo.Cartonqty = supplierPartQuotaInfo.TransPackage;
            //    wmsVmiSupplierPartInfo.DeleteFlag = deleteFlag;
            //    wmsVmiSupplierPartInfo.ProcessFlag = (int)ProcessFlagConstants.Untreated;
            //    wmsVmiSupplierPartInfo.CreateUser = loginUser;
            //    foreach (WarehouseInfo warehouseInfo in warehouseInfos)
            //    {
            //        wmsVmiSupplierPartInfo.VmiWarehouseCode = warehouseInfo.Warehouse;
            //        wmsVmiSupplierPartInfo.VmiWarehouseName = warehouseInfo.WarehouseName;
            //        ///
            //        @string.AppendLine(WmsVmiSupplierPartDAL.GetInsertSql(wmsVmiSupplierPartInfo));
            //    }
            //    @string.AppendLine(CommonBLL.GetCreateOutboundLogSql(
            //        "VMI",
            //        wmsVmiSupplierPartInfo.LogFid.GetValueOrDefault(),
            //        "LES-WMS-008",
            //        wmsVmiSupplierPartInfo.PartNo + "|" + wmsVmiSupplierPartInfo.SupplierCode + "|" + string.Join("|", warehouseInfos.Select(d => d.Warehouse).ToArray()),
            //        loginUser));
            //}
            ///
            return(@string.ToString());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 入库免检物料重新校验检验模式
        /// </summary>
        /// <param name="receiveInfo"></param>
        /// <param name="receiveDetailInfos"></param>
        /// <param name="loginUser"></param>
        /// <param name="inspectionFlag"></param>
        /// <returns></returns>
        public static string ReloadInspectionMode(ReceiveInfo receiveInfo, ref List <ReceiveDetailInfo> receiveDetailInfos, string loginUser)
        {
            ///是否启用质量系统接口
            string enableQmisFlag = new ConfigDAL().GetValueByCode("ENABLE_QMIS_FLAG");
            ///获取所有涉及的检验模式,只获取单据中免检物料
            List <PartInspectionModeInfo> partInspectionModeInfos = new PartInspectionModeDAL().GetList("" +
                                                                                                        "[PART_NO] in ('" + string.Join("','", receiveDetailInfos.Where(d => d.InspectionMode.GetValueOrDefault() == (int)InspectionModeConstants.ExemptionInspection).Select(d => d.PartNo).ToArray()) + "') and " +
                                                                                                        "[SUPPLIER_NUM] in ('" + string.Join("','", receiveDetailInfos.Select(d => d.SupplierNum).ToArray()) + "')",
                                                                                                        string.Empty);
            ///LOG_FID
            Guid          logFid  = Guid.NewGuid();
            StringBuilder @string = new StringBuilder();

            foreach (ReceiveDetailInfo receiveDetailInfo in receiveDetailInfos)
            {
                PartInspectionModeInfo partInspectionModeInfo = partInspectionModeInfos.FirstOrDefault(d => d.PartNo == receiveDetailInfo.PartNo && d.SupplierNum == receiveDetailInfo.SupplierNum);
                ///没有检验模式时如何处理,按照批检处理,TODO:增加系统配置
                if (partInspectionModeInfo == null)
                {
                    partInspectionModeInfo = new PartInspectionModeInfo();
                    partInspectionModeInfo.InspectionMode = (int)InspectionModeConstants.BatchInspection;
                }
                ///检验模式无变化时,不产生检验任务
                if (partInspectionModeInfo.InspectionMode == receiveDetailInfo.InspectionMode)
                {
                    continue;
                }
                ///将当前检验模式写入入库单明细
                receiveDetailInfo.InspectionMode = partInspectionModeInfo.InspectionMode;
                ///TODO:可以加入LES质量检验模块数据内容生成逻辑
                ///是否启用质量系统接口
                if (enableQmisFlag.ToLower() != "true")
                {
                    continue;
                }
                ///QMIS检验模式
                int qmisCheckMode = 0;
                switch (partInspectionModeInfo.InspectionMode.GetValueOrDefault())
                {
                case (int)InspectionModeConstants.SamplingInspection: qmisCheckMode = (int)QmisInspectionModeConstants.Sampling; break;

                case (int)InspectionModeConstants.BatchInspection: qmisCheckMode = (int)QmisInspectionModeConstants.Batch; break;

                default: continue;
                }
                ///
                QmisAsnPullSheetInfo qmisAsnPullSheetInfo = QmisAsnPullSheetBLL.CreateQmisAsnPullSheetInfo(loginUser);
                ///
                QmisAsnPullSheetBLL.GetQmisAsnPullSheetInfo(receiveDetailInfo, ref qmisAsnPullSheetInfo);
                ///LOG_FID,日志外键
                qmisAsnPullSheetInfo.LogFid = logFid;
                ///CHECK_MODE,检验模式
                qmisAsnPullSheetInfo.CheckMode = qmisCheckMode.ToString();
                ///TOTAL_NO,送检数量,TODO:送检数量即为实收数量?
                qmisAsnPullSheetInfo.TotalNo = Convert.ToInt32(receiveDetailInfo.ActualQty.GetValueOrDefault());
                ///
                @string.AppendLine(QmisAsnPullSheetDAL.GetInsertSql(qmisAsnPullSheetInfo));
            }
            if (@string.Length > 0)
            {
                @string.AppendLine(CommonBLL.GetCreateOutboundLogSql("QMIS", logFid, "LES-QMIS-002", receiveInfo.ReceiveNo, loginUser));
            }
            return(@string.ToString());
        }