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
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
Quintiq file version 2.0
#parent: #root
Method CreateCustomerOrders () as stream[Void]
{
  TextBody:
  [*
    key := DatasetController::Find( DatasetFindOptions::Construct( this.GetUTFDatasetname() ) );
    
    if ( key.Size() =0 )
    {
       wait := stream[Void]::Wait( Duration::Seconds( 10 ) );
       this->After( wait )->CreateCustomerOrders();
    }
    else
    { 
      opt := DatasetFindOptions::Construct( this.GetUTFDatasetname() );
      mp := MDSMacroPlan::Find( opt );
      mp->( macroplan )
      {
          sopyear := macroplan.StartOfPlanning().Year();
          currency := "EUR";
          price := 2280.0;
          priority := "Normal";
          salesegmentAllOrganic := "All Organics";
          salesegmentCanManChina := "CanMan China";
          salesegmentSpecialCan := "Special Can";
          salesegmentAudiA8 := "Audi A8";
          uom := "Ton";
          product_bc_cb_narrow := macroplan.FindProduct( "BC CB narrow" );
          product_bc_cb_wide := macroplan.FindProduct( "BC CB wide" );
          product_bc_cb_regular := macroplan.FindProduct( "BC CB regular" );
          product_bc_ce_clear_coated := macroplan.FindProduct( "BC CE clear coated" );
          product_CPN_blank_curved := macroplan.FindProduct( "CPN blank - curved" );
          product_CPN_blank_laser := macroplan.FindProduct( "CPN blank - laser" );
          stockingpointNA := macroplan.FindStockingPoint( "North America" );
          stockingpointAsia := macroplan.FindStockingPoint( "Asia" );
          stockingpointEurope := macroplan.FindStockingPoint( "Europe" );
         
          isfromdb := false;
          isfornetting := true;
          isfirmed := true;
          isexcludefromfulfillmentKPI := false;
          janstart := Date::Construct( sopyear, 1, 1 );
          febstart := Date::Construct( sopyear, 2, 1 );
          marstart := Date::Construct( sopyear, 3, 1 );
          //Delete the demo data customer orders and create a desired set of data
          this.DeleteAllCustomerOrder( macroplan );
          
          // Firmed customer orders (those cannot be postponed)
          CustomerOrder::Create( product_bc_cb_wide, stockingpointAsia, "ID1", janstart, 4395.116756477, price, priority, salesegmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_wide, stockingpointAsia, "ID2", janstart, 5371.809369027, price, priority, salesegmentSpecialCan, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_regular, stockingpointAsia, "ID3", janstart, 4395.116756477, price, priority, salesegmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_regular, stockingpointAsia, "ID4", janstart, 5371.809369027, price, priority, salesegmentSpecialCan, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointAsia, "ID5", janstart, 4395.116756477, price, priority, salesegmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointAsia, "ID6", janstart, 5371.809369027, price, priority, salesegmentSpecialCan, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb);
          CustomerOrder::Create( product_bc_ce_clear_coated, stockingpointAsia, "ID7", janstart, 824.084391839, 2340.0, priority, salesegmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_ce_clear_coated, stockingpointAsia, "ID8", janstart, 1007.214256693, 2340.0, priority, salesegmentSpecialCan, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_ce_clear_coated, stockingpointAsia, "ID9", janstart, 824.084391839, 2400.0, priority, salesegmentCanManChina, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_ce_clear_coated, stockingpointAsia, "ID10", janstart, 1007.214256693, 2400.0, priority, salesegmentSpecialCan, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_CPN_blank_curved, stockingpointEurope, "ID11", janstart, 112.043330461, 2700.0, priority, salesegmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_CPN_blank_laser, stockingpointEurope, "ID12", janstart, 112.043330461, 2700.0, priority, salesegmentAudiA8, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointNA, "ID13", janstart, 4987.08826119, 2280.0, priority, salesegmentAllOrganic, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointNA, "ID14", febstart, 5389.047962042, 2280.0, priority, salesegmentAllOrganic, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointNA, "ID15", marstart, 7144.96045453, 2280.0, priority, salesegmentAllOrganic, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
          
          // Not firmed customer orders (can be postponed)
          isfirmed := false;
          CustomerOrder::Create( product_bc_cb_narrow, stockingpointEurope, "ID1_NotFirm", janstart, 4987.08826119, 2280.0, priority, salesegmentAllOrganic, currency, uom, isexcludefromfulfillmentKPI,"", "","","", isfornetting, isfirmed, isfromdb );
      }
    }
    
    return Transaction::GetCurrentTask().OnFinish();
  *]
  InterfaceProperties { Accessibility: 'Module' }
}