From d5c074b9e2daa5030a8e730a30d2ed31c8169e7d Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 25 十月 2024 17:26:52 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl
index b61bf36..7ed2f4f 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_Dispatch.qbl
@@ -30,6 +30,20 @@
       unitIndexTree.Root().AddChild( unitHandle,i );
     }
     
+    // productLines := selectuniquevalues( offlinePlan,NewOfflinePlanRow,row,row.ProductionLine() );
+    productLinesQuantityNameValueTree := NamedValueTree::Create();
+    traverse( offlinePlan,NewOfflinePlanRow,row ){
+      traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
+        productLinesQuantityHandle := productLinesQuantityNameValueTree.GetHandle( row.ProductionLine() + cell.NewOfflinePlanColumn().StartDate().AsQUILL() );
+        productLinesQuantity := guard( productLinesQuantityNameValueTree.Root().Child( productLinesQuantityHandle ),null( NamedValue ));
+        if( not isnull( productLinesQuantity )){
+          productLinesQuantity.SetValue( productLinesQuantity.GetValueAsReal() + cell.Quantity() );
+        }else{
+          productLinesQuantityNameValueTree.Root().AddChild( productLinesQuantityHandle, cell.Quantity() );
+        }
+      }
+    }
+    
     traverse( offlinePlan,NewOfflinePlanRow,row ){
       productID := row.ProductID();
       productLine := row.ProductionLine();
@@ -48,7 +62,10 @@
           factory := temp2;
         }
       }
-      traverse( row,NewOfflinePlanCell,cell ,startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
+      traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){
+        productLinesQuantityHandle := productLinesQuantityNameValueTree.GetHandle( row.ProductionLine() + cell.NewOfflinePlanColumn().StartDate().AsQUILL() );
+        productLinesQuantity := guard( productLinesQuantityNameValueTree.Root().Child( productLinesQuantityHandle ).GetValueAsReal(),0.0 );
+        
         shiftDate := cell.NewOfflinePlanColumn().StartDate();
         shiftName := cell.ShiftPatternName();
         shiftVolume := cell.Quantity();
@@ -62,7 +79,7 @@
           }
         }
         if( shiftVolume <> 0 ){
-          shiftSchedulingInformations := DispatchShiftSchedulingInformation::SplitShifts( owner,shiftName,shiftVolume );
+          shiftSchedulingInformations := DispatchShiftSchedulingInformation::SplitShifts( owner,shiftName,shiftVolume,productLinesQuantity );
         
         traverse( shiftSchedulingInformations,Elements,shiftSchedulingInformation ){
           shiftSchedulingInformation.InterfaceTime( now );

--
Gitblit v1.9.3