From 383df1b4a1b7b9903cd4f0843d06e04674d42a1f Mon Sep 17 00:00:00 2001
From: admin <admin@admin.com>
Date: 星期三, 28 八月 2024 11:09:12 +0800
Subject: [PATCH] 整班优化

---
 _Main/BL/Type_WholeShift/Method_ZeroCapacityReplenishment.qbl             |   11 ++++++++---
 _Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl              |    6 +++---
 _Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl |    4 ++--
 _Main/BL/Type_WholeShift/Method_CapacityRounding.qbl                      |    3 ++-
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
index a795b24..b00c88e 100644
--- a/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
+++ b/_Main/BL/Type_WholeShift/Method_CapacityRounding.qbl
@@ -9,7 +9,8 @@
 {
   TextBody:
   [*
-    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    闇�瑕佸渾鏁寸殑浜ц兘鍛ㄦ湡鐨勫紑濮嬫椂闂达細", uptb.StartDate().Format( "Y-M2-D2" ) );
+    debuginfo( "闇�瑕佸渾鏁寸殑鏃堕棿锛堝崟浣嶏細灏忔椂锛�", timeDifference, "    Free capacity锛堝崟浣嶏細灏忔椂锛�", uptb.FreeCapacity().HoursAsReal(), "    ChangeoverDuration锛堝崟浣嶏細灏忔椂锛�", uptb.ChangeoverDuration().HoursAsReal(), "    闇�瑕佸渾鏁寸殑浜ц兘鍛ㄦ湡鐨勫紑濮嬫椂闂达細", uptb.StartDate().Format( "Y-M2-D2" ) );
+    //timeDifference         := uptb.FreeCapacity().HoursAsReal() - uptb.ChangeoverDuration().HoursAsReal();
     nextUnitPeriodTimeBase := ifexpr( isnull( uptb.Next().astype( UnitPeriodTimeBase ) ), select( uptbs, Elements, tempUPTB, tempUPTB.Start() = uptb.End() ), uptb.Next().astype( UnitPeriodTimeBase ) );
     //debuginfo( "鑰冭檻搴撳瓨鍜宭otsize" );
     //while ( timeDifference > 0 and not isnull( nextUnitPeriodTimeBase ) ) {
diff --git a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
index 54c3e30..24624c5 100644
--- a/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
+++ b/_Main/BL/Type_WholeShift/Method_IsRoundingOrZeroFilling3.qbl
@@ -7,10 +7,10 @@
 {
   TextBody:
   [*
-    traverse ( uptbs, Elements, uptb, true ) {
+    traverse ( uptbs, Elements, uptb, true/*uptb.StartDate() <= Date::Construct( 2024, 4, 23 )*/ ) {
       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 );
+    //    debuginfo( "寮�濮嬫椂闂达細", uptb.StartDate().Format( "Y-M2-D2" ), "    缁撴潫鏃堕棿锛�", uptb.End().Date().Format( "Y-M2-D2" ), "    鏃堕棿鍖洪棿锛�", ( uptb.End().Date() - uptb.StartDate() ) );
+    //    this.ProcessingTimeIntervalIsGreaterThanOneDay( macroPlan, uptb, uptbs );
       } else 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.ProcessingTimeIntervalIsEqualToOneDay( macroPlan, uptb, uptbs );
diff --git a/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl b/_Main/BL/Type_WholeShift/Method_ProcessingTimeIntervalIsEqualToOneDay.qbl
index f1d0a8c..1bd90a5 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() ) { 
+    if ( uptb.UsedCapacity() = uptb.TotalAvailableCapacity() or ( uptb.UtilizationPercentage() * uptb.MaximumLoadPercentage() / 100 ) = 100 or uptb.FreeCapacity().HoursAsReal() = 0 ) { 
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜庡彲鐢ㄤ骇鑳斤級" );
     } else if ( uptb.UsedCapacity().HoursAsReal() = 0 ) {
       debuginfo( "澶╁凡缁忔槸鏁寸彮锛屾棤闇�澶勭悊锛堜娇鐢ㄤ骇鑳界瓑浜�0锛�" );
@@ -33,7 +33,7 @@
         this.ZeroCapacityReplenishment( macroPlan, uptb.UsedCapacity().HoursAsReal(), uptb, uptbs ); 
       } else {
         debuginfo( "鎵ц鍦嗘暣" );
-        this.CapacityRounding( macroPlan, uptb.TotalAvailableCapacity().HoursAsReal() - uptb.UsedCapacity().HoursAsReal(), uptb, uptbs );
+        this.CapacityRounding( macroPlan, uptb.TotalAvailableCapacity().HoursAsReal() - ( uptb.UsedCapacity() + uptb.ChangeoverDuration() ).HoursAsReal(), uptb, uptbs );
       }
     } else {
       debuginfo( "澶╁嚭鐜板紓甯�" );
diff --git a/_Main/BL/Type_WholeShift/Method_ZeroCapacityReplenishment.qbl b/_Main/BL/Type_WholeShift/Method_ZeroCapacityReplenishment.qbl
index e0b7ee9..302ae2d 100644
--- a/_Main/BL/Type_WholeShift/Method_ZeroCapacityReplenishment.qbl
+++ b/_Main/BL/Type_WholeShift/Method_ZeroCapacityReplenishment.qbl
@@ -77,16 +77,21 @@
       minimumCapacityThatCanBeBorrowed := minimumQuantityThatCanBeBorrowed / pto.Operation().Throughput();
       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 ) and minimumCapacityThatCanBeBorrowed > 0 ) {
-        acceptableCapacity := ifexpr( ( nextUnitPeriodTimeBase.TotalAvailableCapacity().HoursAsReal() - nextUnitPeriodTimeBase.UsedCapacity().HoursAsReal() ) > 0,
+        acceptableCapacity := /*ifexpr( ( nextUnitPeriodTimeBase.TotalAvailableCapacity().HoursAsReal() - nextUnitPeriodTimeBase.UsedCapacity().HoursAsReal() ) > 0,
                                         nextUnitPeriodTimeBase.TotalAvailableCapacity().HoursAsReal() - nextUnitPeriodTimeBase.UsedCapacity().HoursAsReal(),
-                                        0.0 );
+                                        0.0 )*/
+                              ifexpr( nextUnitPeriodTimeBase.FreeCapacity().HoursAsReal() > 0,
+                                      nextUnitPeriodTimeBase.FreeCapacity().HoursAsReal(),
+                                      0.0 );
         unifiedProcessingTimeOfComplementZero := minvalue( timeDifference, minimumCapacityThatCanBeBorrowed, acceptableCapacity );
         debuginfo( "鎺ョ撼鐨勫懆鏈熸椂闂达細", nextUnitPeriodTimeBase.StartDate().Format( "Y-M2-D2" ), String::Tab(), 
                    "鎺ョ撼鐨勫懆鏈熻兘鎺ュ彈鐨勪骇鑳斤細", acceptableCapacity, String::Tab(),
                    "鍓╀綑琛ラ浂鐨勪骇鑳斤細", timeDifference, String::Tab(),
                    "缁熶竴杞Щ鐨勪骇鑳斤細", unifiedProcessingTimeOfComplementZero, String::Tab()
                   );
-        this.UnifiedProcessingOfComplementZeroLogic( unifiedProcessingTimeOfComplementZero, pto, uptb, macroPlan );
+        if ( unifiedProcessingTimeOfComplementZero > 0.0 ) {
+          this.UnifiedProcessingOfComplementZeroLogic( unifiedProcessingTimeOfComplementZero, pto, nextUnitPeriodTimeBase, macroPlan );
+        }
         minimumCapacityThatCanBeBorrowed := minimumCapacityThatCanBeBorrowed - unifiedProcessingTimeOfComplementZero;
         timeDifference := timeDifference - unifiedProcessingTimeOfComplementZero;
         if ( isnull( nextUnitPeriodTimeBase.Next() ) ) {

--
Gitblit v1.9.3