Quintiq file version 2.0
#parent: #root
Method CreateSCVPISPIPNode (
  output owning shadow[SCVConfiguration] owner,
  ProductInStockingPointInPeriod pispip,
  Boolean isroot
) as shadow[SCVNode] id:Method_FormSupplyChainVisualization_CreateSCVPISPIPNode
{
  #keys: '[132894.0.863094116]'
  Body:
  [*
    // Create SCV Node
    scvnode := owner.SCVNode( relnew,
                              SCVPISPIPNode,
                              ProductInStockingPointInPeriod := pispip,
                              Name := pispip.ProductInStockingPoint_MP().Name(),
                              IsRoot := isroot,
                              X := 0,  
                              Y := 0 );
    
    // If it is root, we will generate inventory supply and sales demands nodes
    if( isroot )
    {
      if( pispip.InventorySupplyQuantity() > 0 )
      {
        this.CreateSCVISNode( &owner, scvnode, pispip, true /*isupstream*/ );
      }
      if( pispip.SalesDemandInPeriodBase( relsize ) > 0 )
      {
        this.CreateSCVSDNode( &owner, scvnode, pispip, false /*isdownstream*/ );
      }
    }
    
    return scvnode;
  *]
}
