yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
Function CalcPISPNodeInRoutingDisplayIndex
{
  TextBody:
  [*
    // Get the sorted set of input PISPNodeInRoutings
    input := selectsortedset( this,
                              PISPNodeInRouting,
                              node,
                              not isnull( node.OperationInputForRCV() ),
                              node.OperationInputForRCV().Operation().RoutingStep().SequenceNumber(),
                              node.OperationInputForRCV().Operation().UnitDisplayIndex(),
                              guard( node.OperationInputForRCV().OperationInputGroup().Index(), 9999 ),
                              node.OperationInputForRCV().ProductDisplayIndex() );
    
    // Get the sorted set of output PISPNodeInRoutings
    output := selectsortedset( this,
                               PISPNodeInRouting,
                               node,
                               not isnull( node.OperationOutputForRCV() ),
                               node.OperationOutputForRCV().Operation().RoutingStep().SequenceNumber(),
                               node.OperationOutputForRCV().Operation().UnitDisplayIndex(),
                               node.OperationOutputForRCV().ProductDisplayIndex() );
    
    // Initialize index
    idx := 0;
    // Set display index of all input PISPNodeInRoutings
    traverse( input, Elements, e )
    {
      e.DisplayIndex( idx );
      idx ++;
    }
    
    // Set display index of all output PISPNodeInRoutings
    traverse( output, Elements, e )
    {
      e.DisplayIndex( idx );
      idx ++;
    }
  *]
}