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
| Quintiq file version 2.0
| #parent: #root
| Method UpdateShiftPattern (
| String unitname,
| String shiftpatternname,
| String date
| )
| {
| TextBody:
| [*
| // Update UnitAvailability for the selected Unit
| // Select Unit according to the passed in unitname
| unit := select( this, MacroPlan.Unit, u, u.Name() = unitname );
|
| // Execute the following logic only if Unit is found
| if ( not isnull( unit ) )
| {
| // Select ShiftPattern according to the passed in shiftpatternname
| shiftpattern := select( this, MacroPlan.ShiftPattern, sp, sp.Name() = shiftpatternname );
|
| // Create custom StringToDate converter and covert the passed in date String into Date datatype
| converter := StringToDate::StandardConverter();
| converter.SetCustomConversion();
| converter.CustomFormatString( "dd-MMM-yyyy" );
| newdate := converter.Convert( date );
|
| // Select the Unit's UnitAvailability that starts at newdate
| ua := select( unit, UnitAvailability, ua, true , ua.Start().Date() = newdate );
| uas := construct( UnitAvailabilitys );
| uas.Add( ua );
|
| // Update the selected UnitAvailability
| UnitAvailability::Update( uas,
| unit,
| ua.Start(),
| false,
| ua.TimeUnit(),
| ua.Maintenance(),
| false,
| ua.Efficiency(),
| false,
| ua.Allocation(),
| false,
| shiftpattern,
| false,
| ua.MaximumLoadPercentage(),
| false,
| ua.NrOfUnitsOpen(),
| false,
| ua.MinimumLoadThreshold()
| );
| }
| *]
| }
|
|