yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
89
90
91
92
93
94
95
96
97
98
99
100
Quintiq file version 2.0
#parent: #root
Method Update (
  Product_MP owner,
  StockingPoint_MP stockingpoint,
  Date start,
  Boolean hastargetindays,
  Real targetindays,
  Real targetinquantity,
  Boolean hasminlevelindays,
  Real minlevelindays,
  Real minlevelinquantity,
  Boolean hasmaxlevel,
  Boolean hasmaxlevelindays,
  Real maxlevelindays,
  Real maxlevelinquantity,
  Boolean iscalculated,
  Boolean isfromdb
)
{
  Description: 'Update inventory specification'
  TextBody:
  [*
    // Update type index of inventory specification
    this.UpdateTypeIndex( owner.ID(), stockingpoint.ID(), start );
    
    needsync := this.Product_MP() <> owner
                or this.StockingPoint_MP() <> stockingpoint;
    
    // Check if there are any changes to product/stocking point
    if( needsync )
    {
      owner.InventorySpecification( relmove, this );
    
      // create pisp when there is changes to product / stocking point
      owner.AddToStockingPoint( stockingpoint );
    }
    
    
    this.HasTargetInDays_DELETED_Nov19( hastargetindays )
    this.TargetInDays_DELETED_Nov19( targetindays );
    
    // If TargetInQuantity is not changed on the dialog then IsCalculated value should not be updated.
    // iscalculated parameter is always send as false from the dialog and always send as true from the generate safety stock method. 
    if( not ( ( this.TargetInQuantity_DELETED_Nov19() = targetinquantity ) and not iscalculated ) )
    {
      this.IsCalculated( iscalculated );
    }
    this.TargetInQuantity_DELETED_Nov19( targetinquantity );
    
    // Check if inventory specification has target in days
    if( hastargetindays )
    {
      this.TargetInQuantity_DELETED_Nov19( 0 );
      this.IsCalculated( iscalculated );
    }
    else
    {
     this.TargetInDays_DELETED_Nov19( 0 );
    }
    
    this.HasMinLevelInDays( hasminlevelindays );
    this.MinLevelInDays( minlevelindays );
    this.MinLevelInQuantity( minlevelinquantity );
    // Check if inventory specification has min level in days
    if( hasminlevelindays )
    {
     this.MinLevelInQuantity( 0 );
    }
    else
    {
      this.MinLevelInDays( 0 );
    }
    
    this.HasMaxLevel( hasmaxlevel );
    this.HasMaxLevelInDays( hasmaxlevelindays );
    this.MaxLevelInDays( maxlevelindays );
    this.MaxLevelInQuantity( maxlevelinquantity );
    // Check if inventory specification has max level
    if( hasmaxlevel )
    {
      // Check if inventory specification has max level in days
      if( hasmaxlevelindays )
      {
        this.MaxLevelInQuantity( 0 );
      }
      else
      {
        this.MaxLevelInDays( 0 );
      }
    }
    else
    {
      this.MaxLevelInQuantity( 0 );
      this.MaxLevelInDays( 0 );
    }
    
    this.IsManuallyConfigured( not isfromdb );
  *]
}