Quellcode durchsuchen

计算优先级同步更新周生产计划优先级;物料需求计划库位调整

Murphy vor 2 Jahren
Ursprung
Commit
8faf6be5f2

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

@@ -4394,13 +4394,20 @@ namespace Business.Replenishment
         {
             var works = _workOrdMaster.Select(a =>(string.IsNullOrEmpty(a.Status) || a.Status.ToUpper()=="P") && a.Typed.ToUpper() != "PW" && a.Domain == domain && a.IsActive);
             works = works.OrderBy(a => a.OrdDate).ToList();
+            var workOrdsList = works.Select(a => a.WorkOrd).ToList();
+            var weekPlan = _replenishmentWeekPlan.GetListAsync(a=>a.IsReplenishmentModel=="N" && workOrdsList.Contains(a.ProductionOrder)).Result;
             decimal Priority = 1.0m;
             for (int i = 0; i < works.Count; i++)
             {
                 works[i].Priority = Priority;
+                if (weekPlan.Any(a => a.ProductionOrder == works[i].WorkOrd))
+                {
+                    weekPlan.First(a=>a.ProductionOrder == works[i].WorkOrd).Priority = Priority;
+                }
                 Priority = Priority + 1.0m;
             }
             _businessDbContext.BulkUpdate(works);
+            _businessDbContext.BulkUpdate(weekPlan);
         }
 
         /// <summary>
@@ -5566,7 +5573,7 @@ namespace Business.Replenishment
                 List<string> numbers = pretreatments.Select(s => s.item_number).ToList();
                 var locationRange = _configurationItem.Select(x => x.FldName == "MRPLocationRange" && x.Domain == factoryId.ToString()).FirstOrDefault();
 
-                List<string> locationList = new List<string> { "1000", "1001", "5008", "8000", "8001" };
+                List<string> locationList = new List<string> { "1001","5007","5008","8000", "8001" };
                 if (locationRange != null && locationRange.Val != null)
                 {
                     locationList = locationRange.Val.SplitToArray(",").ToList();