chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
StaticMethod Create (
  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
) as InventorySpecification
{
  Description: 'Create an inventory specification'
  TextBody:
  [*
    // Create an inventory specification, using part of the given parameters for the read only attributes
    pisp := owner.AddToStockingPoint( stockingpoint );
    inventoryspecification := owner.InventorySpecification( relnew,
                                                            //Set the PISP so that this relation can be used in the same transaction without propagation
                                                            ProductInStockingPoint_MP := pisp,
                                                            ProductID := owner.ID(),
                                                            StockingPointID := stockingpoint.ID(),
                                                            Start := start );
                                                            
    // The other, non readonly attribute, can be set via the update method
    inventoryspecification.Update( owner,
                                   stockingpoint,
                                   start,
                                   hastargetindays,
                                   targetindays,
                                   targetinquantity,
                                   hasminlevelindays,
                                   minlevelindays,
                                   minlevelinquantity,
                                   hasmaxlevel,
                                   hasmaxlevelindays,
                                   maxlevelindays,
                                   maxlevelinquantity,
                                   iscalculated,
                                   isfromdb );
    
    return inventoryspecification;
  *]
}