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
70
71
72
73
74
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method DataMockupGenerateLanelegs ( 
 |    Unit unit, 
 |    Number nroflanelegs, 
 |    Number nrofproductsperlane 
 |  ) 
 |  { 
 |    TextBody: 
 |    [* 
 |      macroplan := this.MacroPlan(); 
 |       
 |      // Create lanes 
 |      lane := Lane::Create( 'Lane', 
 |                            unit, 
 |                            'Lane', 
 |                            true, 
 |                            Date::MinDate(), 
 |                            Date::MaxDate(), 
 |                            Duration::MinDuration(), 
 |                            Duration::MinDuration(), 
 |                            false 
 |                          ); 
 |       
 |      // Create ProductInLane for the number of passed in nrofproductsperlane 
 |      for( i := 0; i < nrofproductsperlane; i++ ) 
 |      { 
 |        // Find existing Product_MP 
 |        product := Product_MP::FindProductTypeIndex( 'Product_' + [String] i ); 
 |        // Create ProductInLane 
 |        ProductInLane::Create( product, 
 |                               lane, 
 |                               false, 
 |                               false 
 |                             ); 
 |      }   
 |       
 |      // Create LaneLeg for the number of passed in nroflanelegs 
 |      for( i := 0; i < nroflanelegs; i++ ) 
 |      { 
 |        // Randomly select one origin StockingPoint_MP's ID 
 |        originspid := minselect( macroplan, StockingPoint_MP, sp, true, Real::Random() ).ID(); 
 |        // Randomly select one destination StockingPoint_MP's ID, given that: 
 |        // destination <> origin 
 |        // and there's no existing laneleg in this lane that has the same origin and destination 
 |        destinationspid := minselect( macroplan, StockingPoint_MP, sp,  
 |                                      sp.ID() <> originspid 
 |                                      and not exists( lane, LaneLeg, ll,  
 |                                                      ll.OriginStockingPointID() = originspid 
 |                                                      and ll.DestinationStockingPointID() = sp.ID() ),  
 |                                      Real::Random() ).ID(); 
 |        // Create laneleg 
 |        LaneLeg::Create( lane, 
 |                         originspid, 
 |                         destinationspid, 
 |                         false, 
 |                         Date::MinDate(), 
 |                         Date::MaxDate(), 
 |                         lane.ID() + ' - ' + originspid + ' to ' + destinationspid, 
 |                         true, 
 |                         Duration::Days( 1 ), 
 |                         false, 
 |                         Duration::MinDuration(), 
 |                         0.0, 
 |                         0.0, // CO2 emission for generated lanelegs 
 |                         false 
 |                       ); 
 |                          
 |      } 
 |       
 |      // Set StockingPointInLane after creating Lane & LaneLeg 
 |      macroplan.InitializeLaneAfterImport(); 
 |    *] 
 |  } 
 |  
  |