From 6a9c7ad8915554e72e22fea43e05fa10dbd9b36d Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期日, 20 十月 2024 14:18:47 +0800
Subject: [PATCH] 调拨整班优化

---
 _Main/BL/Type_Unit/Method_WholeShiftFiltering.qbl            |    2 +-
 _Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl |   32 +++++++++++---------------------
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/_Main/BL/Type_Unit/Method_WholeShiftFiltering.qbl b/_Main/BL/Type_Unit/Method_WholeShiftFiltering.qbl
index b110d74..e56a1d9 100644
--- a/_Main/BL/Type_Unit/Method_WholeShiftFiltering.qbl
+++ b/_Main/BL/Type_Unit/Method_WholeShiftFiltering.qbl
@@ -2,5 +2,5 @@
 #parent: #root
 Method WholeShiftFiltering () declarative remote as Boolean
 {
-  TextBody: 'return this.HasCapacityTypeTime() or this.HasCapacityTypeTransportQuantity();'
+  TextBody: 'return this.HasCapacityTypeTime() or ( this.HasCapacityTypeTransportQuantity() and this.Name().Regex( "Transport" ) );'
 }
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
index 2155752..e2d567d 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
@@ -8,27 +8,17 @@
   Description: '杞﹂亾鏁寸彮'
   TextBody:
   [*
-    traverse ( unit, Lane.LaneLeg.Trip, t ) {
-      traverse ( t, ProductInTrip, pit, pit.Quantity() > 0.0 ) {
-        info( pit.Product_MP().ParentID() );
-        // 鑾峰彇浜у搧lotsize鍊嶆暟
-        lotsize := 1;
-        if ( pit.Product_MP().ParentID().Regex( "ZKG" ) ) {
-          lotsize := macroPlan.CylinderBlock();
-        } else if ( pit.Product_MP().ParentID().Regex( "ZKM" ) ) {
-          lotsize := macroPlan.CylinderHead();
-        } else if ( pit.Product_MP().ParentID().Regex( "PL" ) ) {
-          lotsize := macroPlan.ConnectingRod();
-        } else if ( pit.Product_MP().ParentID().Regex( "KW" ) ) {
-          lotsize := macroPlan.Crankshaft();
-        } else if ( pit.Product_MP().ParentID().Regex( "AGW" ) ) {
-          lotsize := macroPlan.BalanceAxis();
-        }
-        
-        if ( lotsize > 1 ) {
-          debuginfo( "浜у搧ID锛�", pit.ProductID(), "    浜у搧鏁伴噺锛�", pit.Quantity(), "    lotsize锛�", lotsize );
-          quantityToBeSupplemented := lotsize - ( pit.Quantity() mod lotsize );
-          pit.Update( pit.Quantity() + quantityToBeSupplemented, true );
+    us  := unit.Name().Tokenize( " " );
+    tmq := select( macroPlan, TransferMinimumQuantity, tempTMQ, tempTMQ.FactoryAbbreviation() = us.Element( 0 ) and tempTMQ.ProductID() = us.Element( 3 ) );
+    
+    if ( not isnull( tmq ) ) {
+    //  info( "鏈�灏忓寘瑁卨otsize锛�", tmq.Quantity() );
+      traverse ( unit, Lane.LaneLeg.Trip, t ) {
+        needRoundTransferQuantity := tmq.Quantity() - ( [Number]t.Quantity() mod tmq.Quantity() );
+        if ( needRoundTransferQuantity <> 0 and needRoundTransferQuantity <> tmq.Quantity() ) {
+    //      info( "鏃堕棿锛�", t.Departure().Date().Format( "Y-M2-D2" ), "    浣欐暟锛�", needRoundTransferQuantity );
+          pit := minselect( t, ProductInTrip, tempPIT, tempPIT.Quantity() > 0, tempPIT.Quantity() );
+          pit.Update( pit.Quantity() + needRoundTransferQuantity, true );
         }
       }
     }

--
Gitblit v1.9.3