陈清红
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
Quintiq file version 2.0
#parent: #root
Method GetHasValidPlanningPeriod (
  output Strings feedback_o,
  output Strings sanitycheckfeedback_o
) declarative remote as Boolean
{
  Description: 'check if macroplan has valid period ( at least a period )'
  TextBody:
  [*
    // ODE2 Jun-01-2017 (created)
    //compare base on end time, the sorted relation( baseperiod/ lastperiod) is base on start time not consider of the end time
    end := guard( maxselect( this, Period_MP, period, 
                             not isnull( period.PeriodSpecification_MP() ), period.End() ).End() , 
                  DateTime::MaxDateTime() );
    
    isvalid := guard( this.FirstPlanningPeriod().Start() = this.FirstBasePeriod().Start()
                      and this.LastPlanningPeriod().End() = end,
                      false );
    
    if( not isnull( feedback_o ) and not isvalid )
    {
      feedback_o.Add( Translations::MP_MacroPlan_ViolateHasValidPlanningPeriod() );
      sanitycheckfeedback_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() );
    }
    
    return isvalid;
  *]
}