Browse Source

代码提交。

tangdi 2 năm trước cách đây
mục cha
commit
d2d7d3d752

+ 4 - 2
MicroServices/Business/Business.Application.Contracts/Dto/AlignmentCalcDto.cs

@@ -42,8 +42,10 @@ namespace Business.Dto
         /// </summary>
         public decimal deleteQty { get; set; }
 
-        public List<srm_pr_main> deletePrlist { get; set; }
+        public List<srm_pr_main> addPrlist { get; set; } = new List<srm_pr_main>();
 
-        public List<srm_pr_main> updatePrlist { get; set; }
+        public List<srm_pr_main> deletePrlist { get; set; } = new List<srm_pr_main>();
+
+        public List<srm_pr_main> updatePrlist { get; set; } = new List<srm_pr_main>();
     }
 }

+ 20 - 4
MicroServices/Business/Business.Application/ReplenishmentManagement/ReplenishmentAppService.cs

@@ -4957,6 +4957,7 @@ namespace Business.Replenishment
 
                 List<srm_pr_main> updatPrList = new List<srm_pr_main>();
                 List<srm_pr_main> deletePrList = new List<srm_pr_main>();
+                List<srm_pr_main> addPrList = new List<srm_pr_main>();
                 if (IsWeekPlan)
                 {
                     foreach (var exami in examines)
@@ -5026,13 +5027,23 @@ namespace Business.Replenishment
                             int.TryParse(sysSet[0].Ufld1, out ScheduleAgreement);
                         }
                     }
-
                     //需要新增的PR集合
-                    CalcPrAdd(prAddList, dbPurchaseList, ic_items, ScheduleAgreement);
-
+                    addPrList = CalcPrAdd(prAddList, dbPurchaseList, ic_items, ScheduleAgreement);
+                    if (addPrList.Any())
+                    {
+                        var addPrlistDto = _serialNumberAppService.GetBillNo(param.factoryId.ToString(), "PR", addPrList.Count, "admin", 1);
+                        int index = 0;
+                        foreach (var p in addPrList)
+                        {
+                            if (addPrlistDto[index] != null)
+                            {
+                                p.pr_billno = addPrlistDto[index].NbrResult.ToString();
+                            }
+                            index++;
+                        }
+                    }
                     //数据库需要减少的PR集合
                     CalcPrDel(prDelList, dbPurchaseList, ic_items, DBprmainList.Where(x=>x.state==1).ToList(), updatPrList, deletePrList);//只取新增状态的PR,可以做删除或者修改
-
                 }
 
                 using (var unitOfWork = _unitOfWorkManager.Begin(false, true))
@@ -5118,6 +5129,10 @@ namespace Business.Replenishment
                         }
                         if (IsWeekPlan)
                         {
+                            if (addPrList.Any())
+                            {
+                                _businessDbContext.BulkInsert(addPrList);
+                            }
                             if (updatPrList.Any())
                             {
                                 _businessDbContext.BulkUpdate(updatPrList);
@@ -5246,6 +5261,7 @@ namespace Business.Replenishment
                     srm_Pr.update_time = DateTime.Now;
                     srm_Pr.update_by_name = "admin";
                     prList.Add(srm_Pr);
+                    dto.addPrlist.Add(srm_Pr);
                 }
             });
             return prList;