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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Quintiq file version 2.0
#parent: #root
StaticMethod Update (
  UnitAvailabilitys unitavailabilitys,
  Unit unit,
  DateTime start,
  Boolean isbatcheditmaintenance,
  String timeunit,
  Duration maintenance,
  Boolean isbatcheditefficiency,
  Real efficiency,
  Boolean isbatcheditallocation,
  Real allocation,
  Boolean isbatcheditshiftpattern,
  ShiftPattern shiftpattern,
  Boolean isbatcheditmaxloadpercentage,
  Real maxloadpercentage,
  Boolean isbatcheditnrofunitsopen,
  Number nrofunitsopen,
  Boolean isbatcheditminimumloadthreshold,
  Real minimumloadthreshold
)
{
  Description: 'Batch edit unit availability, data get from UI.'
  TextBody:
  [*
    // Soh Yee Jul-19-2012 (created)
    
    traverse( unitavailabilitys, Elements, ua )
    {
      // Case related to batch edit.
      if( unitavailabilitys.Size() > 1 )
      {
        // The selectors are disabled if batch edit. So, it is incorrect to take the input from UI.
        unit := ua.Unit();
        start := ua.Start();
    
        // Get back the unit availability value if the batch edit check boxes are not checked, instead of from UI.
        if( not isbatcheditmaintenance )
        {
          timeunit := ua.TimeUnit();
          maintenance := ua.Maintenance();
        }
    
        if( not isbatcheditefficiency )
        {
          efficiency := ua.Efficiency();
        }
    
        if( not isbatcheditallocation )
        {
          allocation := ua.Allocation();
        }
    
        if( not isbatcheditshiftpattern )
        {
          shiftpattern := ua.ShiftPattern();
        }
    
        if( not isbatcheditmaxloadpercentage )
        {
          maxloadpercentage := ua.MaximumLoadPercentage();
        }
    
        if( not isbatcheditnrofunitsopen )
        {
          nrofunitsopen := ua.NrOfUnitsOpen();
        }
        
        if( not isbatcheditminimumloadthreshold )
        {
          minimumloadthreshold := ua.MinimumLoadThreshold();
        }    
      }
    
      ua.Update( unit,
                 start,
                 timeunit,
                 maintenance,
                 efficiency,
                 allocation,
                 shiftpattern,
                 maxloadpercentage,
                 nrofunitsopen,
                 minimumloadthreshold,
                 false // action from UI is Manual
               );
    }
  *]
}