From 8331525053186b83d97728d4f9b07c27c92bde39 Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期四, 29 八月 2024 16:06:49 +0800
Subject: [PATCH] 整班优化

---
 _Main/BL/Type_WholeShift/Method_CapacityRounding.qbl |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
index b00c88e..d2cfd98 100644
--- a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
+++ b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
@@ -90,8 +90,34 @@
     //  }
     //  debuginfo( "銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��" );
     //}
+    
+    sourceChangeover := uptb.ChangeoverDuration();
+    targetChangeover := Duration::Zero();
+    
+    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    鑰冭檻ChangeOver鏉′欢鍦嗘暣浣垮叾杈惧埌鏁寸彮" );
+    nextUnitPeriodTimeBase := ifexpr( isnull( uptb.Next().astype( UnitPeriodTimeBase ) ), select( uptbs, Elements, tempUPTB, tempUPTB.Start() = uptb.End() ), uptb.Next().astype( UnitPeriodTimeBase ) );
+    while ( timeDifference > 0 and not isnull( nextUnitPeriodTimeBase ) ) {
+      debuginfo( "寮�濮嬪悜鏃堕棿涓猴細", nextUnitPeriodTimeBase.StartDate().Format( "Y-M2-D2" ), "鐨勪骇鑳藉懆鏈熷��" );
+      traverse ( nextUnitPeriodTimeBase, PeriodTaskOperation, pto, guard( pto.Operation().RoutingStep().Routing().Start(), uptb.StartDate() ) <= uptb.StartDate() and
+                                                                   guard( pto.Operation().RoutingStep().Routing().End(), uptb.End().Date() ) >= uptb.End().Date() and
+                                                                   exists( uptb, PeriodTaskOperation.Operation, tempO, tempO = pto.Operation() )                  and
+                                                                   timeDifference > 0 ) {
+        minimumCapacityThatCanBeBorrowed := pto.Quantity() / pto.Operation().Throughput();
+        unifiedProcessingTimeOfRounding := minvalue( timeDifference, minimumCapacityThatCanBeBorrowed ); 
+        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding, "    鍊熶箣鍓峜hangeover鏃堕棿锛�", uptb.ChangeoverDuration() ); 
+        this.UnifiedProcessingOfRoundingLogic( unifiedProcessingTimeOfRounding, uptb, pto, macroPlan ); 
+        targetChangeover := uptb.ChangeoverDuration();
+        timeDifference   := timeDifference - unifiedProcessingTimeOfRounding;                                                 
+      }
+         
+      if ( isnull( nextUnitPeriodTimeBase.Next() ) ) {
+        nextUnitPeriodTimeBase := select( uptbs, Elements, tempUPTB, tempUPTB.Start() = nextUnitPeriodTimeBase.End() );
+      } else {
+        nextUnitPeriodTimeBase := nextUnitPeriodTimeBase.Next().astype( UnitPeriodTimeBase );
+      }
+    }
         
-    debuginfo( "涓嶈�冭檻浠讳綍鏉′欢鍦嗘暣浣垮叾鍒拌揪鏁寸彮" );
+    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    涓嶈�冭檻浠讳綍鏉′欢鍦嗘暣浣垮叾鍒拌揪鏁寸彮" );
     nextUnitPeriodTimeBase := ifexpr( isnull( uptb.Next().astype( UnitPeriodTimeBase ) ), select( uptbs, Elements, tempUPTB, tempUPTB.Start() = uptb.End() ), uptb.Next().astype( UnitPeriodTimeBase ) );
     while ( timeDifference > 0 and not isnull( nextUnitPeriodTimeBase ) ) {
       debuginfo( "寮�濮嬪悜鏃堕棿涓猴細", nextUnitPeriodTimeBase.StartDate().Format( "Y-M2-D2" ), "鐨勪骇鑳藉懆鏈熷��" );
@@ -100,7 +126,7 @@
                                                                    timeDifference > 0 ) {
         minimumCapacityThatCanBeBorrowed := pto.Quantity() / pto.Operation().Throughput();
         unifiedProcessingTimeOfRounding := minvalue( timeDifference, minimumCapacityThatCanBeBorrowed ); 
-        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding ); 
+        debuginfo( "鍓╀綑鍦嗘暣鐨勪骇鑳斤細", timeDifference, "    nextUnitPeriodTimeBase鐨勫綋鍓嶅懆鏈熶换鍔′緵搴旀暟閲忥細", pto.Quantity(), "    鑳藉�熺殑浜ц兘锛�", minimumCapacityThatCanBeBorrowed, " 缁熶竴鍊熺殑浜ц兘锛�", unifiedProcessingTimeOfRounding, "    褰撳墠changeover鏃堕棿锛�", uptb.ChangeoverDuration().HoursAsReal() ); 
         this.UnifiedProcessingOfRoundingLogic( unifiedProcessingTimeOfRounding, uptb, pto, macroPlan );  
         timeDifference := timeDifference - unifiedProcessingTimeOfRounding;                                                 
       }
@@ -111,5 +137,9 @@
         nextUnitPeriodTimeBase := nextUnitPeriodTimeBase.Next().astype( UnitPeriodTimeBase );
       }
     }
+    
+    if ( ( targetChangeover - sourceChangeover ).HoursAsReal() > 0.0 ) {
+      this.ZeroCapacityReplenishment( macroPlan, ( targetChangeover - sourceChangeover ).HoursAsReal(), uptb, uptbs );
+    }
   *]
 }

--
Gitblit v1.9.3