From 0c76b59a9f1bdb9b0b9cf9947ee8b4df324082a6 Mon Sep 17 00:00:00 2001
From: Kevin Kok Khah Whey <khahwhey.kok@3ds.com>
Date: 星期三, 20 九月 2023 13:54:45 +0800
Subject: [PATCH] Kevin: 修改了更改Period开始时间是报错的问题。

---
 LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd#969.qbl |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git "a/LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd\043969.qbl" "b/LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd\043969.qbl"
index d91a09e..b5b095a 100644
--- "a/LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd\043969.qbl"
+++ "b/LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd\043969.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;

--
Gitblit v1.9.3