admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
Method CalculateEventType () const declarative as String
{
  TextBody:
  [*
    // rislai Jun-19-2024 (created)
    values := construct( Strings );
    
    traverse( this.UnitPeriodTime().Unit().UnitCalendar(),Participation,participation,participation.Event().Type() = LibCal_Event::TYPE_UNAVAILABLE()){
        event := participation.Event();
        
        if( this.UnitPeriodTime().Start().Date() >= event.EarliestStart() and this.UnitPeriodTime().End().Date() <= event.LatestEnd() ){
          intervals := selectset( event,LeadingParticipation.ExplicitTimeInterval,interval,LocalTool::IsAnyDurationContained( interval.Start(),interval.End(),this.UnitPeriodTime().Start(),this.UnitPeriodTime().End()));
        
          traverse( intervals,Elements,interval){
            values.Add( ifexpr( isnull( interval.Participation().Event().EventType().Parent()),interval.Participation().Event().EventType().ID(),interval.Participation().Event().EventType().Parent().ID() ));
          }
        }
    }
    values := selectuniquevalues( values,Elements,value,true,value );
    
    result := "";
    flag := true;
    traverse( values,Elements,value ,flag){
      if( value = "调休" and result <> "法定节假日"){
        result := "调休"; 
      }else if( value = "法定节假日" and result <> "法定节假日"){
        result := "法定节假日";
      }else if( value = "周六" and result <> "法定节假日"){
        result := "周六";
      }else if( value = "周日" and result <> "法定节假日"){
        result := "周日";
      }else if( value = "周末" and result <> "法定节假日"){
        result := "周末";
      }
    }
    
    return result;
  *]
}