Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
Quintiq file version 2.0
#parent: #root
StaticMethod CreateFromMapping (
  const GlobalOTDTable globalOTDTable,
  MacroPlan macroPlan
)
{
  TextBody:
  [*
    // Administrator Oct-31-2023 (created)
    updates := construct( LaneLegs );
    traverse( globalOTDTable, Global_MappingLaneLeg, gll, true )
    {
      processingtime := Duration::Zero();
      hasprocessingtime := true;
      userleadtime := gll.UserLeadTime();
      if( userleadtime.Length() = 0 )
      {
        hasprocessingtime := false;
        processingtime := Duration::Zero(); 
        }
      else
      {
        hasprocessingtime := true;
        processingtime := Duration::Hours( [Number]userleadtime );
        };
      
      lane := Lane::FindById( macroPlan, gll.LaneID() );
      a := LaneLeg::CreateLaneleg( macroPlan, lane, gll.LaneID(), gll.OriginStockingPointID(), gll.DestinationStockingPointID(), gll.Name(), hasprocessingtime, processingtime);
      updates.Add( a );
      }
    origindataset := selectset( macroPlan, Unit.Lane.LaneLeg, ll, true );
    obsoletes := origindataset.Difference( updates );
    // delete obsoleted
    difflength := obsoletes.Size();
    for( j:=0; j<difflength; j++ )
    {
      obsolete := obsoletes.Element( j );
      obsolete.Delete();
      }
  *]
}