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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod GenerateForecast ( 
 |    ArchiveExecutionStatus archiveExecutionStatus, 
 |    MacroPlan macroPlan 
 |  ) 
 |  { 
 |    TextBody: 
 |    [* 
 |      traverse ( macroPlan, SalesDemand.astype( Forecast ), f ) { 
 |        f.Delete(); 
 |      } 
 |       
 |      traverse ( archiveExecutionStatus, TemporaryDemandData, tdd ) { 
 |        targetProduct_MP       := select( macroPlan, Product_MP, tempPMP, tempPMP.ID() = tdd.ProductID() ); 
 |        targetStockingPoint_MP := select( macroPlan, StockingPoint_MP, tempSPMP, tempSPMP.ID() = tdd.StockingPointID() ); 
 |        info( tdd.SalesSegmentName() ); 
 |        if ( not isnull( targetProduct_MP ) and not isnull( targetStockingPoint_MP ) ) { 
 |          forcest := Forecast::Create( targetProduct_MP, 
 |                            targetStockingPoint_MP, 
 |                            [String]tdd.ID(), 
 |                            tdd.StartDate(), 
 |                            tdd.EndDate(), 
 |                            tdd.Quantity(), 
 |                            [Real]tdd.Price(), 
 |                            tdd.PriorityName(), 
 |                            tdd.SalesSegmentName(), 
 |                            tdd.CurrencyID(), 
 |                            tdd.UnitOfMeasureName(), 
 |                            0.0, 
 |                            false, 
 |                            false 
 |                           ); 
 |          forcest.Origin( tdd.Origin() ); 
 |        } 
 |      } 
 |    *] 
 |  } 
 |  
  |