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
| Quintiq file version 2.0
| #parent: #root
| StaticMethod Create (
| String id,
| Unit owner,
| String name,
| RoutingStep routingstep,
| Duration leadtime,
| Duration standarddeviationleadtime,
| Real throughput,
| Boolean hasuserlotsize,
| Real userminimumquantity,
| Boolean hasusermaximumquantity,
| Real usermaximumquantity,
| Real userlotsize,
| Real co2Emission,
| Boolean createdefaultcost,
| Boolean isfromdb
| ) as Operation
| {
| Description: 'Create operation'
| TextBody:
| [*
| operation := owner.Operation( relnew,
| Operation,
| RoutingStep := routingstep, //Set the routing step so that this relation can be used in the same transaction without propagation
| AsProcess_MP := owner, ID := id );
|
| // Update attributes
| operation.Update( owner,
| id,
| name,
| routingstep,
| leadtime,
| standarddeviationleadtime,
| throughput,
| hasuserlotsize,
| userminimumquantity,
| hasusermaximumquantity,
| usermaximumquantity,
| userlotsize,
| co2Emission,
| isfromdb );
|
| // Create cost
| if( createdefaultcost )
| {
| idholder := owner.MacroPlan().IDHolder();
|
| traverse( owner, UnitAccount, ua, AccountAssignment::IsForProcess( ua.CostDriver() ) )
| {
| account := ua.Account_MP();
|
| OperationCost::Create( idholder.GetOperationCostID(),
| operation,
| account,
| ua.CostDriver(),
| owner.MacroPlan().Start().Date(),
| account.DefaultTimeUnit(),
| account.DefaultLengthOfTime(),
| account.DefaultCost(),
| isfromdb );
|
| }
| }
|
| return operation;
| *]
| }
|
|