chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
Method GetHasValidOperationInputOutput (
  output Strings feedback_o,
  output Strings sanitycheckfeedback_o
) declarative remote as Boolean
{
  Description: 'add error msg when no input and output is assigned to the operation'
  TextBody:
  [*
    // desmondt Oct-3-2014 (created)
    feedback := '';
    sanitycheckfeedback := ''
    
    if( this.Unit().QuantityToProcess() = GlobalParameters_MP::GetQTProcessIn()
        and this.OperationInput( relsize ) = 0 )
    {
      feedback := Translations::MP_Operation_ViolateHasValidOperationInputOutput_NoOperationInput();
      sanitycheckfeedback_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue() );
    }
    else if( this.Unit().QuantityToProcess() = GlobalParameters_MP::GetQTProcessOut()
             and this.OperationOutput( relsize ) = 0 )
    {
      feedback := Translations::MP_Operation_ViolateHasValidOperationInputOutput_NoOperationOutput();
      sanitycheckfeedback := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
    }
    
    if( not isnull( feedback_o ) and feedback <> '' )
    {
      name := MacroPlan::GetSubstituteName( this.Name() ); // To avoid empty name/name too long
      feedback_o.Add( SanityCheckMessage::GetFormattedMessage( Translations::MP_Process_Instance( this.DefinitionName(), name ),
                                                               feedback ) );
      sanitycheckfeedback_o.Add( sanitycheckfeedback );
    }
    
    return feedback = '';
  *]
}