admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Quintiq file version 2.0
#parent: #root
Method ProcessingTimeIntervalIsEqualToOneDay (
  MacroPlan macroPlan,
  UnitPeriodTimeBase uptb,
  UnitPeriodTimeBases uptbs
)
{
  Description: '处理时间区间等于1天'
  TextBody:
  [*
    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)" );
    } else if ( uptb.UsedCapacity() < uptb.TotalAvailableCapacity() and uptb.UsedCapacity().HoursAsReal() > 0 ) {
      whetherToFillInZero := true; // 初始化默认补零条件
      debuginfo( "天不是整班,需要处理" );
      traverse ( uptb, PeriodTaskOperation, pto, whetherToFillInZero ) {
        debuginfo( "当前周期任务输出的产品个数:", pto.NewSupply( relsize ) );
        traverse( pto, NewSupply, ns, whetherToFillInZero ) {
          debuginfo( "当前供应的产品:", ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().ProductID(), "    当前供应的产品的剩余库存:", ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd(), "    当前供应的产品的最小库存:", ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel(), "    当前供应的产品的最大库存:", ns.ProductInStockingPointInPeriodPlanningLeaf().MaxInventoryLevel(),"    当前产品在该周期任务的供应量:", ns.Quantity() );
          if ( ( ns.ProductInStockingPointInPeriodPlanningLeaf().InventoryLevelEnd() - ns.Quantity() ) < ns.ProductInStockingPointInPeriodPlanningLeaf().MinInventoryLevel() ) {
            debuginfo( "当前周期任务不能补零" );
            whetherToFillInZero := false;
          }
        }
        debuginfo( ".........." );             
      }
      whetherToFillInZero := false;
      if ( whetherToFillInZero ) {
        debuginfo( "开始执行补零------------" );
        this.ZeroCapacityReplenishment( macroPlan, uptb.UsedCapacity().HoursAsReal(), uptb, uptbs ); 
      } else {
        debuginfo( "开始执行圆整------------" );
        this.CapacityRounding( macroPlan, uptb.TotalAvailableCapacity().HoursAsReal() - ( uptb.UsedCapacity() + uptb.ChangeoverDuration() ).HoursAsReal(), uptb, uptbs );
      }
    } else {
      debuginfo( "天出现异常" );
    }
  *]
}