hongjli
2023-09-24 287c978dc2cf991b4ea77947aee1df6598880477
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
Quintiq file version 2.0
#parent: #root
StaticMethod IterativeGeneration2 (
  ProductInStockingPoint_MP pisp,
  Date targetDate,
  CapacityAllocationResultsRuleConfiguration carrcs,
  Number numberOfLayers,
  Real firstLevelSupply
)
{
  TextBody:
  [*
    numberOfLayers++;
    info( "层数:", numberOfLayers, "    目标时间:", targetDate.Format( "Y-M2-D2" ) );
    
    traverse ( pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, pispippl.Start().Date() = targetDate ) {
      traverse ( pispippl, NewSupply, ns, ns.Quantity() > 0 ) {
        info( "当前供应的pisp:", ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP().Name() );
        if ( numberOfLayers = 1 ) {
          firstLevelSupply := ns.Quantity();
        }
        
        if ( guard( ns.PeriodTask_MP().astype( PeriodTaskOperation ).DependentDemand( relsize ) > 0, false ) ) {
          traverse ( ns, PeriodTask_MP.astype( PeriodTaskOperation ).DependentDemand, dd ) { 
            CapacityAllocationResults::IterativeGeneration2( dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP(),
                                                             targetDate,
                                                             carrcs,
                                                             numberOfLayers,
                                                             firstLevelSupply
                                                            );
          }
        }
        
        firstLevelSupply := 0.0;
      }
    }
  *]
}