Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CanPostpone (
|
BaseSalesDemandInPeriods salesdemands,
|
Period_MPs postponementperiods,
|
output String feedback_o
|
) remote as Boolean
|
{
|
Description: 'Check whether sales demand can be postponed'
|
TextBody:
|
[*
|
// Check if there are any sales demand
|
if( salesdemands.Size() = 0 )
|
{
|
feedback_o := Translations::MP_SalesDemand_CanPostpone_SalesDemandEmpty();
|
}
|
// Check if there are any postponed sales demand
|
else if( exists( salesdemands, Elements, e, e.IsPostponed() ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_CanPostpone_PostponedSDIPCannotBePostponed();
|
}
|
// Check if there are disaggregated sales demand, disabled manual postpone of DisaggregatedSalesDemandInPeriod
|
else if ( exists( salesdemands, Elements.astype( DisaggregatedSalesDemandInPeriod ), dsdip , true ) )
|
{
|
feedback_o := Translations::MP_DisaggregatedSalesDemandInPeriod_CannotPostponedManually();
|
}
|
// Check if there are any sales demand without quantity
|
else if( exists( salesdemands, Elements, e, e.Quantity() = 0 ) )
|
{
|
feedback_o := Translations::MP_SalesDemandInPeriod_CanPostpone_QuantityZero();
|
}
|
// Check if all sales demand can be postponed
|
else if( forall( salesdemands, Elements, e, not e.CanBePostponed() ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_CanPostpone_SalesDemandCannotPostpone();
|
}
|
// Check if there are any periods to postpone
|
else if( postponementperiods.Size() = 0 )
|
{
|
feedback_o := Translations::MP_SalesDemandInPeriod_CanPostpone_NoAllowedPeriod();
|
}
|
// Check if there are any period that will be postponed till out of the planning horizon
|
else if( exists( salesdemands, Elements, e, e.AsPlanningBaseSalesDemandInPeriod().Period_MP() = e.MacroPlan().LastPlanningPeriod() ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_CanPostpone_LastPeriod();
|
}
|
else if ( exists( salesdemands, Elements.AsPlanningSalesDemandInPeriod.astype( CustomerOrder ), co, true, co.IsFirmed() ) )
|
{
|
feedback_o := Translations::MP_CustomerOrder_CanPostpone_IsFirmed();
|
}
|
|
return feedback_o = '';
|
*]
|
}
|