Kevin Kok Khah Whey
2023-09-25 34d29be6a3eb0c025da50b77f2107c4ad259c6c0
_Main/BL/Type_CapacityAllocationResults/StaticMethod_CreateDate.qbl
@@ -2,27 +2,32 @@
#parent: #root
StaticMethod CreateDate (
  GlobalOTDTable globalOTDTable,
  MacroPlan macroPlan
  MacroPlan macroPlan,
  Scenario scenario
)
{
  TextBody:
  [*
    globalOTDTable.CapacityAllocationResults( relflush );
    
    finaleProduct_MPs := CapacityAllocationResults::ObtainTheFinalOutputProduct( macroPlan );
    finaleProductInStockingPoint_MPs := CapacityAllocationResults::ObtainTheFinalOutputProduct( macroPlan, globalOTDTable );
    
    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 ( finaleProduct_MPs, Elements, fpmp/*, fpmp.ID() = "ProXOver 1 D2.6 A"*/ ) {
      traverse ( fpmp, ProductInStockingPoint_MP, pisp, /*pisp.Name() = "ProXOver 1 D2.6 A in Finished Cars (France)" and*/ not pisp.IsSystem() ) {
        traverse ( period_MPS, Elements, pmp ) {
          CapacityAllocationResults::IterativeGeneration( globalOTDTable, pisp, 1, null( NewSupply ), -1.0, pmp.StartDate() );
        }
    //    info( pisp.Name() );
    traverse ( finaleProductInStockingPoint_MPs, Elements, fpispmp ) {
      capacityAllocationResultsRuleConfigurations := selectset( globalOTDTable, 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( globalOTDTable, fpispmp, pmp.StartDate(), capacityAllocationResultsRuleConfigurations, 0, null( NewSupply ), 0.0 );
      }
    }
    traverse ( globalOTDTable, CapacityAllocationResults, car ) {
      car.VersionNumber( scenario.Name() );
    }
  *]
}