hongji.li
2023-11-11 df5a7e1ad6835e78b2f9eb7428817b0c23b116bc
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
Quintiq file version 2.0
#parent: #root
Method SetDefaultValue (
  ProductInStockingPointInPeriod pispip
) id:Method_DialogCreateEditInventorySpecification_SetDefaultValue
{
  #keys: '[105706.0.1326635825]'
  Body:
  [*
    // Set the default value for the fields in the dialog
    
    data := Dialog.Data();
    
    start := MacroPlan.Start().Date();
    hasmininday := false;
    mininday := 0.0;
    mininquantity := 0.0;
    hasmax := false;
    hasmaxinday := false;
    maxinday := 0.0;
    maxinquantity := 0.0;
    
    if( not isnull( pispip ) )
    {
      // To inherit the value from last inventory spec while creating a new inventory spec
      inventoryspec := pispip.InventorySpecification();
      start := pispip.Start().Date();
    
      if( not isnull( inventoryspec  ) )
      {
        hasmininday := inventoryspec.HasMinLevelInDays();
        mininday := inventoryspec.MinLevelInDays();
        mininquantity := inventoryspec.MinLevelInQuantity();
        hasmax := inventoryspec.HasMaxLevel();
        hasmaxinday := inventoryspec.HasMaxLevelInDays();
        maxinday := inventoryspec.MaxLevelInDays();
        maxinquantity := inventoryspec.MaxLevelInQuantity();
      }
      else
      {
        hasmininday := pispip.GetHasMinLevelInDays(); 
        mininday := pispip.MinLevelInDays();
        mininquantity := pispip.MinLevelInQuantity();
        hasmax := pispip.GetHasMaxLevel();
        hasmaxinday := pispip.GetHasMaxLevelInDays();
        maxinday := pispip.MaxLevelInDays();
        maxinquantity := pispip.MaxLevelInQuantity();
      }
    }
    
    // Assigning value to Read-Only attribute will result in runtime error.
    if( isnull( data.WrappedInstance() ) )
    {
      data.Start( start );
    }
    
    
    data.HasMinLevelInDays( hasmininday )
    data.MinLevelInDays( mininday );
    data.MinLevelInQuantity( mininquantity );
    
    data.HasMaxLevel( hasmax );
    data.HasMaxLevelInDays( hasmaxinday );
    data.MaxLevelInDays( maxinday );
    data.MaxLevelInQuantity( maxinquantity );
  *]
}