陈清红
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
Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditInventoryTarget_OnOK
{
  #keys: '[139394.1.939163035]'
  Body:
  [*
    // On ok
    this.ApplyChanges();
    
    data := DataHolderDialogData.Data();
    
    if( isnull( data.WrappedInstance() ) )
    {
      newinvspec := InventorySpecification::Create( data.Product_MP(),
                                      data.StockingPoint_MP(),
                                      data.Start(),
                                      false,
                                      0.0,
                                      0.0,
                                      data.HasMinLevelInDays(),
                                      ApplicationMacroPlanner.FormatStringToReal( efMinInventoryLevel.Text() ),
                                      ApplicationMacroPlanner.FormatStringToReal( efMinInventoryLevel.Text() ),
                                      data.HasMaxLevel(),
                                      data.HasMaxLevelInDays(),
                                      ApplicationMacroPlanner.FormatStringToReal( efMaxInventoryLevel.Text() ),
                                      ApplicationMacroPlanner.FormatStringToReal( efMaxInventoryLevel.Text() ),
                                      false /*iscalculated*/,
                                      false /*isfromdb*/ );
      // Access the form, select the new inventory spec
      DataHolderForm.Data().ListInventoryTargets().SelectByKey( newinvspec.Key() );
       
    }
    else
    {
      InventorySpecification::Update( DataHolderDialogDatas.Data(),
                                      data.Product_MP(),
                                      data.StockingPoint_MP(),
                                      dsStart.Date(), // Read-only, apply changes to shadow is not taking place for read-only attribute when editing.
                                      false /*batchedittarget*/, // Target is now handled in object Safety Stock
                                      false /*hastragetindays*/,
                                      0.0 /*TargetInDays*/,
                                      0.0 /*TargetInQuantity*/,
                                      cbBatchEditMinInventory.Checked(),
                                      data.HasMinLevelInDays(),
                                      ApplicationMacroPlanner.FormatStringToReal( efMinInventoryLevel.Text() ),
                                      ApplicationMacroPlanner.FormatStringToReal( efMinInventoryLevel.Text() ),
                                      cbBatchEditMaxInventory.Checked(),
                                      data.HasMaxLevel(),
                                      data.HasMaxLevelInDays(),
                                      ApplicationMacroPlanner.FormatStringToReal( efMaxInventoryLevel.Text() ),
                                      ApplicationMacroPlanner.FormatStringToReal( efMaxInventoryLevel.Text() ),
                                      false /*isfromdb*/ );  
    }
    
    this.Close();
  *]
}