renhao
2023-09-21 1aa9f2bb83dd9e4b7517f1cbf06b0db53979bb31
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;