Quintiq file version 2.0
#parent: #root
StaticMethod GetProcessQuantity (
Period_MP period,
Lane lane,
ProductInStockingPoint_MPs pisps,
ProductInStockingPoint_MP targetpisp,
Boolean isdependentdemand,
Boolean isupstream,
output String tooltip
) declarative remote as Real
{
Description: 'Return quantities of a lane to pisps in a period or pisp to a lane in a period'
TextBody:
[*
value := 0.0;
// Insert table tag for tooltip
// Lane name
tooltip := "
";
tooltip := tooltip + 'Lane: | '
+ lane.Name() + ' |
';
// Unit name
tooltip := tooltip + 'Unit: | '
+ lane.Unit().Name() + ' |
';
// Period
tooltip := tooltip + 'Period: | '
+ period.StartDate().Format( 'D-MM-Y' ) + ' until ' + period.EndDate().Format( 'D-MM-Y' ) + ' |
';
// A separating line
tooltip := tooltip + '
';
// Lanelegs and products headers
tooltip := tooltip + 'Lane leg: | '
+ select( pisps, Elements, e, true ).Product_MP().Name() + ' quantity: |
';
if( isdependentdemand )
{
if( not isupstream )
{
traverse( lane, LaneLeg.Trip.PeriodTaskLaneLeg.DependentDemand, dd,
exists( pisps, Elements, e, e = dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP() )
and dd.Start() >= period.Start()
and dd.End() <= period.End() )
{
value := value + dd.Quantity();
tooltip := tooltip + '' + dd.PeriodTask_MP().Process_MP().Name() + ' | '
+ dd.Quantity().AsQUILL() + ' |
';
}
}
else
{
lanelegs := selectset( lane, LaneLeg, ll,
ll.AsDestinationStockingPointLeg().StockingPoint_MP() = targetpisp.StockingPoint_MP() );
traverse( lanelegs, Elements.Trip.PeriodTaskLaneLeg.DependentDemand, dd,
exists( pisps, Elements, e, e = dd.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP() )
and dd.Start() >= period.Start()
and dd.End() <= period.End() )
{
value := value + dd.Quantity();
tooltip := tooltip + '' + dd.PeriodTask_MP().Process_MP().Name() + ' | '
+ dd.Quantity().AsQUILL() + ' |
';
}
}
}
else
{
if( isupstream )
{
traverse( lane, LaneLeg.Trip.PeriodTaskLaneLeg.NewSupply, ns,
exists( pisps, Elements, e, e = ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP() )
and ns.Start() >= period.Start()
and ns.End() <= period.End() )
{
value := value + ns.Quantity();
tooltip := tooltip + '' + ns.PeriodTask_MP().Process_MP().Name() + ' | '
+ ns.Quantity().AsQUILL() + ' |
';
}
}
else
{
lanelegs := selectset( lane, LaneLeg, ll,
ll.AsOriginStockingPointLeg().StockingPoint_MP() = targetpisp.StockingPoint_MP() );
traverse( lanelegs, Elements.Trip.PeriodTaskLaneLeg.NewSupply, ns,
exists( pisps, Elements, e, e = ns.ProductInStockingPointInPeriodPlanningLeaf().ProductInStockingPoint_MP() )
and ns.Start() >= period.Start()
and ns.End() <= period.End() )
{
value := value + ns.Quantity();
tooltip := tooltip + '' + ns.PeriodTask_MP().Process_MP().Name() + ' | '
+ ns.Quantity().AsQUILL() + ' |
';
}
}
}
tooltip := tooltip + '
';
return value;
*]
}