lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
43
44
45
46
47
48
Quintiq file version 2.0
#parent: #root
Method CreateTestData (
  MacroPlan macroplan
)
{
  Description: 'This method clears all inventory supplies and creates the data required for the start situation'
  TextBody:
  [*
    sop := macroplan.StartOfPlanning();
    
    // Delete inventory supplies
    inventorySupplies := selectset( macroplan, Product_MP.InventorySupply, supplies, true );
    InventorySupply::Delete( inventorySupplies );
    
    // Delete period specifications
    periodSpecs := selectset( macroplan, PeriodSpecification_MP, ps, not ps.IsDummyPlanningPeriod() ); 
    PeriodSpecification_MP::Delete( periodSpecs );
    
    // Create Month period specification, 0 historical periods, 18 future periods
    monthID := 'Month';
    PeriodSpecification_MP::Create( monthID, macroplan, monthID, 1, sop, 0, 18, false, true, false );
    
    // Create MYR currency and conversion rates
    myrID := 'MYR';
    myr := Currency_MP::Create( myrID, macroplan, myrID, myrID, false, false );
    CurrencyRate_MP::Create( myr, Date::Construct( sop.Year() - 1, 1, 1 ), 0.25, false );
    CurrencyRate_MP::Create( myr, Date::Construct( sop.Year(), 1, 1 ), 0.20, false );
    
    // Set KPI horizon to SOP year
    macroplan.GlobalParameters_MP().StartOfKPIHorizon( sop.Date() );
    macroplan.GlobalParameters_MP().EndOfKPIHorizon( Date::Construct( sop.Year(), 12, 31 ) );
    
    // Create Stocking points
    myWarehouseID := 'MY Warehouse';
    plantWarehouseID := 'Plant Warehouse';
    MY_Warehouse := StockingPoint_MP::Create( myWarehouseID, macroplan, null( Unit ), myWarehouseID, null( SupplyChainView ), 0, 0, false );
    MY_Warehouse.CurrencyID( myrID );
    StockingPoint_MP::Create( plantWarehouseID, macroplan, null( Unit ), plantWarehouseID, null( SupplyChainView ), 0, 0, false );
    
    // Create products
    quibiID := 'Quibi';
    pulpID := 'Pulp';
    Product_MP::Create( quibiID, macroplan, null( Product_MP ), quibiID, null( SupplyChainView ), 0, 0, false );
    Product_MP::Create( pulpID, macroplan, null( Product_MP ), pulpID, null( SupplyChainView ), 0, 0, false );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}