Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CreateProductInStockingPointInPeriodMessage ( 
 | 
  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( SanityCheckGroupShelfLife ).InvalidProductInStockingPointInPeriod, 
 | 
                                       invalidobject, 
 | 
                                       true, 
 | 
                                       invalidobject.SanityCheckDataMostSevere() ); 
 | 
     
 | 
    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 ) 
 | 
    { 
 | 
      feedbacks := construct( Strings ); 
 | 
      sanitycheckfeedback := construct( Strings ); 
 | 
       
 | 
      objcount := objcount + 1; 
 | 
      // Get invalid PISPIPPlanning 
 | 
      invalidpispip := invalidobject.ProductInStockingPointInPeriodPlanning(); 
 | 
      // Get sanity check violation messages and categories 
 | 
      invalidpispip.DoSanityCheckGroupShelfLife( feedbacks, sanitycheckfeedback );  
 | 
       
 | 
      i := 0; 
 | 
      // Traverse each sanity check violation feedbacks 
 | 
      traverse( feedbacks, Elements, fb ) 
 | 
      { 
 | 
        //tokenize msg to retrieve category level and seperate the actual feedback 
 | 
       sanitycheckmessage := SanityCheckMessageShelfLife::Create( invalidpispip.PISPIPSanityCheckAttribute().SanityCheckGroupShelfLife(), 
 | 
                                                                  fb, 
 | 
                                                                  true, 
 | 
                                                                  sanitycheckfeedback.Element( i ) 
 | 
                                                                 ); 
 | 
     
 | 
       sanitycheckmessage.PISPIPSanityCheckAttribute( relset, invalidpispip.PISPIPSanityCheckAttribute() ); 
 | 
        i := i + 1; 
 | 
      } 
 | 
       
 | 
    } 
 | 
  *] 
 | 
} 
 |