Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod ValidateInput ( 
 | 
  output String feedback_o, 
 | 
  output String sanitycheckfeedback_o, 
 | 
  MacroPlan macroplan, 
 | 
  Product_MP product, 
 | 
  StockingPoint_MP stockingpoint, 
 | 
  Real inventoryquantity, 
 | 
  Date date, 
 | 
  Date manufactureddate 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Check for input obtained from UI and methods' 
 | 
  TextBody: 
 | 
  [* 
 | 
    feedback_o := ''; 
 | 
    sanitycheckfeedback_o := ''; 
 | 
     
 | 
    // Populate variable 
 | 
    gp := macroplan.GlobalParameters_MP(); 
 | 
    min_mfgdate := InventorySupply::GetMinimumManufacturedDate( product, macroplan, date ); 
 | 
    pispspec := select(  product,  
 | 
                         PISPSpecification, spec,  
 | 
                         spec.StockingPoint_MP() = stockingpoint ); 
 | 
     
 | 
    hasshelflife := product.HasShelfLife() 
 | 
                    and guard( not pispspec.IsExcludeShelfLifeAndMaturation(), true ); 
 | 
                     
 | 
    hasshelflifeormaturation := product.HasShelfLifeOrMaturation() 
 | 
                    and guard( not pispspec.IsExcludeShelfLifeAndMaturation(), true );      
 | 
                       
 | 
    // Check if product is null 
 | 
    if( isnull( product ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsNullProduct(); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    // Check if stocking point is null 
 | 
    else if( isnull( stockingpoint ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsNullStockingPoint(); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    // Check if date is valid 
 | 
    else if( not ( date >= stockingpoint.Start() 
 | 
                   and date <= stockingpoint.End() ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsInvalidDate( date, 
 | 
                                                                                  stockingpoint.Start(), 
 | 
                                                                                  stockingpoint.End() ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    // Check if the entered manufactured date will result in product expiry in pispip 
 | 
    else if( hasshelflife 
 | 
             and manufactureddate < min_mfgdate ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsExpiredManufacturedDate( min_mfgdate ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); 
 | 
    } 
 | 
    // Check if product has shelf-life or maturation, and is manufactured in the future 
 | 
    else if( hasshelflifeormaturation 
 | 
             and manufactureddate > date ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsFutureManufacturedDate( manufactureddate, date ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    // Check if inventory quantity is entered 
 | 
    else if( inventoryquantity = Real::MinReal() ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_IsEmpty(); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    // Check if inventory quantity is valid 
 | 
    else if( inventoryquantity <> 0 
 | 
             and not GlobalParameters_MP::GetIsValueWithinRange( inventoryquantity, 
 | 
                                                                 gp.AbsoluteUpperLimit(), 
 | 
                                                                 gp.AbsoluteLowerLimit() ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_InventorySupply_ValidateInput_InvalidQuantity( inventoryquantity, gp.AbsoluteLowerLimit(), gp.AbsoluteUpperLimit() ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
     
 | 
    // Add feedback text if any of the precondition above is violated 
 | 
    if( feedback_o <> '' ) 
 | 
    { 
 | 
      instance := InventorySupply::GetInstanceText( product, stockingpoint, date ); 
 | 
      feedback_o := SanityCheckMessage::GetFormattedMessage( instance, feedback_o ); 
 | 
    } 
 | 
     
 | 
    return feedback_o = ''; 
 | 
  *] 
 | 
} 
 |