/// <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()); }
/// <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()); }