renhao
2023-10-18 ff1d40a1a235da7c3bdfa26070af267f19c7a3d3
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
Quintiq file version 2.0
#parent: #root
StaticMethod CreateDate (
  GlobalOTDSOP globalOTDSOP,
  MacroPlan macroPlan,
  Scenario scenario
)
{
  TextBody:
  [*
    globalOTDSOP.CapacityAllocationResults( relflush );
    
    finaleProductInStockingPoint_MPs := CapacityAllocationResults::ObtainTheFinalOutputProduct( macroPlan, globalOTDSOP );
    
    period_MPS := null( Period_MPs );
    traverse ( macroPlan, PeriodSpecification_MP, psmp, psmp.ID() = "Planning periods" ) {
      period_MPS := selectsortedset( psmp, PeriodSpecificationPeriod.Period_MP, pmp, not pmp.IsHistorical(), pmp.StartDate() );
    }
    
    traverse ( finaleProductInStockingPoint_MPs, Elements, fpispmp ) {
      capacityAllocationResultsRuleConfigurations := selectset( globalOTDSOP, CapacityAllocationResultsRuleConfiguration, tempCARRC, tempCARRC.ModuleMaterialCode() = fpispmp.ProductID() and tempCARRC.StockingPointID() = fpispmp.StockingPointID() );
    //  info( "生产的产品:", fpispmp.ProductID(), "------产品在库存点-------:", fpispmp.StockingPointID() );
      traverse ( period_MPS, Elements, pmp ) {     
        // CapacityAllocationResults::IterativeGeneration( globalOTDTable, pisp, 1, null( NewSupply ), -1.0, pmp.StartDate() ); 老版
        CapacityAllocationResults::IterativeGeneration2( globalOTDSOP, fpispmp, pmp.StartDate(), capacityAllocationResultsRuleConfigurations, 0, null( NewSupply ), 0.0 );
      }
    }
    
    traverse ( globalOTDSOP, CapacityAllocationResults, car ) {
      car.VersionNumber( scenario.Name() );
    }
  *]
}