admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  String id,
  Product_MP owner,
  StockingPoint_MP stockingpoint,
  Date startdate,
  Date enddate,
  Real quantity,
  Real price,
  Priority priority,
  SalesSegment_MP salessegment,
  Currency_MP currency,
  UnitOfMeasure_MP unitofmeasure,
  Boolean ismanualpostponed,
  Boolean ismanualcreate,
  Real demanduncertaintypercentage,
  Boolean isexcludedfromfulfillmentkpi,
  Boolean isfromdb
) as Forecast
{
  Description: 'Create an instance of SalesDemand.'
  TextBody:
  [*
    pisp := owner.AddToStockingPoint( stockingpoint );
    
    sd := owner.SalesDemand( relnew, 
                             Forecast,
                             //Set the relations so that these relations can be used in the same transaction without propagation
                             MacroPlan := owner.MacroPlan(),
                             SalesSegment_MP := salessegment,
                             Priority := priority,
                             Currency_MP := currency,
                             ProductInStockingPoint_MP := pisp,
                             ID := id,
                             ProductID := owner.ID(),
                             StockingPointID := stockingpoint.ID(),
                             DemandUncertaintyPercentage := demanduncertaintypercentage,
                             IsExcludedFromFulfillmentKPIUser := isexcludedfromfulfillmentkpi
                           );
    
    // Create decision log
    description := Translations::MP_SalesDemand_Create_Description( sd,
                                                                    startdate,
                                                                    enddate );
    sd.MacroPlan().CreateDecisionLog( description, ismanualcreate );
    
    sd.Update( owner, stockingpoint, startdate, enddate, quantity, price, priority, demanduncertaintypercentage, salessegment, currency, unitofmeasure, isexcludedfromfulfillmentkpi, isfromdb );
    
    return sd;
  *]
}