lazhen
2024-08-29 296fd628f1ecca7397efed30f9c4252a6cfd2a18
_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, "    借之前changeover时间:", 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 );
    }
  *]
}