yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Quintiq file version 2.0
#parent: #root
Method GetAllowedPostponementPeriods () declarative remote as constcontent owning Period_MPs
{
  Description: 'Retrieve planning periods that the SDiP are allowed to be postponed to'
  TextBody:
  [*
    result := null( Period_MPs, owning, constcontent )
    
    if( not isnull( this.AsSalesDemandInPeriodBase() ) )
    {
      pispipend := guard( this.AsSalesDemandInPeriodBase().End(), DateTime::MaxDateTime() );
      nrofdays := this.LastAllowedPostponementPeriodEnd() - pispipend;
      
      // Get BasePISPIPs within range and retrieve Period_MP
      pispips := this.AsSalesDemandInPeriodBase().GetNextPlanningPISPIPs( nrofdays.DaysAsReal() );
      result := selectset( pispips, Elements.Period_MP, period, 
                           period.End() <= this.LastAllowedPostponementPeriodEnd() );
    }
    
    return &result;
  *]
}