chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method SetSalesDemandQuantity (
  MacroPlan macroplan,
  String salesDemandInfo
)
{
  TextBody:
  [*
    // Get sales demand, adjust quantity
    traverse( salesDemandInfo.Tokenize( String::NewLine() ), Elements, sdinfo )
    {
      
      sd := sdinfo.Tokenize( ',' );
      product       := sd.Element( 0 ).TrimBoth();
      stockingPoint := sd.Element( 1 ).TrimBoth();
      salesSegment  := sd.Element( 2 ).TrimBoth();
      start         := this.ConvertToDateTime( sd.Element( 3 ), macroplan );
      qty           := this.ConvertToReal( sd.Element( 4 ) );
      demand        := select( macroplan, SalesDemand, e, e.ProductID() = product 
                                                          and e.StockingPointID() = stockingPoint
                                                          and e.SalesSegmentName() = salesSegment
                                                          and e.StartDate() = start.Date() );
      demand.Update( demand.Product_MP(), demand.StockingPoint_MP(), demand.StartDate(), demand.EndDate(), qty, demand.Price(), demand.Priority(), demand.DemandUncertaintyPercentage(), demand.SalesSegment_MP(), demand.Currency_MP(), demand.UnitOfMeasure_MP(), demand.IsExcludedFromFulfillmentKPI(), false );
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}