陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method GenerateTree () id:Method_FormSupplyChainVisualization_GenerateTree
{
  #keys: '[132894.0.847789972]'
  Body:
  [*
    // Create SCVNodes from selected PISPIP in Product Planning Matrix
    // This is the entry point of nodes generation and drawing
    
    // First insert SCVConfiguration into the dataholder
    // the MacroPlan will never be null because there is a precon
    // to this method
    if( DataHolderDisplayPISPIP.Data().Size() > 0 )
    {
      DataHolderSCVConfiguration.Data( shadow( MacroPlan.SCVConfiguration() ) );
      scvConfig := DataHolderSCVConfiguration.Data();
    
      scvConfig.Period_MP( relset, DataHolderDisplayPISPIP.Data().Element( 0 ).Period_MP() )
      pispip := DataHolderDisplayPISPIP.Data().Element( 0 );
      
      // rootNode represents the current pispip we are selecting
      rootNode := this.CreateSCVPISPIPNode( scvConfig, pispip, true /*isroot*/ );
      
      // Start generating upstream and downstream nodes
      rootNode.IsDepthLimitMet( false );
      this.GenerateNodes( scvConfig, pispip, rootNode, scvConfig.UpstreamDepthLimit(), true /*isupstream*/ );
      rootNode.IsDepthLimitMet( false );
      this.GenerateNodes( scvConfig, pispip, rootNode, scvConfig.DownstreamDepthLimit(), false /*isupstream*/ );
      
      // Determine the X position of the root node
      rootNode.X( scvConfig.BorderOffsetX() + scvConfig.UpstreamDepth() * scvConfig.OffsetX() );
      this.PopulateXPosition( rootNode );
      this.PopulateDisplaySequence( true /*isupstream*/, rootNode );
      scvConfig.DisplaySequence( 0 );
      this.PopulateDisplaySequence( false /*isupstream*/, rootNode );
      this.PopulateYPosition( true /*isupstream*/ );
      this.PopulateYPosition( false /*isupstream*/ );
      this.AdjustTrees();
      
      scvConfig.Width( max( scvConfig, SCVNode, node, node.X() ) + scvConfig.BorderOffsetX() );
      scvConfig.Height( max( scvConfig, SCVNode, node, node.Y() ) + scvConfig.BorderOffsetY() );
      
      CustomDrawComponentSupplyChainVisualization.EnsureVisible( rootNode.X(), rootNode.Y(), 'center', 'center' );
    }
    else
    {
      DataHolderSCVConfiguration.ClearData();
    }
  *]
}