Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetHasValidQuantity ( 
 | 
  output Strings feedback_o, 
 | 
  output Strings sanitycheckfeedback_o 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Returns true if the operation link has valid quantity.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    message := ''; 
 | 
    sanitychecktype := ''; 
 | 
     
 | 
    // Check if OperationLink has valid quantities 
 | 
    hasvalidsourceqty := this.SourceQuantity() > 0; 
 | 
    hasvaliddestqty := this.DestQuantity() > 0; 
 | 
    hasvaliddestminqty := this.DestMinQuantity() >= 0; 
 | 
    hasvaliddestmaxqty := this.DestMaxQuantity() > 0; 
 | 
    hasvaliddestrange := this.DestMaxQuantity() >= this.DestMinQuantity(); 
 | 
    hasvaliddestgroupqty := this.DestGroupQuantity() > 0; 
 | 
     
 | 
    isvalid := hasvalidsourceqty 
 | 
               and hasvaliddestqty 
 | 
               and hasvaliddestminqty 
 | 
               and hasvaliddestmaxqty 
 | 
               and hasvaliddestrange 
 | 
               and hasvaliddestgroupqty; 
 | 
     
 | 
    // Add feedbacks if the OperationLink has invalid qunatities 
 | 
    if( not isnull( feedback_o ) and not isvalid ) 
 | 
    { 
 | 
      // Add feedback if OperationLink has invalid source quantity 
 | 
      if( not hasvalidsourceqty ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidSourceQuantity( this.SourceQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
      // Add feedback if OperationLink has invalid destination quantity 
 | 
      else if( not hasvaliddestqty ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidDestinationQuantity( this.DestQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
      // Add feedback if OperationLink has invalid destination min quantity 
 | 
      else if( not hasvaliddestminqty ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidDestinationMinQuantity( this.DestMinQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
      // Add feedback if OperationLink has invalid destination max quantity 
 | 
      else if( not hasvaliddestmaxqty ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidDestinationMaxQuantity( this.DestMaxQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
      // Add feedback if OperationLink has invalid range for destination min and max quantity combination 
 | 
      else if( not hasvaliddestrange ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidRange( this.DestMaxQuantity(), 
 | 
                                                                                    this.DestMinQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
      // Add feedback if OperationLink has invalid destination group quantity 
 | 
      else if( not hasvaliddestgroupqty ) 
 | 
      { 
 | 
        message := Translations::MP_OperationLink_GetHasValidQuantity_InvalidDestinationGroupQuantity( this.DestGroupQuantity() ); 
 | 
        sanitychecktype :=  SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
      } 
 | 
     
 | 
      // Add feedback text 
 | 
      instance := OperationLink::GetInstanceText( this ); 
 | 
      feedback_o.Add( SanityCheckMessage::GetFormattedMessage( instance, message ) ); 
 | 
      sanitycheckfeedback_o.Add( sanitychecktype ); 
 | 
    } 
 | 
     
 | 
    return isvalid; 
 | 
  *] 
 | 
} 
 |