hongji.li
2023-11-07 192c736b8ac4b2d84cb823ac71f17e507948a5e8
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
77
78
79
80
81
82
83
84
85
86
87
88
Quintiq file version 2.0
#parent: #root
Method OnOK () derived id:Method_DialogCreateEditCustomerOrder_OnOK
{
  #keys: '[136682.1.803177914]'
  BaseType => //DialogCreateEditSalesDemand/Method_DialogCreateEditSalesDemand_OnOK
  Body:
  [*
    Form.ApplyChanges();
    this.SetAttributeAfterApplyData();
    
    data := DataHolderDialogData.Data();
    selection := DataHolderSalesDemands.Data().Copy();
    isbatchedit := selection.Size() > 1; 
    
    
    if( isnull( data.WrappedInstance() ) )
    {
      data.ID( MacroPlan.IDHolder().GetSalesDemandID( "User_", "" ) );
      CustomerOrder::Create( data.ID(),
                             DropDownListProduct.Data(),
                             DropDownListStockingPoint.Data(),
                             data.StartDate(),
                             data.Quantity(),
                             data.Price(),
                             data.Priority(),
                             data.SalesSegment_MP(),
                             data.Currency_MP(),
                             data.UnitOfMeasure_MP(),
                             false,
                             true,
                             data.IsExcludedFromFulfillmentKPI(),
                             data.CustomerName(),
                             data.CustomerID(),
                             data.OrderID(),
                             data.OrderLineID(),
                             data.IsEligibleForNetting(),
                             data.IsFirmed(),  
                             false 
                           );
    }
    
    else
    {
      quantity := ApplicationMacroPlanner.FormatStringToReal( EditFieldQuantityUom.Text(), 0.0 );
      
      customerorders := selectset( selection, Elements.astype( CustomerOrder ), f, true, true );
      CustomerOrder::Update( customerorders,
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListProduct ),
                             DropDownListProduct.Data(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListStockingPoint ),
                             DropDownListStockingPoint.Data(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DateSelectorStart ),
                             data.StartDate(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldQuantityUom ),
                             quantity,
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldPrice ),
                             data.Price(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListPriority ) or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckBoxIsExcludedFromFulfillmentKPI ),
                             data.Priority(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListSalesSegment ),
                             data.SalesSegment_MP(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListCurrency ),
                             data.Currency_MP(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( DropDownListUnitOfMeasurement ),
                             data.UnitOfMeasure_MP(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckBoxIsExcludedFromFulfillmentKPI ),
                             ifexpr( CheckBoxIsExcludedFromFulfillmentKPI.Enabled(), 
                                     CheckBoxIsExcludedFromFulfillmentKPI.Checked(),
                                     data.IsExcludedFromFulfillmentKPIUser() ),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldCustomerName ),
                             data.CustomerName(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldCustomerID ),
                             data.CustomerID(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldOrderID ),
                             data.OrderID(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( EditFieldOrderLineID ),
                             data.OrderLineID(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckboxIsForNetting ),
                             data.IsEligibleForNetting(),
                             not isbatchedit or ApplicationMacroPlanner.IsActionLinkEnabledEdit( CheckboxIsFirmed ),
                             data.IsFirmed(),
                             true );  
    }
    
    Form.Close();
  *]
}