陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Quintiq file version 2.0
#parent: #root
StaticMethod ValidateInput (
  output String feedback_o,
  output String sanitycheckfeedback_o,
  Real minquantity,
  Real maxquantity,
  Real defaultquantity,
  OperationInput operationinput
) declarative remote as Boolean
{
  Description: 'Validate input for factor'
  TextBody:
  [*
    feedback_o := '';
    sanitycheckfeedback_o := '';
    
    // call validate input of base class on top, instead of at the end of the if stmt 
    // so that feedback_o is not re-set to empty string.
    OperationInputOutput::ValidateInput( feedback_o, sanitycheckfeedback_o, defaultquantity, operationinput );
    
    if( operationinput.IsElementOfInputGroup() )
    {                             
      // check min qty if its input
      if( minquantity < 0 )
      {
        feedback_o := Translations::MP_OperationInputOutput_ValidateInput_IsNegativeMinQuantity( minquantity );
        sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
      }
      // check max qty if its input
      else if( maxquantity < 0 )
      {
        feedback_o := Translations::MP_OperationInputOutput_ValidateInput_IsNegativeMaxQuantity( maxquantity );
        sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
      }
      // check min and max if its input with range
      else if( minquantity > maxquantity )
      {
        feedback_o := Translations::MP_OperationInputOutput_ValidateInput_IsMaxQtyLessThanMinQty( maxquantity, minquantity );
        sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
      }
      // check min and max if its input with range
      else if( defaultquantity > maxquantity or defaultquantity < minquantity )
      {
        feedback_o := Translations::MP_OperationInputOutput_ValidateInput_IsQuantityOutOfBounds( defaultquantity, minquantity, maxquantity );
        sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
      }
    }
    
    return feedback_o = '';
  *]
}