admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
StaticMethod Update (
  ProductInStockingPoint_MPs pisps,
  Boolean isbatcheditunitofmeasure,
  Boolean hasunitofmeasure,
  String unitofmeasurename,
  Boolean isbatcheditisnegativeinventoryallowed,
  Boolean isnegativeinventoryallowed,
  Boolean isbatcheditisexcluded,
  Boolean isexcluded,
  Boolean isbatcheditisexcludedfrombalancing,
  Boolean isexcludedfrombalancing,
  Boolean isbatcheditisssafetystockkept,
  Boolean issafetystockkept,
  Boolean isbatcheditinputlotsize,
  Real inputlotsize,
  Boolean isbatcheditexcludeshelflife,
  Boolean isexcludeshelflife,
  Boolean isfromdb
)
{
  Description: 'Batch update'
  TextBody:
  [*
    // Batch update the selected set of ProductInStockingPoint_MPs' PISPSpecification
    // Traverse the selected set of ProductInStockingPoint_MPs
    traverse( pisps, Elements, pisp )
    {
      // Get PISPSpecification of the current ProductInStockingPoint_MP
      spec := pisp.PISPSpecification();
      
      // Populate the respective variables with data according to whether the attributes are selected for batch updating
      hasunitofmeasure := ifexpr( isbatcheditunitofmeasure, hasunitofmeasure, guard( spec.HasUnitOfMeasure(), false ) );
      unitofmeasurename := ifexpr( isbatcheditunitofmeasure, unitofmeasurename, guard( spec.UnitOfMeasureName(), pisp.UnitOfMeasureName() ) );
      isnegativeinvetoryallowed := ifexpr( isbatcheditisnegativeinventoryallowed, isnegativeinventoryallowed, guard( spec.IsNegativeInventoryAllowed(), false ) );
      isexcluded := ifexpr( isbatcheditisexcluded, isexcluded, guard( spec.IsExcluded(), false ) );
      isexcludedfrombalancing := ifexpr( isbatcheditisexcludedfrombalancing, isexcludedfrombalancing, guard( spec.IsExcludedFromBalancing(), false ) );
      issafetystockkept := ifexpr( isbatcheditisssafetystockkept, issafetystockkept, guard( spec.IsSafetyStockKept(), false ) );
      inputlotsize := ifexpr( isbatcheditinputlotsize, inputlotsize, guard( spec.InputLotSize(), 0.0 ) );    
      isexcludeshelflife := ifexpr( isbatcheditexcludeshelflife, isexcludeshelflife, guard( spec.IsExcludeShelfLifeAndMaturation(), false ) );
    
      // Create/Update PISPSpecification
      PISPSpecification::CreateUpdate( pisp.Product_MP(),
                                       pisp.StockingPoint_MP(), 
                                       hasunitofmeasure,
                                       unitofmeasurename,
                                       isnegativeinvetoryallowed,
                                       isexcluded,
                                       isexcludedfrombalancing,
                                       issafetystockkept,
                                       inputlotsize,
                                       isexcludeshelflife,
                                       isfromdb
                                       );
      
    }
  *]
}