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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method CreateTestData ( 
 |    MacroPlan macroplan 
 |  ) as stream[ProductInStockingPoint_MP] 
 |  { 
 |    Description: 'Create unit= supplier, quico, product = pulp, quibi, stocking point = warehouse, routing = supplier and quico' 
 |    TextBody: 
 |    [* 
 |      spid := 'Warehouse'; 
 |      unit1id:= 'Supplier'; 
 |      unit2id:= 'Quico'; 
 |      product1 := 'Pulp'; 
 |      product2 := 'Quibi'; 
 |       
 |      pisp := this->( utf ) 
 |      { 
 |        periodspec := select( macroplan, PeriodSpecification_MP, ps, not ps.IsDummyPlanningPeriod() ); 
 |        periodspec.Update( 'Quarterly', 'Quarter', 1, this.GetDateTimeSOP( 2016, 1, 1 ) , 0, 4, true,false, true, false);   
 |        macroplan.UpdateStartOfPlanning( this.GetDateTimeSOP( 2016, 1, 1 ) ); 
 |      } 
 |      ->() 
 |      { 
 |        uom := select( macroplan, UnitOfMeasure_MP, u, u.IsDefault() ); 
 |        currency := select ( macroplan, Currency_MP, cur, cur.IsBase() ); 
 |        sop := macroplan.StartOfPlanning(); 
 |         
 |        // Create stocking point and units 
 |        spWarehouse := StockingPoint_MP::Create( macroplan, spid,"", spid, uom.Name(), currency.ID(), false, Date::MinDate(), Date::MaxDate(), "", "", false ); 
 |        unitSupplier := Unit::Create( unit1id, macroplan, unit1id, uom, null( Unit ), "Infinite", "", null( SupplyChainView ),0,0, false ); 
 |        unitQuiCo := Unit::Create( unit2id, macroplan, unit2id, uom, null( Unit), 'Quantity', "", null( SupplyChainView ), 0, 0, false ); 
 |         
 |        // Create 4 unit capacities 
 |        UnitCapacity::Create( unitQuiCo, sop, 'Quarter', 0.0, 1000.0, 100.0, 1, false ); 
 |        UnitCapacity::Create( unitQuiCo, this.GetDateTimeSOP( sop.Year(), 4,1 ), 'Quarter', 0.0, 1000.0, 100.0, 1, false ); 
 |        UnitCapacity::Create( unitQuiCo, this.GetDateTimeSOP( sop.Year(), 7, 1 ), 'Quarter', 0.0, 500.0, 100.0, 1, false ); 
 |        UnitCapacity::Create( unitQuiCo, this.GetDateTimeSOP( sop.Year(), 10, 1 ), 'Quarter', 0.0, 1000.0, 100.0, 1, false ); 
 |         
 |        //Create products and cost 
 |        pPulp := Product_MP::Create( product1, macroplan, null( Product_MP ), product1, null( SupplyChainView ), 0, 0, false ); 
 |        pQuibi :=Product_MP::Create( product2, macroplan, null( Product_MP ), product2, null( SupplyChainView ), 0, 0, false ); 
 |         
 |        accinventoryvalue := select( macroplan, Account_MP, acc, acc.Name() = 'Inventory value' ); 
 |        ProductValueAndCost::Create( pQuibi.ID(), pQuibi,accinventoryvalue, 'Inventory value', Date::Construct( 2016, 1, 1 ), 100.0, false ); 
 |         
 |        // Assign to product to stocking point 
 |        pulpinwarehouse := pPulp.AddToStockingPoint( spWarehouse ); 
 |        quibiinwarehouse := pQuibi.AddToStockingPoint( spWarehouse ); 
 |         
 |        // Create routings and routing steps 
 |        routingQuico := Routing::Create( macroplan, unitQuiCo.Name(), unitQuiCo.Name(), Date::MinDate(), Date::MaxDate(), false, false ); 
 |        routingSupplier := Routing::Create( macroplan, unitSupplier.Name(), unitSupplier.Name(), Date::MinDate(), Date::MaxDate(), false, false ); 
 |         
 |        routingstepQuico := RoutingStep::Create( routingQuico, unitQuiCo.Name(),"", false); 
 |        routingstepSupplier := RoutingStep::Create( routingSupplier, routingSupplier.Name(), "", false ); 
 |         
 |        // Create Quico operation and operation cost 
 |        accoperationcost := select( macroplan, Account_MP, acc, acc.Name() = 'Operating cost', true ); 
 |        operationQuico := Operation::Create( unitQuiCo.ID(), unitQuiCo, unitQuiCo.Name(), routingstepQuico, Duration::Days( 3.0 ),  Duration::Days( 1.5 ), 1.0, false, 0.0, false, 0.0,0.0,0.0, false, false ); 
 |        OperationCost::Create( '1', operationQuico, accoperationcost, 'Volume', Date::Construct( 2016, 1, 1 ), 'Day', 0, 50.0, false); 
 |         
 |        // Create Supplier operation and sourcing cost 
 |        operationSupplier := Operation::Create( unitSupplier.ID(), unitSupplier, unitSupplier.Name(), routingstepSupplier, Duration::Days( 2.0 ), Duration::Days( 1.0 ), 1.0, false,0.0, false, 0.0,0.0,0.0, false, false ); 
 |        accsourcingcost := select(  macroplan, Account_MP, acc, acc.Name() = 'Sourcing cost', true); 
 |        OperationCost::Create( '2', operationSupplier, accsourcingcost, 'Volume', sop.Date(), 'Day', 0, 40.0, false ); 
 |         
 |        // Create operation input and output for Quico Operation 
 |        OperationBOM::Create( operationQuico, pulpinwarehouse, true, 0, false, 1.0, 1.0, 1.0, false, false ); 
 |        OperationBOM::Create( operationSupplier, pulpinwarehouse, false, 0, false, 1.0, 1.0, 1.0, false, false ); 
 |         
 |        // Create operation output for Supplier operation 
 |        OperationBOM::Create( operationQuico, quibiinwarehouse, false, 0, false, 1.0, 1.0, 1.0, false, false ); 
 |         
 |        // Create 1 sales demand 
 |        Forecast::Create( pQuibi, spWarehouse, '1', sop.Date(), Date::Construct( sop.Year(), 4, 1 ), 750.0, 0.0, 'Normal', 'All sales segment', currency.ID(), uom.Name(), 5.0, false, false ); 
 |       return quibiinwarehouse; 
 |      }   
 |       
 |      return pisp; 
 |    *] 
 |    InterfaceProperties { Accessibility: 'Module' } 
 |  } 
 |  
  |