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
Quintiq file version 2.0
#parent: #root
Method FindCreateProcessNodeAndEdge (
  output owning shadow[SCVConfiguration] scvConfig,
  shadow[SCVNode] ownernode,
  Process_MP process,
  Boolean isupstream,
  output Number depth
) as shadow[SCVNode] id:Method_FormSupplyChainVisualization_FindCreateProcessNodeAndEdge
{
  #keys: '[134266.1.1593330686]'
  Body:
  [*
    // Generate upstream routing steps or lanes node
    scvNode := null( shadow[SCVNode] );
    
    if( process.istype( Operation ) )
    {       
      scvNode := this.CreateSCVRoutingStepNode( &scvConfig, ownernode, process.astype( Operation ), isupstream );
    }
    else if( process.istype( LaneLeg ) )
    {
      scvNode := this.CreateSCVLaneNode( &scvConfig, ownernode, process.astype( LaneLeg ), isupstream ); 
    }
    
    depth := ifexpr( isupstream, scvConfig.UpstreamDepthLimit(), scvConfig.DownstreamDepthLimit() ) - scvNode.Depth();
    
    value := max( scvConfig, SCVNode, e, 
                  e.Depth() = scvNode.Depth() 
                  and e.IsUpstream() = scvNode.IsUpstream(), 
                  e.SortSequence() );
                  
    scvNode.SortSequence( value + 1 ); 
    
    return scvNode;
  *]
}