From ae6bd7d76a91411914eee114c483db88dd3a38d2 Mon Sep 17 00:00:00 2001
From: yanweiyuan3 <yanweiyuan3@gmail.com>
Date: 星期一, 16 十月 2023 18:27:41 +0800
Subject: [PATCH] Fix for Organ Filter

---
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl                                                                                         |    2 
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl                                                                                        |   38 ++++++------------
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Response_TIANMA_JITUAN_PanelGeneral_549_checkboxEnableSync_OnChanged.def |    2 
 _Main/BL/Type_MacroPlan/StaticMethod_DoSync#618.qbl                                                                                     |    4 +-
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick#545.def             |    3 -
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_CopyScenario.def                                                  |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def                 |    3 -
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral#549.def                                           |   41 ++++++++++++++------
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick#549.def                      |    3 -
 _Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def                          |    3 -
 10 files changed, 51 insertions(+), 50 deletions(-)

diff --git "a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync\043618.qbl" "b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync\043618.qbl"
index 9d29f63..d7a38f2 100644
--- "a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync\043618.qbl"
+++ "b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync\043618.qbl"
@@ -12,9 +12,9 @@
   TextBody:
   [*
     // yypsybs Aug-17-2023 (created)
-    businessTypes := construct( Strings );
+    businessTypes := construct( BusinessType );
     if( businessTypeStr.Length() > 0 ) {
-        businessTypes := businessTypeStr.Tokenize( ',' );
+    //    businessTypes := businessTypeStr.Tokenize( ',' );
     }
     MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial ,globalOTDTable);
   *]
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl
index 49fac75..2b1d5ae 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoSync.qbl
@@ -11,7 +11,7 @@
   TextBody:
   [*
     // yypsybs Aug-17-2023 (created)
-    businessTypes := construct( Strings );
+    businessTypes := construct( BusinessType );
     MacroPlan::DoSync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial ,globalOTDTable);
   *]
 }
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();
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def" "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
index 158887f..687eea6 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Component_PanelGeneral\043549.def"
@@ -39,18 +39,6 @@
         Taborder: 3
       ]
     }
-    Component dropDownStringListGeneral
-    {
-      #keys: '[414384.0.692930324]'
-      BaseType: 'WebDropDownStringList'
-      Properties:
-      [
-        AllowEmpty: true
-        DataBinding: 'DataHolderDialogData.Data.ScenarioName'
-        Label: 'Scenario Name'
-        Taborder: 4
-      ]
-    }
     Component CheckboxIsCreateNewVersion
     {
       #keys: '[412960.0.157150313]'
@@ -62,5 +50,34 @@
         Taborder: 7
       ]
     }
+    Component DropDownListGeneral
+    {
+      #keys: '[412960.0.324971441]'
+      BaseType: 'WebDropDownList'
+      Databinding: 'BusinessType'
+      Children:
+      [
+        Component DataExtractorGeneral
+        {
+          #keys: '[412960.0.324971443]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'GlobalOTDTable'
+            Description: '浼犲叆Business Type绫昏繘Dosync'
+            Source: 'GlobalOTDTable'
+            Taborder: 0
+            Transformation: 'BusinessType'
+          ]
+        }
+      ]
+      Properties:
+      [
+        AllowEmpty: true
+        DisplayField: 'ScenarioName'
+        Label: 'Scenario Name'
+        Taborder: 4
+      ]
+    }
   ]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_CopyScenario.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_CopyScenario.def
index c0a6fa5..40534a1 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_CopyScenario.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_CopyScenario.def
@@ -20,7 +20,7 @@
     // do not distribute
     DataHolderDialogData.Data().EnableSync( false );
     checkboxEnableSync.Visible( false );
-    dropDownStringListGeneral.Visible( false );
+    DropDownListGeneral.Visible( false );
     checkboxIsKeyProduct.Visible( false );
     checkboxCreatePurchaseSupplyProduct.Visible( false );
     
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Response_TIANMA_JITUAN_PanelGeneral_549_checkboxEnableSync_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Response_TIANMA_JITUAN_PanelGeneral_549_checkboxEnableSync_OnChanged.def
index 82006b6..1221c3a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Response_TIANMA_JITUAN_PanelGeneral_549_checkboxEnableSync_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Response_TIANMA_JITUAN_PanelGeneral_549_checkboxEnableSync_OnChanged.def
@@ -10,7 +10,7 @@
   {
     Body:
     [*
-      dropDownStringListGeneral.Visible(checkboxEnableSync.Checked());
+      DropDownListGeneral.Visible(checkboxEnableSync.Checked());
       checkboxIsKeyProduct.Visible(checkboxEnableSync.Checked());
       checkboxCreatePurchaseSupplyProduct.Visible(checkboxEnableSync.Checked());
     *]
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
index 8e69dc4..2a7180e 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick\043545.def"
@@ -15,8 +15,7 @@
       // Create a new scenario
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Visible( true );
-      dlg.dropDownStringListGeneral().Visible( true );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
+      dlg.DropDownListGeneral().Visible( true );
       dlg.checkboxIsKeyProduct().Visible( true );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( true );
       dlg.NewScenario( ScenarioManager, selection, true );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
index 4c3b7f0..f62e89a 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenarioAndDoSync_OnClick.def
@@ -16,8 +16,7 @@
       // Create a new Scenario
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Visible( true );
-      dlg.dropDownStringListGeneral().Visible( true );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
+      dlg.DropDownListGeneral().Visible( true );
       dlg.checkboxIsKeyProduct().Visible( true );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( true );
       parent := selection.Element( 0 ).Parent();
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
index 607ae7d..88499fe 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick\043549.def"
@@ -16,8 +16,7 @@
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Checked( false );
       dlg.checkboxEnableSync().Visible( false );
-      dlg.dropDownStringListGeneral().Visible( false );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
+      dlg.DropDownListGeneral().Visible( false );
       dlg.checkboxIsKeyProduct().Visible( false );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( false );
       dlg.NewScenario( ScenarioManager, selection );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
index 55945ed..cec0c83 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormScenarioManager/Response_ListScenario_MenuCreateScenario_OnClick.def
@@ -17,8 +17,7 @@
       dlg := construct( DialogCreateEditScenario );
       dlg.checkboxEnableSync().Checked( false );
       dlg.checkboxEnableSync().Visible( false );
-      dlg.dropDownStringListGeneral().Visible( false );
-      dlg.dropDownStringListGeneral().Strings( ScenarioManager::AvailableScenarioNames( GlobalOTDTable ) );
+      dlg.DropDownListGeneral().Visible( false );
       dlg.checkboxIsKeyProduct().Visible( false );
       dlg.checkboxCreatePurchaseSupplyProduct().Visible( false );
       parent := selection.Element( 0 ).Parent();

--
Gitblit v1.9.3