Quintiq file version 2.0
|
#parent: #root
|
Method ReturnEdgeLabel (
|
shadow[SCVNode] sourcenode,
|
shadow[SCVNode] targetnode,
|
output Real quantity_o
|
) as String id:Method_FormSupplyChainVisualization_ReturnEdgeLabel
|
{
|
#keys: '[134266.1.1639225912]'
|
Body:
|
[*
|
// Return edge label of this edge
|
label := '';
|
tooltip := '';
|
scvConfig := DataHolderSCVConfiguration.Data();
|
period := scvConfig.Period_MP();
|
pisps := construct( ProductInStockingPoint_MPs );
|
operations := construct( Operations );
|
lane := null( Lane );
|
targetPISPIP := null( ProductInStockingPoint_MP );
|
|
// RoutingStep node to other nodes
|
if( sourcenode.istype( shadow[SCVRoutingStepNode] ) )
|
{
|
sourceNode := sourcenode.astype( shadow[SCVRoutingStepNode] );
|
operations := selectset( sourceNode, OperationInNode.Operation, op, true );
|
|
if( targetnode.istype( shadow[SCVPISPIPNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVPISPIPNode] );
|
pisps := pisps.Merge( targetNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP() )
|
}
|
else if( targetnode.istype( shadow[SCVRoutingStepNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVRoutingStepNode] );
|
pisps := selectset( targetNode, OperationInNode.Operation.OperationInput.ProductInStockingPoint_MP, pisp, true )
|
}
|
|
quantity_o := SCVEdge::GetProcessQuantity( period, operations, pisps, false /*isdependentdemand*/, tooltip );
|
}
|
|
// PISPIP node to other nodes
|
else if( sourcenode.istype( shadow[SCVPISPIPNode] ) )
|
{
|
sourceNode := sourcenode.astype( shadow[SCVPISPIPNode] );
|
pisps := pisps.Merge( sourceNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP() )
|
|
if( targetnode.istype( shadow[SCVRoutingStepNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVRoutingStepNode] );
|
operations := selectset( targetNode, OperationInNode.Operation, op, true );
|
|
quantity_o := SCVEdge::GetProcessQuantity( period, operations, pisps, true /*isdependentdemand*/, tooltip );
|
}
|
else if( targetnode.istype( shadow[SCVLaneNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVLaneNode] );
|
lane := targetNode.Lane();
|
isupstream := targetNode.IsUpstream();
|
|
if( isupstream )
|
{
|
targetPISPIPNode := select( scvConfig, SCVNode, node, node.Key().AsQUILL() = targetNode.OwnerNodeKey() ).astype( shadow[SCVPISPIPNode] );
|
targetPISPIP := targetPISPIPNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP();
|
}
|
|
quantity_o := SCVEdge::GetProcessQuantity( period, lane, pisps, targetPISPIP, true /*isdependentdemand*/, isupstream, tooltip );
|
}
|
else if( targetnode.istype( shadow[SCVSDNode] ) )
|
{
|
quantity_o := SCVEdge::GetProcessQuantity( sourceNode.ProductInStockingPointInPeriod(), tooltip );
|
}
|
}
|
|
// Lane node to PISPIP node
|
else if( sourcenode.istype( shadow[SCVLaneNode] ) )
|
{
|
sourceNode := sourcenode.astype( shadow[SCVLaneNode] );
|
lane := sourceNode.Lane();
|
|
if( targetnode.istype( shadow[SCVPISPIPNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVPISPIPNode] );
|
isupstream := sourceNode.IsUpstream();
|
|
if( not isupstream )
|
{
|
targetPISPIPNode := select( scvConfig, SCVNode, node, node.Key().AsQUILL() = sourceNode.OwnerNodeKey() ).astype( shadow[SCVPISPIPNode] );
|
targetPISPIP := targetPISPIPNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP();
|
}
|
pisps := pisps.Merge( targetNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP() )
|
}
|
|
quantity_o := SCVEdge::GetProcessQuantity( period, lane, pisps, targetPISPIP, false /*isdependentdemand*/, sourceNode.IsUpstream(), tooltip );
|
}
|
|
// Inventory supply node to PISPIP node
|
else if( sourcenode.istype( shadow[SCVISNode] ) )
|
{
|
if( targetnode.istype( shadow[SCVPISPIPNode] ) )
|
{
|
targetNode := targetnode.astype( shadow[SCVPISPIPNode] );
|
pisps := pisps.Merge( targetNode.ProductInStockingPointInPeriod().ProductInStockingPoint_MP() )
|
|
quantity_o := SCVEdge::GetInventorySupplyQuantity( targetNode.ProductInStockingPointInPeriod(), tooltip );
|
}
|
}
|
|
uom := select( pisps, Elements.UnitOfMeasure_MP, e, true );
|
|
label := quantity_o.Format( 'N(Dec(2))' )
|
+ ' '
|
+ uom.Name();
|
|
if( not sourcenode.istype( shadow[SCVPISPIPNode] ) )
|
{
|
sourcenode.Tooltip( tooltip );
|
}
|
else
|
{
|
targetnode.Tooltip( tooltip );
|
}
|
|
return label;
|
*]
|
Declarative: true
|
}
|