yunchai
2023-10-08 1a5a8be205641f5f79dd809f6c7e59fc84d76243
LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd#969.qbl
@@ -16,10 +16,14 @@
      //get period of start 
      ddstartperiod := select( gp.MacroPlan(), PlanningPeriod, pp, pp.Start() <= start and pp.End() > start );
      
      // 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 );
      // 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;