Murphy 2 лет назад
Родитель
Сommit
647b9dcdfe

+ 14 - 1
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -628,7 +628,20 @@ namespace Business.Replenishment
             List<LocationDetail> locations = _locationDetail.Select(x => annualProduction.Select(m => m.SAPItemNumber).Contains(x.ItemNum) && x.Domain == input.factory_id.ToString() && x.IsActive).ToList();
             var InProdcutQty=GetInProdcutQty(annualProduction.Select(m => m.SAPItemNumber).ToList(),input);
             var itemStock = CalcStock(annualProduction.Select(m => m.SAPItemNumber).ToList(),input);
-            foreach (var item in annualProduction.Where(a=> GetPlanMonth(4).Contains(a.PlanMonth)))
+            //主生产计划渠道合并,只考虑瑞奇库存不考虑国科海王库存
+            List<MonthlyShipmentPlan> shipList = new List<MonthlyShipmentPlan>();
+            foreach (var item in annualProduction.Where(a => GetPlanMonth(4).Contains(a.PlanMonth)))
+            {
+                if (shipList.Any(a => a.SAPItemNumber == item.SAPItemNumber && a.PlanMonth == item.PlanMonth))
+                {
+                    shipList.Find(b => b.SAPItemNumber == item.SAPItemNumber && b.PlanMonth == item.PlanMonth).Qty += item.Qty;
+                }
+                else
+                {
+                    shipList.Add(item);
+                }
+            }
+            foreach (var item in shipList)
             {
                 ProductionMasterPlan plan = new ProductionMasterPlan();
                 plan.Area = item.Area;