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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method GetTestSalesDemands ( 
 |    MacroPlan macroplan 
 |  ) as owning Forecasts 
 |  { 
 |    TextBody: 
 |    [* 
 |      // mbd4 Dec-3-2020 (created) 
 |      ids := construct( Strings ); 
 |      ids.Add( "SD_" + this.GetUTFDatasetname() + "_1" ); 
 |      ids.Add( "SD_" + this.GetUTFDatasetname() + "_2" ); 
 |      ids.Add( "SD_" + this.GetUTFDatasetname() + "_3" ); 
 |       
 |      salesdemands := selectset( macroplan, SalesDemand.astype( Forecast ), sd, exists( ids, Elements, id, id = sd.ID() ) ); 
 |       
 |      if( salesdemands.Size() = 0 ) 
 |      { 
 |        products := this.GetTestProducts( macroplan ); 
 |        stockingpoint := this.GetTestStockingPoint( macroplan ); 
 |        period := this.GetTestPeriod( macroplan ); 
 |        defaultcurrency := macroplan.BaseCurrency(); 
 |        defaultuom := macroplan.DefaultUnitOfMeasure(); 
 |         
 |        i := 0; 
 |        traverse( products, Elements, product ) 
 |        { 
 |          sd := Forecast::Create( product, 
 |                                     stockingpoint, 
 |                                     ids.Element( i ), 
 |                                     period.StartDate(), 
 |                                     period.EndDate(), 
 |                                     1000.0, //qty 
 |                                     1000.0, 
 |                                     "Normal", 
 |                                     "CanMan China", 
 |                                     defaultcurrency.ID(), 
 |                                     defaultuom.Name(), 
 |                                     0.0, 
 |                                     false, 
 |                                     false 
 |                                    ); 
 |                                     
 |          salesdemands.Add( sd ); 
 |                               
 |          i := i + 1; 
 |        } 
 |      } 
 |       
 |      return &salesdemands; 
 |    *] 
 |    InterfaceProperties { Accessibility: 'Module' } 
 |  } 
 |  
  |