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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  Method CreateLaneLegs ( 
 |    StockingPointInLane newspil, 
 |    Boolean asorigin 
 |  ) 
 |  { 
 |    Description: 'Generate lane legs from new stocking point' 
 |    TextBody: 
 |    [* 
 |      // ju jinn Apr-11-2014 (created) 
 |       
 |      // if sp added to origin, select the entire destination set except the spil 
 |      spils := ifexpr( asorigin, 
 |                       selectset( this, Destination, destination, destination <> newspil ), 
 |                       selectset( this, Origin, origin, origin <> newspil ) ); 
 |       
 |       
 |       
 |      traverse( spils, Elements, compspil ) 
 |      { 
 |        originspil := ifexpr( asorigin, newspil, compspil ); 
 |        destinationspil := ifexpr( asorigin, compspil, newspil ); 
 |         
 |        LaneLeg::Create( this, 
 |                         originspil, 
 |                         destinationspil, 
 |                         this.IsEnabled(), 
 |                         this.Start(), 
 |                         this.End(), 
 |                         false, 
 |                         this.LeadTime(), 
 |                         false, 
 |                         this.StandardDeviationLeadTime(), 
 |                         this.CO2Emission() ); 
 |       //to sync back the missing product in stocking point, for the case that origin or destination is deleted from lane causing pisp deleted 
 |       products := selectset( this, ProductInLane.Product_MP, product , true ); 
 |       compspil.StockingPoint_MP().AddProducts( products ); 
 |                          
 |                          
 |      } 
 |    *] 
 |  } 
 |  
  |