陈清红
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
Quintiq file version 2.0
#parent: #root
Function CalcHasFulfilledMinimumShiftPatternDuration
{
  TextBody:
  [*
    value := true;
    
    if( this.IsPlanning() and not this.Period_MP().IsHistorical() and not isnull( this.ShiftPattern() ) )
    {
      next := this.NextPlanningUnitPeriod();
      // If the next period is using the same shift pattern, retrieve the value of its attribute instead.
      if( not isnull( next ) and next.astype( UnitPeriodTime ).ShiftPattern() = this.ShiftPattern() )
      {
        value := next.astype( UnitPeriodTime ).HasFulfilledMinimumShiftPatternDuration();
      }
      // Otherwise, set the attribute to true if the current shift pattern has been used at least as long as its minimum duration.
      else
      {
        value := this.CumulativeShiftPatternDuration() >= this.ShiftPattern().MinimumDuration();
      }
    }
    
    this.HasFulfilledMinimumShiftPatternDuration( value );
  *]
}