Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetHasValidCapacityRange ( 
 | 
  output Strings feedback_o, 
 | 
  output Strings sanitycheckfb 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Checks if the difference factor of the max and min capacity is within specified limits.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // MKO2 May-5-2016 (created) 
 | 
    isvalid := true; 
 | 
    factorlimit := this.MacroPlan().GlobalParameters_MP().DifferenceFactor1e6(); 
 | 
     
 | 
    if( this.MaxCapacity().IsFinite() and this.MinCapacity().IsFinite() ) 
 | 
    { 
 | 
      differencefactor := guard( this.MaxCapacity() / this.MinCapacity(), this.MaxCapacity() ); 
 | 
      isvalid := differencefactor < factorlimit; 
 | 
    } 
 | 
     
 | 
    if( not isnull( feedback_o ) and not isvalid ) 
 | 
    { 
 | 
      // format values, because translations does not support representations yet 
 | 
      formatfactorlimit := factorlimit.Format( "N(Dec(0), Thousands)" ); 
 | 
      formatmincapacity := this.MinCapacity().Format( "N(Dec(0), Thousands)" ); 
 | 
      formatmaxcapacity := this.MaxCapacity().Format( "N(Dec(0), Thousands)" ); 
 | 
      stockingpointname := MacroPlan::GetSubstituteName( this.Name() ); 
 | 
      feedback_o.Add( SanityCheckMessage::GetFormattedMessage( Translations::MP_StockingPoint_Instance( stockingpointname ), 
 | 
                                                               Translations::MP_StockingPoint_ValidateInput_HasExtremeCapacityRange( formatmaxcapacity, formatmincapacity, formatfactorlimit  ) ) ); 
 | 
      sanitycheckfb.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryUnclassifiedError() );                                                            
 | 
    } 
 | 
     
 | 
    return isvalid; 
 | 
  *] 
 | 
} 
 |