陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method VerifyUnitCalendarEvents (
  MacroPlan macroplan,
  String calendarid,
  Duration duration
)
{
  Description:
  [*
    Verify that :
    Assembly Plant (France) contains 1 unavailable Event with occurrences.
    Diesel Engine Line (Spain) contains 1 unavailable Event with occurrences.
    Rain contract - Engines (Spain) 1 unavailable Event with occurrences.
  *]
  TextBody:
  [*
    // Get the UnitCalendar
    unitcalendar := select( macroplan, Unit.UnitCalendar, uc, uc.CalendarID() = calendarid );
    // Get the events of unit calendars
    unitcalendarevent := unitcalendar.Event( relget );
    
    // Check event size, event type and event number of occurences                
    this.Run().AssertFalse( unitcalendarevent.Size() < 1, calendarid + " doesn't have events." );
    this.Run().AssertFalse( exists( unitcalendarevent, Elements, event, event.Type() <> LibCal_Event::TYPE_UNAVAILABLE() ), calendarid + " events should be all Type = Unavailable." );
    this.Run().AssertFalse( exists( unitcalendarevent, Elements, event, event.NrOfOccurrences() < 1 ), calendarid + " events should have at least one occurence." );
    this.Run().AssertFalse( exists( unitcalendarevent, Elements, event, event.Duration() <> duration ), 'events duration should be ' + [String]duration + ' day(s).' );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}