Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CanCreate (
|
Trip trip,
|
ProductInStockingPointInPeriods pispips,
|
output String feedback_o
|
) const declarative remote as Boolean
|
{
|
Description: 'Given Trip and PISPIP, check if able to create product in trip.'
|
TextBody:
|
[*
|
cancreate := true;
|
|
traverse( pispips, Elements, pispip, cancreate )
|
{
|
cancreate := trip.HasValidArrival() // has valid arrival
|
and trip.ArrivalUnitPeriod().Period_MP() = pispip.Period_MP() // within the same period
|
and exists( trip, LaneLeg.LaneLegOutput.ProductInStockingPoint_MP, pisp,
|
pisp = pispip.ProductInStockingPoint_MP() ); // check if leg transport the product
|
|
if( not cancreate )
|
{
|
originspname := MacroPlan::GetSubstituteName( trip.LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().Name() );
|
destspname := MacroPlan::GetSubstituteName( trip.LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().Name() );
|
unitname := MacroPlan::GetSubstituteName( trip.LaneLeg().Lane().Unit().Name() );
|
productname := MacroPlan::GetSubstituteName( pispip.ProductInStockingPoint_MP().Product_MP().Name() );
|
feedback_o := Translations::MP_ProductInTrip_CanCreate_IsInvalidPISPIP( originspname,
|
destspname,
|
trip.ArrivalUnitPeriod().StartDate(),
|
unitname,
|
productname );
|
}
|
}
|
|
return cancreate;
|
*]
|
}
|