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_IsRoundingOrZeroFilling4.qbl              |   11 ++++++-----
 _Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl              |    5 ++++-
 _Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl |    8 ++++----
 _Main/BL/Type_WholeShift/Method_CapacityRounding.qbl                      |   34 ++++++++++++++++++++++++++++++++--
 4 files changed, 46 insertions(+), 12 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 );
+    }
   *]
 }
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
index 24624c5..ca698ed 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
@@ -7,7 +7,10 @@
 {
   TextBody:
   [*
-    traverse ( uptbs, Elements, uptb, true/*uptb.StartDate() <= Date::Construct( 2024, 4, 23 )*/ ) {
+    traverse ( uptbs, Elements, uptb, 
+               true
+    //           uptb.StartDate() <= Date::Construct( 2024, 5, 8 ) 
+               ) {
       if ( ( uptb.End().Date() - uptb.StartDate() ) > 1 ) {  
     //    debuginfo( "寮�濮嬫椂闂达細", uptb.StartDate().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", uptb.End().Date().Format( "Y-M2-D2" ), "    鏃堕棿鍖洪棿锛�", ( uptb.End().Date() - uptb.StartDate() ) );
     //    this.ProcessingTimeIntervalIsGreaterThanOneDay( macroPlan, uptb, uptbs );
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
index f1ba88f..2155752 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling4.qbl
@@ -10,17 +10,18 @@
   [*
     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( "缂镐綋" ) ) {
+        if ( pit.Product_MP().ParentID().Regex( "ZKG" ) ) {
           lotsize := macroPlan.CylinderBlock();
-        } else if ( pit.Product_MP().ParentID().Regex( "缂哥洊" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "ZKM" ) ) {
           lotsize := macroPlan.CylinderHead();
-        } else if ( pit.Product_MP().ParentID().Regex( "杩炴潌" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "PL" ) ) {
           lotsize := macroPlan.ConnectingRod();
-        } else if ( pit.Product_MP().ParentID().Regex( "鏇茶酱" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "KW" ) ) {
           lotsize := macroPlan.Crankshaft();
-        } else if ( pit.Product_MP().ParentID().Regex( "鏇茶酱" ) ) {
+        } else if ( pit.Product_MP().ParentID().Regex( "AGW" ) ) {
           lotsize := macroPlan.BalanceAxis();
         }
         
diff --git a/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl b/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
index 1bd90a5..5c3470d 100644
--- a/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
+++ b/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
@@ -9,7 +9,7 @@
   Description: '澶勭悊鏃堕棿鍖洪棿绛変簬1澶�'
   TextBody:
   [*
-    if ( uptb.UsedCapacity() = uptb.TotalAvailableCapacity() or ( uptb.UtilizationPercentage() * uptb.MaximumLoadPercentage() / 100 ) = 100 or uptb.FreeCapacity().HoursAsReal() = 0 ) { 
+    if ( uptb.UsedCapacity() = uptb.TotalAvailableCapacity() or [Number]( uptb.UtilizationPercentage() * uptb.MaximumLoadPercentage() / 100 ) = 100 or uptb.FreeCapacity().HoursAsReal() = 0 ) { 
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜庡彲鐢ㄤ骇鑳斤級" );
     } else if ( uptb.UsedCapacity().HoursAsReal() = 0 ) {
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜�0锛�" );
@@ -27,12 +27,12 @@
         }
         debuginfo( ".........." );             
       }
-      //  whetherToFillInZero := false;
+      whetherToFillInZero := false;
       if ( whetherToFillInZero ) {
-        debuginfo( "鎵ц琛ラ浂" );
+        debuginfo( "寮�濮嬫墽琛岃ˉ闆�------------" );
         this.ZeroCapacityReplenishment( macroPlan, uptb.UsedCapacity().HoursAsReal(), uptb, uptbs ); 
       } else {
-        debuginfo( "鎵ц鍦嗘暣" );
+        debuginfo( "寮�濮嬫墽琛屽渾鏁�------------" );
         this.CapacityRounding( macroPlan, uptb.TotalAvailableCapacity().HoursAsReal() - ( uptb.UsedCapacity() + uptb.ChangeoverDuration() ).HoursAsReal(), uptb, uptbs );
       }
     } else {

--
Gitblit v1.9.3