Sfoglia il codice sorgente

可用库存修改

Murphy 2 anni fa
parent
commit
fa1253f437

+ 9 - 10
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -484,9 +484,8 @@ namespace Business.Replenishment
                 var Packaging = routingOp.Where(x => x.Ufld1 == "包装" && x.MilestoneOp).FirstOrDefault();
                 var prodLine = prodLines.Where(x => x.Part == item.SAPItemNumber).OrderBy(x => x.Sequence).FirstOrDefault();
                 //不同库位库存数量
-                //5008  成品线边库  8001 成品合格库  8000成品待检 8002 不合格
-                //('5008','5009','5010','8000','8001','8002','8003','8004','8005')
-                var locationList = locations.Where(x => x.ItemNum == item.SAPItemNumber && (x.Location=="5008" || x.Location == "5009" || x.Location == "5010" || x.Location=="8000" || x.Location=="8001" || x.Location == "8002" || x.Location == "8003" || x.Location == "8004" || x.Location == "8005")).ToList();
+                //5008成品线边库,8001成品合格库,8000成品待检
+                var locationList = locations.Where(x => x.ItemNum == item.SAPItemNumber && (x.Location=="5008" || x.Location=="8000" || x.Location=="8001")).ToList();
                 //平台数据
                 decimal? hwStock = 0;
                 if (DMSItemList.Find(d => d.CfnERPCode == item.SAPItemNumber) != null)
@@ -900,9 +899,8 @@ namespace Business.Replenishment
             foreach (var item in locations)
             {
                 //库存合计 + 在制 + 灭菌中 TODO: 灭菌中取值待确定
-                //5008  成品线边库  8001 成品合格库  8000成品待检 8002 不合格
-                //('5008', '5009', '5010', '8000', '8001', '8002', '8003', '8004', '8005')
-                if (item.Location == "5008" || item.Location == "5009" || item.Location == "5010" || item.Location == "8001" || item.Location == "8002" || item.Location == "8003" || item.Location == "8004" || item.Location == "8005")
+                //5008成品线边库,8001成品合格库,8000成品待检
+                if (item.Location == "5008" || item.Location == "8000" || item.Location == "8001")
                 {
                     if (dictItemStock.ContainsKey(item.ItemNum))
                     {
@@ -1995,8 +1993,8 @@ namespace Business.Replenishment
                                 mes_Morder.moentry_wrkcname = null;
                                 mes_Morder.picking_qty = 0;
                                 mes_Morder.unit = subProductItemModel[key].unit;
-                                mes_Morder.morder_production_number = Math.Ceiling((itemQty.GetValueOrDefault() - publishedWeekQtySum) / (4 - publishedWeekCount));
-                                mes_Morder.need_number = Math.Ceiling((itemQty.GetValueOrDefault() - publishedWeekQtySum) / (4 - publishedWeekCount));
+                                mes_Morder.morder_production_number =middleItem;
+                                mes_Morder.need_number = middleItem;
                                 //成品半成品取周一为入库时间开始往前推
                                 mes_Morder.moentry_sys_stime = kTime.AddDays(7 * w - ProductTime(routingOps, subProductItemModel[key].item_number, input.factory_id.ToString(), mes_Morder.need_number.GetValueOrDefault()));
                                 mes_Morder.moentry_sys_etime = kTime.AddDays(7 * w);
@@ -2009,8 +2007,8 @@ namespace Business.Replenishment
                                 mes_Moentry.moentry_moid = mes_Morder.Id;
                                 mes_Moentry.moentry_mono = mes_Morder.morder_no;
                                 mes_Moentry.unit = subProductItemModel[key].unit;
-                                mes_Moentry.morder_production_number = Math.Ceiling((itemQty.GetValueOrDefault() - publishedWeekQtySum) / (4 - publishedWeekCount));
-                                mes_Moentry.need_number = Math.Ceiling((itemQty.GetValueOrDefault() - publishedWeekQtySum) / (4 - publishedWeekCount));
+                                mes_Moentry.morder_production_number = middleItem;
+                                mes_Moentry.need_number = middleItem;
                                 mes_Moentry.remaining_number = 0;
                                 mes_Moentry.tenant_id = input.tenant_id;
                                 mes_Moentry.factory_id = input.factory_id;
@@ -2068,6 +2066,7 @@ namespace Business.Replenishment
                                 weekPlan.Add(weekItem);
                                 moList.Add(mes_Morder);
                                 moentryList.Add(mes_Moentry);
+                                itemQty -= middleItem;
                             }
                         }
                     }