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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method AddIntermediateSalesDemand_AtDistr 
 |  { 
 |    TextBody: 
 |    [* 
 |      startdate := Date::Construct( 2020, 7, 1 );  
 |      enddate := Date::Construct( 2020, 10, 1 );  
 |      qty := 100000.0;  
 |      traverse( this, SalesSegment_MP, ss, ss.Name() = 'FakeSD' )  
 |      { 
 |        traverse( ss, SalesDemand, sd )  
 |        { 
 |          sd.Delete();  
 |        } 
 |      } 
 |       
 |      traverse( this, Priority, prio, prio.Name() = 'FakeSD' )  
 |      { 
 |        traverse( prio, SalesDemand, sd )  
 |        { 
 |          sd.Delete();  
 |        } 
 |      } 
 |      traverse( this, StockingPoint_MP, sp, sp.Name() ~ 'DIS' ) // 624 means customer beyond the distribution  
 |      { 
 |        debuginfo(  'Creating fake products for SP ', sp.Name(), 'nr products', sp.ProductInStockingPoint_MP( relsize ) );  
 |         
 |        cnt := 0;  
 |        traverse( sp, ProductInStockingPoint_MP, pisp )  
 |        { 
 |          cnt++;  
 |          if ( cnt mod 1000 = 0 )  
 |          { 
 |            debuginfo(  'processed', cnt, ' products' );  
 |          } 
 |          product := pisp.Product_MP();  
 |          if ( not product.Name() ~ 'RAW'  and product.IsLeaf() )  
 |          { 
 |            qty := sum(  pisp,  
 |                         LaneLegInput.LaneLeg.LaneLegOutput.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype(  ProductInStockingPointInPeriodPlanningLeaf ),  
 |                         pispip,  
 |                         pispip.ProductInStockingPoint_MP().Product_MP() = pisp.Product_MP(),  
 |                         sum(  pispip,  
 |                               ProductInStockingPoint_MP.OperationInput.Operation.OperationOutput.ProductInStockingPoint_MP.ProductInStockingPointInPeriodPlanning.astype(  ProductInStockingPointInPeriodPlanningLeaf ),  
 |                               leafpispip,  
 |                               true,  
 |                               leafpispip.SalesDemandQuantity() ) );  
 |            if(  qty > 0 )  
 |            {                          
 |              Forecast::Create(  product, sp, pisp.StockingPointID() + pisp.ProductID(), startdate, enddate, qty,  1.0, 'FakeSD', 'FakeSD', 'EUR', 'm3', 0.0, false, false );  
 |            } 
 |          } 
 |        } 
 |      } 
 |    *] 
 |    InterfaceProperties { Accessibility: 'Module' } 
 |  } 
 |  
  |