From 7a8fd5ab0aad4a41a8898b7084b1bceb9a2a8a51 Mon Sep 17 00:00:00 2001
From: renhao <renhui.hao@capgemini.com>
Date: 星期二, 24 十月 2023 16:07:29 +0800
Subject: [PATCH] Merge branch 'dev'

---
 _Main/BL/Type_MacroPlan/StaticMethod_DoASync#253.qbl |   46 ++++++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 28 deletions(-)

diff --git "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl" "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
index 8e5e156..0f6ac65 100644
--- "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
+++ "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043253.qbl"
@@ -2,11 +2,11 @@
 #parent: #root
 StaticMethod DoASync (
   MacroPlan macroPlan,
-  Strings businessTypes,
+  const BusinessType businessType,
   Boolean isKeyProduct,
   Boolean createPurchaseSupplyMaterial,
   const GlobalOTDTable globalOTDTable
-)
+) as stream[MacroPlan]
 {
   Description: '鍗曟鍚屾'
   TextBody:
@@ -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::DoASync( globalOTDTable, macroPlan );
     
     // 閿�鍞儴闂�-2
-    SalesSegment_MP::DoASync( macroPlan, businessTypes,globalOTDTable );
+    SalesSegment_MP::DoASync( 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.DoASyncMappingUnitData( businessTypes ,globalOTDTable, organcodelist);
+    macroPlan.DoASyncMappingUnitData( 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.DoASyncMappingProductData( businessTypes, globalOTDTable,isKeyProduct );
+    macroPlan.DoASyncMappingProductData( businessTypeName, globalOTDTable,isKeyProduct );
     
     //鍗曚綅杞崲-7
     BaseConversionFactor::DoASync( macroPlan ,globalOTDTable);
     
     // 宸ヨ壓璺嚎 + BOM-9
     info( "Unit Finished, Start Operation Mapping" );
-    macroPlan.DoASyncMappingOperationData( businessTypes ,globalOTDTable, organcodelist );  
+    macroPlan.DoASyncMappingOperationData( businessTypeName ,globalOTDTable, organcodelist );  
     //info( "Operation Finished, Start BOM Data Broker" );
     //macroPlan.Broker_OTD_BOM().Execute();
     info( "BOM Data Broker Finished, Start BOM Mapping" );
-    macroPlan.DoASyncMappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist );
+    macroPlan.DoASyncMappingOperationBOMData( businessTypeName, isKeyProduct, createPurchaseSupplyMaterial,globalOTDTable, organcodelist );
     
     //杞﹂亾淇℃伅-10
     info( "BOM Finished, Start Get Lanes From Api" );
@@ -127,32 +115,32 @@
     //info( "Get Lanelegs From Api Finished, Start ProductInLane Data Broker" );
     //macroPlan.Broker_OTD_ProductInLane().Execute();
     info( "ProductInLane Data Broker Finished, Start ProductInLane Mapping" );
-    macroPlan.DoASyncMappingProductInLaneData(globalOTDTable);
+    macroPlan.DoASyncMappingProductInLaneData(globalOTDTable,guard( businessTypeName.Element( 0 ), "" ));
     
     // 鍦ㄥ簱搴撳瓨鏁版嵁-13
     //info( "ProductInLane Finished, Start ActualPISPIP Data Broker" );
     //macroPlan.Broker_OTD_ActualPISPIP().Execute();
     info( "ActualPISPIP Data Broker Finished, Start ActualPISPIP Mapping" );
-    macroPlan.DoASyncMappingActualPISPIPData( businessTypes, globalOTDTable,isKeyProduct, organcodelist );
+    macroPlan.DoASyncMappingActualPISPIPData( 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.DoASyncMappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist );
+    macroPlan.DoASyncMappingExternalSupplyData( businessTypeName, isKeyProduct ,globalOTDTable, organcodelist );
     
     // 搴撳瓨鎴愭湰-15
-    InventoryValueAndCost::DoASync( macroPlan,globalOTDTable );
+    InventoryValueAndCost::DoASync( macroPlan,globalOTDTable,guard( businessTypeName.Element( 0 ), "" ) );
     
     // todo 鍒堕�犳垚鏈�-16
     info( "InventoryCost Finished, Start OperationCost Mapping" );
-    macroPlan.DoASyncMappingOperationCostData( globalOTDTable, businessTypes, organcodelist );
+    macroPlan.DoASyncMappingOperationCostData( globalOTDTable, businessTypeName, organcodelist );
     
     // 璁㈠崟棰勬祴-17
-    Forecast::DoASync( macroPlan, businessTypes, globalOTDTable, organcodelist );
+    Forecast::DoASync( macroPlan, businessTypeName, globalOTDTable, organcodelist );
     
     // 璁㈠崟闇�姹�-18
-    CustomerOrder::DoASync( macroPlan, businessTypes, globalOTDTable, organcodelist );
+    CustomerOrder::DoASync( macroPlan, businessTypeName, globalOTDTable, organcodelist );
     
     //鍒犻櫎澶氫綑鎶ラ敊鏁版嵁-19
     macroPlan.DeleteSnaityCheck();
@@ -162,5 +150,7 @@
     
     //// todo 渚涘簲鍟嗗洖澶�
     //info( "ProviderReply::DoSync" )
+    
+    return emit( macroPlan );
   *]
 }

--
Gitblit v1.9.3