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
| Quintiq file version 2.0
| #parent: #root
| Method LinkPISP (
| ProductInStockingPoint_MP pisp,
| Boolean isinput,
| Number groupid,
| output BaseOperationLinks trash
| ) as OperationBOM
| {
| Description: 'Create OperationInputOutputProduct for the given product and operation.'
| TextBody:
| [*
| operation := this;
|
| // Get existing OperationBOM
| pisplink := operation.GetOperationBOM( pisp.ProductID(), pisp.StockingPointID(), isinput );
|
| // Check if there's existing OperationBOM, if there's none, create one
| if( isnull( pisplink ) )
| {
| // Get default operation input & output quantity
| defaultqty := operation.MacroPlan().GlobalParameters_MP().DefaultOperationInputOutputQuantity();
|
| // Create OperationBOM
| pisplink := OperationBOM::Create( operation,
| pisp,
| isinput,
| groupid,
| false,
| defaultqty,
| defaultqty,
| defaultqty,
| false, // isexcluded
| false
| );
|
| // Check if ProductInStockingPoint_MP has relation with StockingPoint_MP
| if( not isnull( pisp.StockingPoint_MP() ) )
| {
| // Get existing StockingPointUnit
| spunit := StockingPointUnit::FindStockingPointUnitTypeIndex( pisp.StockingPointID(), this.UnitID(), isinput );
|
| // Check if there's existing StockingPointUnit, if there's none, create one
| if( isnull( spunit ) )
| {
| spunit := this.Unit().LinkToStockingPoint( pisp.StockingPoint_MP(), isinput );
| }
| }
| }
|
| return pisplink;
| *]
| }
|
|