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
  | Quintiq file version 2.0 
 |  #parent: #root 
 |  StaticMethod GetDependentDemandEnd ( 
 |    DateTime start, 
 |    const Period_MP period, 
 |    const Process_MP process 
 |  ) const declarative as DateTime 
 |  { 
 |    TextBody: 
 |    [* 
 |      value := Process_MP::GetOperationEnd( period, start ); 
 |      gp := period.MacroPlan().GlobalParameters_MP();  
 |       
 |      if( not gp.IsOperationLeadTimeLogicProportional() )  
 |      { 
 |        //get period of start  
 |        ddstartperiod := select( gp.MacroPlan(), PlanningPeriod, pp, pp.Start() <= start and pp.End() > start ); 
 |         
 |        // Tianma fix 20230920 
 |        if( not isnull( ddstartperiod ) ) 
 |        { 
 |          // if not start from middle and leadtime < period task period duration, make sure dependent demand end before period start 
 |          periodstart :=  ifexpr( not gp.IsOperationLeadTimeLogicFromMiddle() and period.Duration() < process.LeadTime(), period.Start(), DateTime::MaxDateTime() ); 
 |           
 |          value := minvalue( start + process.LeadTime(), start + ddstartperiod.Duration(), periodstart ); 
 |        } 
 |      } 
 |       
 |      return value; 
 |    *] 
 |  } 
 |  
  |