diff --git a/余材替代程序/SinglePlateHandle/.vs/SinglePlateHandle/v17/.suo b/余材替代程序/SinglePlateHandle/.vs/SinglePlateHandle/v17/.suo index 0b923ac..71d108e 100644 Binary files a/余材替代程序/SinglePlateHandle/.vs/SinglePlateHandle/v17/.suo and b/余材替代程序/SinglePlateHandle/.vs/SinglePlateHandle/v17/.suo differ diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubController.cs b/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubController.cs index 32dfeaa..d994505 100644 --- a/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubController.cs +++ b/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubController.cs @@ -1636,6 +1636,13 @@ namespace ibk.IPD.Controller.IPD_PS { itemGP_PLATE.SUB_FULL = "P"; } + + //标准 + if (!ChkStandGroup(itemGP_PLATE, order)) + { + continue; + } + //logger.InfoFormat("钢板:{0},订单:{1}-{2},协议替代存储临时表", itemGP_PLATE.PLATE_NO, order.ORD_NO, order.ORD_ITEM); AddTempDatas(itemGP_PLATE, order, intLackNum, 1, itemGP_PLATE.SUB_FULL, "", "", false, false, true); @@ -4959,7 +4966,7 @@ namespace ibk.IPD.Controller.IPD_PS continue; } //20240306 - logger.InfoFormat("二次优化前,钢板号:{0},订单号:{1}-{2}", TD.PLATE_NO, TD.ORD_NO, TD.ORD_ITEM); + logger.InfoFormat("二次优化前,钢板号:{0},订单号:{1}-{2} 成材率:{3}", TD.PLATE_NO, TD.ORD_NO, TD.ORD_ITEM,TD.EFF_RATE); //分板数据,长度小于最小值,不替换 @@ -4998,18 +5005,38 @@ namespace ibk.IPD.Controller.IPD_PS } - //筛选钢板号替代率最高的数据 - //20240105改 刘桂英提出没有基价按照替代率替换 - //20240307 如果是小尺板,不限制替代率 - if (TD.IS_SMALL_PLATE == "是") + string strOrderNoOrg= string.Empty; + string strOrderItemOrg = string.Empty; + + if (gP_PLATEs.Where(p=>p.PLATE_NO== TD.PLATE_NO).Count()>0) { - TEMP_DATA Fir_TD = gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO - && p.USE_FLG != "1" && p.IS_REPLACE != "1" - && p.DEF_NUM > 0 - && p.Scientific_substitution == "1"). - //&& p.SUB_RATE >= DecSUB_RATE). - OrderByDescending(p => p.PROFIT).ThenBy(p => p.CUST_DEL_TO_DATE). - FirstOrDefault(); + GP_PLATE GPOrder = gP_PLATEs.Where(p => p.PLATE_NO == TD.PLATE_NO).FirstOrDefault(); + + strOrderNoOrg = GPOrder.ORG_ORD_NO; + strOrderItemOrg = GPOrder.ORG_ORD_ITEM; + } + //2024-12-07 陈科长提出的 + //原订单优先 + if (gTEMP_DATA.Where(p=>p.ORD_NO== strOrderNoOrg + && p.ORD_NO == strOrderItemOrg + && p.PLATE_NO == TD.PLATE_NO + && p.USE_FLG != "1" + && p.IS_REPLACE != "1" + && p.DEF_NUM > 0 + && p.EFF_RATE * 100 >= 85).Count()>0) + { + TEMP_DATA Fir_TD = gTEMP_DATA.Where(p => p.ORD_NO == strOrderNoOrg + && p.ORD_NO == strOrderItemOrg + && p.PLATE_NO == TD.PLATE_NO + && p.USE_FLG != "1" + && p.IS_REPLACE != "1" + && p.DEF_NUM > 0 + && p.EFF_RATE * 100 >= 85). + OrderByDescending(p => p.PROFIT). + ThenBy(p => p.CUST_DEL_TO_DATE). + FirstOrDefault(); + + logger.InfoFormat("***原订单优先:{0}-{1}-{2}", TD.PLATE_NO, strOrderNoOrg, strOrderItemOrg); if (Fir_TD != null) { @@ -5034,42 +5061,83 @@ namespace ibk.IPD.Controller.IPD_PS } } } - } - //20240311改 刘桂英通知:替代率大于85%或者增效≥0都可替代 else { - TEMP_DATA Fir_TD = gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO - && p.USE_FLG != "1" && p.IS_REPLACE != "1" - && p.DEF_NUM > 0 - && (((p.EFF_RATE * 100 >= DecSUB_RATE || p.PROFIT >= 0) - && p.Scientific_substitution == "1") || p.EFF_RATE * 100 >= 85)). - //&& p.SUB_RATE >= DecSUB_RATE). - OrderByDescending(p => p.PROFIT).ThenBy(p => p.CUST_DEL_TO_DATE). - FirstOrDefault(); - - if (Fir_TD != null) + //筛选钢板号替代率最高的数据 + //20240105改 刘桂英提出没有基价按照替代率替换 + //20240307 如果是小尺板,不限制替代率 + if (TD.IS_SMALL_PLATE == "是") { - if (Fir_TD.DEF_NUM > 0) + TEMP_DATA Fir_TD = gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO + && p.USE_FLG != "1" && p.IS_REPLACE != "1" + && p.DEF_NUM > 0 + && p.Scientific_substitution == "1"). + //&& p.SUB_RATE >= DecSUB_RATE). + OrderByDescending(p => p.PROFIT).ThenBy(p => p.CUST_DEL_TO_DATE). + FirstOrDefault(); + + if (Fir_TD != null) { - Fir_TD.CON_FLG = "1"; - - if (ConverDataToDecimal(Fir_TD.LACK_NUM) > 0) - { - Fir_TD.SLAB_LACK_FLG = "1"; - } - //循环当前所有钢板,标记被使用 - foreach (TEMP_DATA TD_PLATE in gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO).ToList()) + if (Fir_TD.DEF_NUM > 0) { - TD_PLATE.USE_FLG = "1";//标记已被使用 + Fir_TD.CON_FLG = "1"; + + if (ConverDataToDecimal(Fir_TD.LACK_NUM) > 0) + { + Fir_TD.SLAB_LACK_FLG = "1"; + } + //循环当前所有钢板,标记被使用 + foreach (TEMP_DATA TD_PLATE in gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO).ToList()) + { + TD_PLATE.USE_FLG = "1";//标记已被使用 + } + //循环所有被替代的订单,欠量减一 + foreach (TEMP_DATA TD_ORDER in gTEMP_DATA.Where(p => p.ORD_NO == Fir_TD.ORD_NO && p.ORD_ITEM == Fir_TD.ORD_ITEM).ToList()) + { + TD_ORDER.LACK_NUM = TD_ORDER.LACK_NUM - 1; //欠量减一 + TD_ORDER.DEF_NUM = TD_ORDER.DEF_NUM - 1;// TD_ORDER.SUB_NUM;//欠量减替代块数 + } } - //循环所有被替代的订单,欠量减一 - foreach (TEMP_DATA TD_ORDER in gTEMP_DATA.Where(p => p.ORD_NO == Fir_TD.ORD_NO && p.ORD_ITEM == Fir_TD.ORD_ITEM).ToList()) + } + + } + //20240311改 刘桂英通知:替代率大于85%或者增效≥0都可替代 + else + { + TEMP_DATA Fir_TD = gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO + && p.USE_FLG != "1" && p.IS_REPLACE != "1" + && p.DEF_NUM > 0 + && (((p.EFF_RATE * 100 >= DecSUB_RATE || p.PROFIT >= 0) + && p.Scientific_substitution == "1") || p.EFF_RATE * 100 >= 85)). + //&& p.SUB_RATE >= DecSUB_RATE). + OrderByDescending(p => p.PROFIT).ThenBy(p => p.CUST_DEL_TO_DATE). + FirstOrDefault(); + + if (Fir_TD != null) + { + if (Fir_TD.DEF_NUM > 0) { - TD_ORDER.LACK_NUM = TD_ORDER.LACK_NUM - 1; //欠量减一 - TD_ORDER.DEF_NUM = TD_ORDER.DEF_NUM - 1;// TD_ORDER.SUB_NUM;//欠量减替代块数 + Fir_TD.CON_FLG = "1"; + + if (ConverDataToDecimal(Fir_TD.LACK_NUM) > 0) + { + Fir_TD.SLAB_LACK_FLG = "1"; + } + //循环当前所有钢板,标记被使用 + foreach (TEMP_DATA TD_PLATE in gTEMP_DATA.Where(p => p.PLATE_NO == TD.PLATE_NO).ToList()) + { + TD_PLATE.USE_FLG = "1";//标记已被使用 + } + //循环所有被替代的订单,欠量减一 + foreach (TEMP_DATA TD_ORDER in gTEMP_DATA.Where(p => p.ORD_NO == Fir_TD.ORD_NO && p.ORD_ITEM == Fir_TD.ORD_ITEM).ToList()) + { + TD_ORDER.LACK_NUM = TD_ORDER.LACK_NUM - 1; //欠量减一 + TD_ORDER.DEF_NUM = TD_ORDER.DEF_NUM - 1;// TD_ORDER.SUB_NUM;//欠量减替代块数 + } } } + } } diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubServiceTest.cs b/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubServiceTest.cs index 879b131..09748cb 100644 --- a/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubServiceTest.cs +++ b/余材替代程序/SinglePlateHandle/SinglePlateHandle/SurMatSubServiceTest.cs @@ -20,11 +20,11 @@ namespace ibk.IPD.Service.IPD_PS { private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static string glstrPlateNo = "24207171010101";//24101846070122 + private static string glstrPlateNo = "24310104410101";//24101846070122 - private static string glstrOrdNo = "OMG24080136"; + private static string glstrOrdNo = "OMK24120078"; - private static string glstrOrdItem = "001"; + private static string glstrOrdItem = "011"; #region 获取存储数据 diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.exe b/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.exe index 5069153..a350175 100644 Binary files a/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.exe and b/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.exe differ diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.pdb b/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.pdb index 50e77e8..a309e44 100644 Binary files a/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.pdb and b/余材替代程序/SinglePlateHandle/SinglePlateHandle/bin/Debug/SinglePlateHandle.pdb differ diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.exe b/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.exe index 5069153..a350175 100644 Binary files a/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.exe and b/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.exe differ diff --git a/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.pdb b/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.pdb index 50e77e8..a309e44 100644 Binary files a/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.pdb and b/余材替代程序/SinglePlateHandle/SinglePlateHandle/obj/Debug/SinglePlateHandle.pdb differ