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
| Method Copy (
| Unit owner
| ) as Lane
| {
| Description: 'Makes a duplicate of lane and its legs with a different owner'
| TextBody:
| [*
| // ju jinn May-8-2014 (created)
|
| idholder := owner.MacroPlan().IDHolder();
|
| uniquename := owner.GetUniqueLaneName( this.Name() + GlobalParameters_MP::GetCopyString() );
| id := Process_MP::GetConcatenatedID( owner, uniquename );
|
| // duplicate lane
| newlane := Lane::Create( id,
| owner,
| uniquename,
| this.IsEnabled(),
| this.Start(),
| this.End(),
| this.UserLeadTime(),
| this.StandardDeviationLeadTime(),
| false );
|
| originspinlanes := selectset( this, Origin, origin, true );
| destspinlanes := selectset( this, Destination, dest, true );
| spinlanes := originspinlanes.Union( destspinlanes );
|
| traverse( spinlanes, Elements, e )
| {
| e.Copy( newlane );
| }
|
| traverse( this, LaneLeg, leg )
| {
| leg.Copy( newlane );
| }
|
| // duplicate products in lane
| products := selectset( this, ProductInLane.Product_MP, product, true )
| newlane.AddProducts( products );
|
| // duplicate costs
| traverse( this, LaneCost, cost )
| {
| accountassignment := select( owner, UnitAccount, ua,
| ua.Account_MP() = cost.AccountAssignment().Account_MP()
| and ua.CostDriver() = cost.AccountAssignment().CostDriver() );
|
| if( not isnull( accountassignment ) )
| {
| LaneCost::Create( idholder.GetLaneCostID(),
| newlane,
| accountassignment.Account_MP(),
| accountassignment.CostDriver(),
| cost.Start(),
| cost.TimeUnit(),
| cost.LengthOfTime(),
| cost.Cost(),
| false );
| }
| }
|
| return newlane;
| *]
| }
|
|