From 54cd79510ab97a5fa5694adfbdd344f2eb8424d2 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期五, 22 九月 2023 16:38:18 +0800
Subject: [PATCH] Merge branch 'dev_release'

---
 LibMacroPlanner/BL/Type_Process_MP/StaticMethod_GetDependentDemandEnd#969.qbl |   12 ++++++++----
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl                              |   14 +++++++-------
 _Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl   |    5 +++++
 _Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl                  |    2 +-
 4 files changed, 21 insertions(+), 12 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;
diff --git a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
index fd69c9c..c6a2bcf 100644
--- a/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
+++ b/_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -22,7 +22,7 @@
       if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
         info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
-      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID(),true);
+      product := select( globalOTDTable,Global_MappingProduct_MP,product,product.ID() = externalSupply.ProductID(),true);
       
       
       if( not isnull( product)){
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
index a501d44..5b701fd 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -33,6 +33,13 @@
     // 閿�鍞儴闂�-2
     SalesSegment_MP::DoSync( macroPlan, businessTypes,globalOTDTable );
     
+    // Unit-9 
+    // 涓嶰peration涓�鍚屽鐞�
+    //info( "BaseConversionFactor Finished, Start Operation Data Broker" );
+    //macroPlan.Broker_OTD_Operation().Execute();
+    info( "Operation Data Broker Finished, Start Unit Mapping" );
+    macroPlan.MappingUnitData( businessTypes ,globalOTDTable);
+    
     // 搴撳瓨鐐�-3
     info( "Sales Segment Finished, Start Get StockingPoint From Api" )
     bodynumber := "2";
@@ -72,13 +79,6 @@
     
     //鍗曚綅杞崲-7
     BaseConversionFactor::DoSync( macroPlan ,globalOTDTable);
-    
-    // Unit-9 
-    // 涓嶰peration涓�鍚屽鐞�
-    //info( "BaseConversionFactor Finished, Start Operation Data Broker" );
-    //macroPlan.Broker_OTD_Operation().Execute();
-    info( "Operation Data Broker Finished, Start Unit Mapping" );
-    macroPlan.MappingUnitData( businessTypes ,globalOTDTable);
     
     // 宸ヨ壓璺嚎 + BOM-9
     info( "Unit Finished, Start Operation Mapping" );
diff --git a/_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl b/_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl
index e4dae0e..9fdcd8b 100644
--- a/_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl
+++ b/_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl
@@ -13,6 +13,11 @@
     unitid := datarow.Get( "unitid" ).GetString();
     name := datarow.Get( "name" ).GetString();
     
+    unit := Unit::FindUnitTypeIndex( unitid);
+    if( isnull( unit)){
+      unitid := "鐢熶骇";
+    }
+    
     result := StockingPoint_MP::CreateStockingpoint( mp, id, unitid, name );
     
     return result;

--
Gitblit v1.9.3