yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
StaticMethod CanClosePermanent (
  output String feedback_o,
  Number nrofopenunit,
  Number input_openunit,
  Number nroftemporarilyclosedunit,
  Number input_temporarilyclosedunit
) declarative remote as Boolean
{
  Description: 'Used in the designer'
  TextBody:
  [*
    feedback_o := '';
    
    // Nr of open unit = 0 and Nr of temporarily close unit = 0
    if( nrofopenunit = 0 and nroftemporarilyclosedunit = 0 )
    {
      feedback_o := Translations::MP_UnitPeriod_CanClosePermanent_NoClosedUnit();
    }
    // Inputs open unit greater than nr of open unit
    else if( input_openunit > nrofopenunit )
    {
      feedback_o := Translations::MP_UnitPeriod_CanClosePermanent_NoAvailableUnit( nrofopenunit, nroftemporarilyclosedunit );
    }
    // Inputs temp close unit greater than nr og temp close unit
    else if( input_temporarilyclosedunit > nroftemporarilyclosedunit )
    {
      feedback_o := Translations::MP_UnitPeriod_CanClosePermanent_NoAvailableUnit( nrofopenunit, nroftemporarilyclosedunit );
    }
    // Inputs open unit = 0 and inputs temp close unit = 0
    else if( input_openunit = 0 and input_temporarilyclosedunit = 0 )
    {
      feedback_o := Translations::MP_UnitPeriod_CanClosePermanent_UnitEmpty();
    }
    // Input open unit lesser 0 OR input temp close unit lesser than 0
    else if( input_openunit < 0 or input_temporarilyclosedunit < 0 )
    {
      feedback_o := Translations::MP_UnitPeriod_CanClosePermanent_IsNegativeValue();
    }
    return feedback_o = '';
  *]
}