Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
Quintiq file version 2.0
#parent: #root
StaticMethod CreateUpdate (
  Product_MP owner,
  StockingPoint_MP stockingpoint,
  Boolean hasunitofmeasure,
  String unitofmeasurename,
  Boolean isnegativeinventoryallowed,
  Boolean isexcluded,
  Boolean isexlcudedfrombalancing,
  Boolean issafetystockkept,
  Real inputlotsize,
  Boolean isexcludeshelflife,
  Boolean isfromdb
) as PISPSpecification
{
  Description: 'Creates an instance of PISPSpecification if not found, else update'
  TextBody:
  [*
    // Get existing PISPSpecification
    pispspec := PISPSpecification::FindPISPSpecificationTypeIndex( owner.ID(), stockingpoint.ID() );
    
    // If there's no existing PISPSpecification found, create one
    if( isnull( pispspec ) )
    {
      // Create PISPSpecification
      pispspec := PISPSpecification::Create( owner,
                                             stockingpoint,
                                             hasunitofmeasure,
                                             unitofmeasurename,
                                             isnegativeinventoryallowed,
                                             isexcluded,
                                             isexlcudedfrombalancing,
                                             issafetystockkept,
                                             inputlotsize,
                                             isexcludeshelflife,
                                             isfromdb ); 
    }
    // Else, update the existing PISPSpecification
    else
    { 
      // Update PISPSpecification
      pispspec.Update( hasunitofmeasure,
                       unitofmeasurename,
                       isnegativeinventoryallowed,
                       isexcluded,
                       isexlcudedfrombalancing,
                       issafetystockkept,
                       inputlotsize,
                       isexcludeshelflife,
                       isfromdb );
    }
    
    return pispspec;
  *]
}