limj
2023-09-25 76c7b6120bb5a3076a31f3c3eb7e068f290f68d3
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 #extension
{
  TextBody:
  [*
    // desmondt Oct-3-2014 (created)
    feedback := '';
    sanitycheckfeedback := ''
    
    if( ( this.Unit().QuantityToProcess() = GlobalParameters_MP::GetQTProcessIn()
          or not this.Unit().IsSupplier() ) // Tianma change 20230925: If the unit is not a supplier, raise a data issue if there's no input
        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 = '';
  *]
}