Quintiq file version 2.0
|
#parent: #root
|
Method GetIsBlendedValueLessThanMaximum (
|
output Strings feedback_o,
|
output Strings sanitycheckfeedbacks_o
|
) declarative remote as Boolean
|
{
|
Description: 'Returns true if the input blended value is within the maximum value as stated in the recipe used.'
|
TextBody:
|
[*
|
// Adhi Aug-4-2015 (created)
|
checkvalid := true;
|
gp := this.MacroPlan().GlobalParameters_MP();
|
|
// Get the recipe from operationoutput
|
outputrecipe := select( this, NewSupply.ProductInStockingPointInPeriodPlanningLeaf.RecipeWithEffectiveDate.Recipe, recipe, true );
|
|
// Do check for every ingredient in the recipe
|
traverse( outputrecipe, BaseRecipeIngredient, recipeingredient )
|
{
|
blendedvalue := this.GetBlendedValue( recipeingredient );
|
|
isvalid := blendedvalue <= recipeingredient.Maximum()
|
or gp.GetIsBalanceWithinTolerance( blendedvalue, recipeingredient.Maximum() );
|
|
// If one failed, consider invalid. Do not put isvalid in the traverse above because we want to gather all messages.
|
checkvalid := checkvalid and isvalid;
|
|
if( not isnull( feedback_o ) and not isvalid )
|
{
|
instance := PeriodTaskOperation::GetInstanceText( this );
|
percentage := GlobalParameters_MP::GetPercentageDifference( blendedvalue, recipeingredient.Maximum() );
|
message := Translations::MP_PeriodTaskOperation_ViolateIsBlendedValueLessThanMaximum( blendedvalue, recipeingredient, percentage );
|
feedback_o.Add( SanityCheckMessage::GetFormattedMessage( instance, message ) );
|
sanitycheckfeedbacks_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningIssue() );
|
}
|
}
|
|
return checkvalid;
|
*]
|
}
|