Procházet zdrojové kódy

虚拟计算委外件时间处理。

tangdi před 2 roky
rodič
revize
7b0d346aab

+ 42 - 5
MicroServices/Business/Business.Application/ResourceExamineManagement/CalcBomViewAppService.cs

@@ -5,6 +5,7 @@ using Business.ResourceExamineManagement.Dto;
 using MongoDB.Driver.Linq;
 using SixLabors.ImageSharp;
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using Volo.Abp.Application.Services;
@@ -362,7 +363,21 @@ namespace Business.ResourceExamineManagement
                                 if (childList.Count > 0)
                                 {
                                     MatterTileDevelop(level1Dto, childList, returnlist, sklist, bangid, mesorder.ooentry_stime, sentrys, icitemlist);
-                                    level1Dto.kitting_time = childList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
+                                    
+                                    var itemTime = childList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
+                                    if (LongPeriod)
+                                    {
+                                        level1Dto.kitting_time = itemTime;
+                                    }
+                                    else if (itemTime > level1Dto.kitting_time)
+                                    {
+                                        level1Dto.kitting_time = itemTime;
+                                    }
+                                    if (IsStraight)
+                                    {
+                                        mesorder.ooentry_stime = childList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(1);
+                                        mesorder.ooentry_etime = mesorder.ooentry_stime.GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());
+                                    }
                                 }
 
                                 level1Dto.subcontracting_qty = lack_qty;
@@ -879,7 +894,11 @@ namespace Business.ResourceExamineManagement
                             {
                                 CalcIcitem(cilList, returnlist, bangid, sklist, mesorder.ooentry_stime, icitemlist, sentrys, childidList);
                                 var itemTime = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
-                                if (itemTime > item.kitting_time)
+                                if (LongPeriod)
+                                {
+                                    item.kitting_time = itemTime;
+                                }
+                                else if(itemTime > item.kitting_time)
                                 {
                                     item.kitting_time = itemTime;
                                 }
@@ -1433,13 +1452,27 @@ namespace Business.ResourceExamineManagement
                                     var mesorder = CreateMesOOder(sct, lack_qty, param.company_id, param.factoryId, bangid, leadTimeList, supplierList, plan_date.GetValueOrDefault());
                                     mesorder.ooentry_etime = plan_date.GetValueOrDefault().AddDays(-1);
                                     var srmprDto = PackageSRMPR(sct, bangid, sentrys, plan_date, lack_qty);
-                                    mesorder.start_time = mesorder.ooentry_etime.GetValueOrDefault().AddDays(-(srmprDto.totalLeadTime.GetValueOrDefault() - 1));
+                                    mesorder.ooentry_stime = mesorder.ooentry_etime.GetValueOrDefault().AddDays(-(srmprDto.totalLeadTime.GetValueOrDefault() - 1));
 
                                     //先计算末级数据的齐套时间。
                                     if (cilList.Count > 0)
                                     {
                                         CalcIcitem(cilList, returnlist, bangid, sklist, mesorder.ooentry_stime, icitemlist, sentrys, childidList);
-                                        sct.kitting_time = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
+                                        //sct.kitting_time = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
+                                        var itemTime = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());//加上物料的采购提前期
+                                        if (LongPeriod)
+                                        {
+                                            sct.kitting_time = itemTime;
+                                        }
+                                        else if (itemTime > sct.kitting_time)
+                                        {
+                                            sct.kitting_time = itemTime;
+                                        }
+                                        if (IsStraight)
+                                        {
+                                            mesorder.ooentry_stime = cilList.Max(s => s.kitting_time).GetValueOrDefault().AddDays(1);
+                                            mesorder.ooentry_etime = mesorder.ooentry_stime.GetValueOrDefault().AddDays(srmprDto.totalLeadTime.GetValueOrDefault());
+                                        }
                                     }
                                     sct.subcontracting_qty = lack_qty;
                                     sct.subcontracting_list = new List<ooder>();
@@ -2001,7 +2034,11 @@ namespace Business.ResourceExamineManagement
                 item.purchase_qty = lack_qty;
                 item.purchase_list = new List<purchase>();
             }
-            if (SRMPRDto.lastStartTmie > item.kitting_time)
+            if (LongPeriod)//虚拟计算不调整齐套时间
+            {
+                item.kitting_time = SRMPRDto.lastStartTmie;
+            }
+            else if (SRMPRDto.lastStartTmie > item.kitting_time)
             {
                 item.kitting_time = SRMPRDto.lastStartTmie;
             }