From 4f426fd0938d68df759fff7570ad6ec2e62bac96 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期三, 18 十月 2023 09:08:32 +0800
Subject: [PATCH] Merge branch 'dev'

---
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl |   38 +++++++++++++-------------------------
 1 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
index 5178d37..8cb5656 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -2,7 +2,7 @@
 #parent: #root
 StaticMethod DoSync (
   MacroPlan macroPlan,
-  Strings businessTypes,
+  BusinessType businessType,
   Boolean isKeyProduct,
   Boolean createPurchaseSupplyMaterial,
   GlobalOTDTable globalOTDTable
@@ -16,20 +16,8 @@
     //Currency_MP::CreateCurrencyFromJson( macroPlan, jsonDataRow );
     info( "Prepare to do sync" )
     info( "Get organ code list" )
-    organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
-    if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
-        traverse( businessTypes, Elements, item ) {
-            info( "Business type : " + item )  
-        }
-        organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
-    }
-    else{
-      if( businessTypes.Size() = 0 ){
-        if( not isnull( selectset( globalOTDTable, BusinessType, b, b.BusinessTypeName() = "" ) ) ){
-          organcodelist := selectvalues( globalOTDTable, BusinessType.OrganCode, organ, organ.BusinessType().BusinessTypeName() = "", organ.OrganCodeName() );
-          }
-        }
-      }
+    businessTypeName := businessType.BusinessTypeName().Tokenize( "," );
+    organcodelist := selectvalues( businessType, OrganCode, organ, true, organ.OrganCodeName() );
     
     if( organcodelist.Size() = 0 ){
       organcodelist := selectvalues( globalOTDTable, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
@@ -46,14 +34,14 @@
     UnitOfMeasure_MP::DoSync( globalOTDTable,macroPlan );
     
     // 閿�鍞儴闂�-2
-    SalesSegment_MP::DoSync( macroPlan, businessTypes,globalOTDTable );
+    SalesSegment_MP::DoSync( macroPlan, businessTypeName, 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, organcodelist);
+    macroPlan.MappingUnitData( businessTypeName ,globalOTDTable, organcodelist);
     
     // 搴撳瓨鐐�-3
     info( "Sales Segment Finished, Start Get StockingPoint From Api" )
@@ -90,18 +78,18 @@
     //macroPlan.Broker_OTD_Product().Execute();
     info( "Product Data Broker Finished, Start Product Mapping" );
     //testproduct := construct( Strings );
-    macroPlan.MappingProductData( businessTypes, globalOTDTable,isKeyProduct );
+    macroPlan.MappingProductData( businessTypeName, globalOTDTable,isKeyProduct );
     
     //鍗曚綅杞崲-7
     BaseConversionFactor::DoSync( macroPlan ,globalOTDTable);
     
     // 宸ヨ壓璺嚎 + BOM-9
     info( "Unit Finished, Start Operation Mapping" );
-    macroPlan.MappingOperationData( businessTypes ,globalOTDTable, organcodelist );  
+    macroPlan.MappingOperationData( businessTypeName ,globalOTDTable, organcodelist );  
     //info( "Operation Finished, Start BOM Data Broker" );
     //macroPlan.Broker_OTD_BOM().Execute();
     info( "BOM Data Broker Finished, Start BOM Mapping" );
-    macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist );
+    macroPlan.MappingOperationBOMData( businessTypeName, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist );
     
     //杞﹂亾淇℃伅-10
     info( "BOM Finished, Start Get Lanes From Api" );
@@ -133,26 +121,26 @@
     //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
     //macroPlan.Broker_OTD_ActualPISPIP().Execute();
     info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" );
-    macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct, organcodelist );
+    macroPlan.MappingActualPISPIPData( businessTypeName, globalOTDTable,isKeyProduct, organcodelist );
     
     // 鍦ㄩ�斿簱瀛�-14
     //info( "ActualPISPIP Finished, Start ExternalSupply Data Broker" );
     //macroPlan.Broker_OTD_ExternalSupply().Execute();
     info( "ExternalSupply Data Broker Finished, Start ExternalSupply Mapping" );
-    macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist );
+    macroPlan.MappingExternalSupplyData( businessTypeName, isKeyProduct ,globalOTDTable, organcodelist );
     
     // 搴撳瓨鎴愭湰-15
     InventoryValueAndCost::DoSync( macroPlan,globalOTDTable );
     
     // todo 鍒堕�犳垚鏈�-16
     info( "InventoryCost Finished, Start OperationCost Mapping" );
-    macroPlan.MappingOperationCostData( globalOTDTable, businessTypes, organcodelist );
+    macroPlan.MappingOperationCostData( globalOTDTable, businessTypeName, organcodelist );
     
     // 璁㈠崟棰勬祴-17
-    Forecast::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist );
+    Forecast::DoSync( macroPlan, businessTypeName, globalOTDTable, organcodelist );
     
     // 璁㈠崟闇�姹�-18
-    CustomerOrder::DoSync( macroPlan, businessTypes, globalOTDTable, organcodelist );
+    CustomerOrder::DoSync( macroPlan, businessTypeName, globalOTDTable, organcodelist );
     
     //鍒犻櫎澶氫綑鎶ラ敊鏁版嵁-19
     macroPlan.DeleteSnaityCheck();

--
Gitblit v1.9.3