Quintiq file version 2.0
|
#parent: #root
|
StaticMethod CreatePISPIPMessage (
|
MacroPlan macroplan
|
)
|
{
|
Description: 'Create sanity check message for product in stocking point in period'
|
TextBody:
|
[*
|
// Get the limit for number of sanity check messages
|
messagelimit := macroplan.GlobalParameters_MP().SanityCheckLimit();
|
|
// Get PISPIPs that has sanity check violation(s)
|
invalidobjects := selectsortedset( macroplan,
|
SanityCheckGroup.astype( SanityCheckGroupMaxInventoryLevel ).InvalidProductInStockingPointInPeriod,
|
invalidobject,
|
true,
|
invalidobject.SanityCheckMaxInventoryLevelMostSevere() );
|
|
objcount := 0;
|
// Traverse the set of PISPIPs and create sanity check message
|
// as long as the number of PISPIPs processed doesn't exceed the limit of number of messages
|
traverse( invalidobjects,
|
Elements,
|
invalidobject,
|
objcount <= messagelimit )
|
{
|
objcount := objcount + 1;
|
feedbacks := construct( Strings );
|
sanitycheckfeedbacks := construct( Strings );
|
// Get invalid PISPIPPlanning
|
invalidpispip := invalidobject.ProductInStockingPointInPeriodPlanning();
|
// Get sanity check violation messages and categories
|
invalidpispip.DoSanityCheckGroupMaxInventoryLevel( feedbacks, sanitycheckfeedbacks );
|
|
i := 0;
|
// Traverse each sanity check violation feedbacks
|
traverse( feedbacks, Elements, fb )
|
{
|
// Check if there're any SanityCheckMessageMaxInventoryLevel with the same description, if there's none, create one
|
if( not exists( invalidpispip.PISPIPSanityCheckAttribute(), SanityCheckMessageMaxInventoryLevel, msg, msg.Description() = fb ) )
|
{
|
//tokenize msg to retrieve category level and seperate the actual feedback
|
sanitycheckmessage := SanityCheckMessageMaxInventoryLevel::Create( invalidpispip.PISPIPSanityCheckAttribute().SanityCheckGroupMaxInventoryLevel(),
|
fb,
|
true,
|
sanitycheckfeedbacks.Element( i ) );
|
sanitycheckmessage.PISPIPSanityCheckAttribute( relset, invalidpispip.PISPIPSanityCheckAttribute() );
|
}
|
i := i + 1;
|
}
|
}
|
*]
|
}
|