陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  String id,
  Product_MP owner,
  StockingPoint_MP stockingpoint,
  Date startdate,
  Real quantity,
  Real price,
  Priority priority,
  SalesSegment_MP salessegment,
  Currency_MP currency,
  UnitOfMeasure_MP unitofmeasure,
  Boolean ismanualpostponed,
  Boolean ismanualcreate,
  Boolean isexcludedfromfulfillmentkpi,
  String customername,
  String customerid,
  String orderid,
  String orderlineid,
  Boolean isfornetting,
  Boolean isfirmed,
  Boolean isfromdb
) as CustomerOrder
{
  Description: 'Create an instance of CustomerOrder'
  TextBody:
  [*
    pisp := owner.AddToStockingPoint( stockingpoint );
    
    co := null( CustomerOrder, owning );
    co := owner.SalesDemand( relnew, 
                             CustomerOrder,
                             //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 := guard( stockingpoint.ID(), '' ),
                             IsExcludedFromFulfillmentKPIUser := isexcludedfromfulfillmentkpi,
                             CustomerID := customerid,
                             CustomerName := customername,
                             OrderID := orderid,
                             OrderLineID := orderlineid,
                             IsEligibleForNetting := isfornetting,
                             IsFirmed := isfirmed
                           );
    
    // Create decision log
    description := Translations::MP_CustomerOrder_Create_Description( co, startdate, startdate );
    co.MacroPlan().CreateDecisionLog( description, ismanualcreate );
    
    co.Update( owner, 
               stockingpoint, 
               startdate, 
               quantity, 
               price, 
               guard( priority.Name(), '' ), 
               guard( salessegment.Name(), ''), 
               guard( currency.ID(), '' ), 
               guard( unitofmeasure.Name(), '' ), 
               isexcludedfromfulfillmentkpi, 
               customername, 
               customerid, 
               orderid, 
               orderlineid, 
               isfornetting, 
               isfirmed,
               isfromdb );
    
    return co;
  *]
}