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 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

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