Jelajahi Sumber

生成交货单过滤掉物料属性为自制件的交货计划

heteng 2 tahun lalu
induk
melakukan
cebb6c7105

+ 16 - 7
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -6731,9 +6731,18 @@ namespace Business.Replenishment
                 }
                 demandplans = newPlans;
             }
+            //根据交货计划物料编码,获取物料属性为采购件的物料主数据
+            List<ItemMaster> itemMasters = _itemMaster.Select(p => demandplans.Select(m => m.itemnum).Contains(p.ItemNum) && p.Domain == domain && (p.PurMfg == "P" || p.PurMfg == "p")).ToList();
+            if (!itemMasters.Any())
+            {
+                Msg = "OK|物料需求计划中没有采购件,不需要生成交货单";
+                return Msg;
+            }
+            //过滤掉物料属性不为采购件的交货计划
+            demandplans = demandplans.Where(p => itemMasters.Select(m => m.ItemNum).Contains(p.itemnum)).ToList();
             if (!demandplans.Any())
             {
-                Msg = "OK|没有需要生成的交货单";
+                Msg = "OK|物料需求计划中没有采购件,不需要生成交货单";
                 return Msg;
             }
             //获取货源清单数据
@@ -6791,7 +6800,7 @@ namespace Business.Replenishment
                     info.Icdsid = demandplans[i].Id;
                     info.ItemNum = demandplans[i].itemnum;
                     info.CreateTime = DateTime.Now;
-                    info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]没有维护货源清单,无法转交货单";
+                    info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]没有维护货源清单,无法转交货单";
                     info.OptTime = optime;
                     exceptions.Add(info);
                     continue;
@@ -6804,7 +6813,7 @@ namespace Business.Replenishment
                     info.Icdsid = demandplans[i].Id;
                     info.ItemNum = demandplans[i].itemnum;
                     info.CreateTime = DateTime.Now;
-                    info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]的货源清单供应商配额之和不为100%,无法转交货单";
+                    info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]的货源清单供应商配额之和不为100%,无法转交货单";
                     info.OptTime = optime;
                     exceptions.Add(info);
                     continue;
@@ -6819,7 +6828,7 @@ namespace Business.Replenishment
                     info.Icdsid = demandplans[i].Id;
                     info.ItemNum = demandplans[i].itemnum;
                     info.CreateTime = DateTime.Now;
-                    info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]没有可占用的采购明细,无法转交货单";
+                    info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]没有可占用的采购明细,无法转交货单";
                     info.OptTime = optime;
                     exceptions.Add(info);
                     continue;
@@ -6848,7 +6857,7 @@ namespace Business.Replenishment
                     info.Icdsid = demandplans[i].Id;
                     info.ItemNum = demandplans[i].itemnum;
                     info.CreateTime = DateTime.Now;
-                    info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]的采购明细可用数量不足,无法转交货单";
+                    info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]的采购明细可用数量不足,无法转交货单";
                     info.OptTime = optime;
                     exceptions.Add(info);
                     continue;
@@ -6896,7 +6905,7 @@ namespace Business.Replenishment
                         info.Icdsid = demandplans[i].Id;
                         info.ItemNum = demandplans[i].itemnum;
                         info.CreateTime = DateTime.Now;
-                        info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]对应供应商[" + curChaes[j].supplier_name + "]没有可用采购明细,无法转交货单";
+                        info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]对应供应商[" + curChaes[j].supplier_name + "]没有可用采购明细,无法转交货单";
                         info.OptTime = optime;
                         exceptions.Add(info);
 
@@ -6939,7 +6948,7 @@ namespace Business.Replenishment
                         info.Icdsid = demandplans[i].Id;
                         info.ItemNum = demandplans[i].itemnum;
                         info.CreateTime = DateTime.Now;
-                        info.Remark = "交货计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]对应供应商[" + curChaes[j].supplier_name + "]采购明细可用数量不足,无法转交货单";
+                        info.Remark = "物料需求计划[" + demandplans[i].itemnum + ":" + demandplans[i].requestdate.ToString("yyyy-MM-dd") + "]对应供应商[" + curChaes[j].supplier_name + "]采购明细可用数量不足,无法转交货单";
                         info.OptTime = optime;
                         exceptions.Add(info);