From 922e32f3483318a2f733b8a3d9074264d6bd3613 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期三, 11 十二月 2024 16:29:10 +0800
Subject: [PATCH] 修复一些bug

---
 _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
index 7c0d781..e64130f 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
@@ -51,7 +51,7 @@
         }
       }
       
-      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() and cell.Quantity() > 0){
         product := null( DispatchShiftSchedulingProduct );
         tips := "";
         if( not isnull( unit )){
@@ -77,6 +77,7 @@
           productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue ));
           if( isnull( productIndex )){
             product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() );
+            product.OrderNumber( cell.OrderNr() );
             product.ProductionQuantity( cell.Quantity() );
             products.Add( product );
             productIndexTree.Root().AddChild( productHandle,products.Size() - 1 );
@@ -106,7 +107,7 @@
         }
       }
       
-      traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate()){
+      traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate() and cell.Quantity() > 0){
         product := null( DispatchShiftSchedulingProduct );
         tips := "";
         if( not isnull( unit )){
@@ -132,6 +133,7 @@
           productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue ));
           if( isnull( productIndex )){
             product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() );
+            product.OrderNumber( cell.OrderNr() );
             product.ProductionQuantity( cell.Quantity() );
             products.Add( product );
             productIndexTree.Root().AddChild( productHandle,products.Size() - 1 );
@@ -157,7 +159,7 @@
       // 481
       lineQuantity := line.LineQuantity();
       
-      tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.ProductionQuantity() );
+      tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.OrderNumber() );
       
       if( line.ShiftName() = "3" ){
         
@@ -188,7 +190,7 @@
           }
         }
         
-        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
+        for( i := 0;i < tempProducts.Size(); i++ ){
           product := tempProducts.Element( i );
           productionQuantity := product.ProductionQuantity();
           
@@ -214,7 +216,9 @@
             singleShiftVolume3 := singleShiftVolume3 - productionQuantity;
             productionQuantity := productionQuantity - detail.ShiftVolume();
           }else{
-            product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "涓夌彮");
+            if( i = tempProducts.Size() - 1 ){
+              product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "涓夌彮");
+            }
           }
         }
         
@@ -242,7 +246,7 @@
           }
         }
     
-        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
+        for( i := 0 ;i < tempProducts.Size(); i++ ){
           product := tempProducts.Element( i );
           productionQuantity := product.ProductionQuantity();
           
@@ -262,13 +266,17 @@
             detail := product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := ifexpr( tempProductQuantity > 0 ,productionQuantity,singleShiftVolume2 ) ,SingleShiftName := "浜岀彮");
             singleShiftVolume2 := singleShiftVolume2 - productionQuantity;
             productionQuantity := productionQuantity - detail.ShiftVolume();
+          }else{
+            if( i = tempProducts.Size() - 1 ){
+              product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "浜岀彮");
+            }
           }
         }
         
       }else if( line.ShiftName() = "1" ){
         singleShiftVolume1 := lineQuantity;
         
-        for( i := tempProducts.Size() - 1;i >= 0; i-- ){
+        for( i := 0 ;i < tempProducts.Size(); i++ ){
           product := tempProducts.Element( i );
           productionQuantity := product.ProductionQuantity();
           if( singleShiftVolume1 > 0 and productionQuantity > 0){

--
Gitblit v1.9.3