From 0329782253c88ac722e87cbe2524de9cb6f529cc Mon Sep 17 00:00:00 2001
From: yanweiyuan3 <yanweiyuan3@gmail.com>
Date: 星期二, 10 十月 2023 17:45:47 +0800
Subject: [PATCH] Add Trans from Global to MacroPlan

---
 _Main/BL/Type_Global_MappingProductInLane/StaticMethod_SynchronizeMacroPlanData.qbl                                              |   31 +++
 _Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl                                                                            |    6 
 _Main/BL/Type_MacroPlan/Attribute_BusinessType.qbl                                                                               |    7 
 _Main/BL/Type_Global_MappingForecast/StaticMethod_SynchronizeMacroPlanData.qbl                                                   |   33 +++
 _Main/BL/Type_Global_MappingOperationBOM/StaticMethod_SynchronizeMacroPlanData.qbl                                               |   35 +++
 _Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def                                                   |    3 
 _Main/BL/Type_Global_MappingProduct_MP/StaticMethod_SynchronizeMacroPlanData.qbl                                                 |   33 +++
 _Main/UI/MacroPlannerWebApp/Component_FormInterfaceTest/Response_PanelInterfaceTest_ButtonSynchronizeDataToMacroPlan_OnClick.def |   20 ++
 _Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan#127.qbl                                                           |  122 +++++++++++++
 _Main/BL/Type_Global_MappingInventorySupply/StaticMethod_SynchronizeMacroPlanData.qbl                                            |   34 +++
 _Main/BL/Type_Global_MappingActualProductInStockingPointInPeriod/StaticMethod_SynchronizeMacroPlanData.qbl                       |   34 +++
 _Main/BL/Type_Global_MappingOperation/StaticMethod_SynchronizeMacroPlanData.qbl                                                  |   33 +++
 _Main/BL/Type_MacroPlan/Attribute_IsKeyProduct.qbl                                                                               |    7 
 _Main/BL/Type_Global_MappingConversionFactor/StaticMethod_SynchronizeMacroPlanData.qbl                                           |   31 +++
 _Main/BL/Type_Global_MappingStockingPointCost/StaticMethod_SynchronizeMacroPlanData.qbl                                          |   31 +++
 _Main/BL/Type_Global_MappingUnitCost/StaticMethod_SynchronizeMacroPlanData.qbl                                                   |   33 +++
 _Main/UI/MacroPlannerWebApp/Views/接口测试.vw                                                                                        |    4 
 _Main/BL/Type_Global_MappingSalesSegment_MP/StaticMethod_SynchronizeMacroPlanData.qbl                                            |   32 +++
 _Main/BL/Type_MacroPlan/Attribute_CreatePurchaseSupplyMaterial.qbl                                                               |    7 
 19 files changed, 532 insertions(+), 4 deletions(-)

diff --git "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl" "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
index ff774ec..6d84c07 100644
--- "a/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_SynchronizeDataToMacroPlan\043127.qbl"
@@ -4,11 +4,49 @@
   MacroPlan macroPlan,
   String executionUser,
   Boolean isUnitOfMeasure_MP,
-  Boolean isCustomOrder
+  Boolean isCustomOrder,
+  Boolean isForeacst,
+  Boolean isSalesSegment_MP,
+  Boolean isProduct_MP,
+  Boolean isConversionFactor,
+  Boolean isOperation,
+  Boolean isOperationBOM,
+  Boolean isProductInLane,
+  Boolean isAIPISPIP,
+  Boolean isInventorySupply,
+  Boolean isStockingPointCost,
+  Boolean isOperationCost,
+  Boolean isDOI_DSI,
+  Boolean isCustomerGrade,
+  Boolean isStockingPoint_MP,
+  Boolean isCurrency_MP,
+  Boolean isCurrencyRate_MP,
+  Boolean isLane,
+  Boolean isLaneLeg
 )
 {
   TextBody:
   [*
+    organcodelist := selectvalues( this, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
+    businessTypes := macroPlan.BusinessType().Tokenize( "," );
+    if( not isnull( businessTypes ) and businessTypes.Size() > 0 ) {
+        traverse( businessTypes, Elements, item ) {
+            info( "Business type : " + item )  
+        }
+        organcodelist := selectvalues( this, BusinessType.OrganCode, organ, businessTypes.Find( organ.BusinessType().BusinessTypeName() ) <> -1, organ.OrganCodeName() );
+    }
+    else{
+      if( businessTypes.Size() = 0 ){
+        if( not isnull( selectset( this, BusinessType, b, b.BusinessTypeName() = "" ) ) ){
+          organcodelist := selectvalues( this, BusinessType.OrganCode, organ, organ.BusinessType().BusinessTypeName() = "", organ.OrganCodeName() );
+          }
+        }
+      }
+    
+    if( organcodelist.Size() = 0 ){
+      organcodelist := selectvalues( this, Global_MappingOperationBOM, bom,true, bom.OrganCode() );
+      }
+    
     if ( isUnitOfMeasure_MP ) {
       Global_MappingUnitOfMeasure_MP::SynchronizeMacroPlanData( this, macroPlan );
     }
@@ -16,5 +54,87 @@
     if ( isCustomOrder ) {
       Global_MappingCustomOrder::SynchronizeMacroPlanData( this, macroPlan, executionUser );
     }
+    
+    if ( isForeacst ) {
+      Global_MappingForecast::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist );
+    }
+    
+    if ( isSalesSegment_MP ) {
+      Global_MappingSalesSegment_MP::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes );
+    }
+    
+    if ( isProduct_MP ) {
+      Global_MappingProduct_MP::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, macroPlan.IsKeyProduct() );
+    }
+    
+    if ( isConversionFactor ) {
+      Global_MappingConversionFactor::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+    }
+    
+    if ( isOperation ) {
+      Global_MappingOperation::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist );
+    }
+    
+    if ( isOperationBOM ) {
+      Global_MappingOperationBOM::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist, macroPlan.IsKeyProduct(), macroPlan.CreatePurchaseSupplyMaterial() );
+    }
+    
+    if ( isProductInLane ) {
+      Global_MappingProductInLane::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+    }
+    
+    if ( isAIPISPIP ) {
+      Global_MappingActualProductInStockingPointInPeriod::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist, macroPlan.IsKeyProduct() );
+    }
+    
+    if ( isInventorySupply ) {
+      Global_MappingInventorySupply::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist, macroPlan.IsKeyProduct() );
+    }
+    
+    if ( isStockingPointCost ) {
+      Global_MappingStockingPointCost::SynchronizeMacroPlanData( this, macroPlan, executionUser );
+    }
+    
+    if ( isOperationCost ) {
+      Global_MappingOperationCost::SynchronizeMacroPlanData( this, macroPlan, executionUser, businessTypes, organcodelist );
+    }
+    
+    //if ( isDOI_DSI ) {
+    //  Global_MappingDOI_DSI::SynchronizeInterfaceData( this, executionUser, "GlobalOTDTable_DOI_DSI" );
+    //}
+    //
+    //if ( isCustomerGrade ) {
+    //  Global_MappingCustomerGrade::SynchronizeInterfaceData( this, executionUser, "GlobalOTDTable_CustomerGrade" );
+    //}
+    //
+    //if ( isStockingPoint_MP ) {
+    //  this.Global_MappingStockingPoint_MP( relflush );
+    //  Global_BrokerExecuteLog::CreateInOperation( this, "StockingPoint_MP", executionUser );
+    ////  this -> Global_MappingStockingPoint_MP::CreateByAPI() -> Exception() -> Global_MappingStockingPoint_MP::OnException( this );
+    //}
+    //
+    //if ( isCurrency_MP ) {
+    //  this.Global_MappingCurrency_MP( relflush );
+    //  Global_BrokerExecuteLog::CreateInOperation( this, "Currency_MP", executionUser );
+    ////  this -> Global_MappingCurrency_MP::CreateByAPI() -> Exception() -> Global_MappingCurrency_MP::OnException( this );
+    //}
+    //
+    //if ( isCurrencyRate_MP ) {
+    //  this.Global_MappingCurrencyRate_MP( relflush );
+    //  Global_BrokerExecuteLog::CreateInOperation( this, "CurrencyRate_MP", executionUser );
+    ////  this -> Global_MappingCurrencyRate_MP::CreateByAPI() -> Exception() -> Global_MappingCurrencyRate_MP::OnException( this );
+    //}
+    //
+    //if ( isLane ) {
+    //  this.Global_MappingLane( relflush );
+    //  Global_BrokerExecuteLog::CreateInOperation( this, "Lane", executionUser );
+    ////  this -> Global_MappingLane::CreateByAPI() -> Exception() -> Global_MappingLane::OnException( this );
+    //}
+    //
+    //if ( isLaneLeg ) {
+    //  this.Global_MappingLaneLeg( relflush );
+    //  Global_BrokerExecuteLog::CreateInOperation( this, "LaneLeg", executionUser );
+    ////  this -> Global_MappingLaneLeg::CreateByAPI() -> Exception() -> Global_MappingLaneLeg::OnException( this );
+    //}
   *]
 }
diff --git a/_Main/BL/Type_Global_MappingActualProductInStockingPointInPeriod/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingActualProductInStockingPointInPeriod/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..984a0eb
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingActualProductInStockingPointInPeriod/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,34 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist,
+  Boolean isKeyProduct
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾瀹為檯搴撳瓨鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingActualPISPIPData( businessTypes, globalOTDTable, isKeyProduct, organcodelist );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingConversionFactor/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingConversionFactor/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..9467117
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingConversionFactor/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾鍗曚綅杞崲鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingBaseConversionFactorData(globalOTDTable);
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingForecast/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingForecast/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..ef72e85
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingForecast/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,33 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾棰勬祴鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingForecastData( businessTypes, globalOTDTable, organcodelist );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingInventorySupply/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingInventorySupply/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..06d00c5
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingInventorySupply/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,34 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist,
+  Boolean isKeyProduct
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾鍦ㄩ�斿簱瀛樻暟鎹�",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingExternalSupplyData( businessTypes, isKeyProduct ,globalOTDTable, organcodelist );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingOperation/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingOperation/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..6a663dd
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingOperation/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,33 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾宸ヨ壓璺嚎鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingOperationData( businessTypes ,globalOTDTable, organcodelist );  
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingOperationBOM/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingOperationBOM/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..3198fd5
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingOperationBOM/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,35 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist,
+  Boolean isKeyProduct,
+  Boolean createPurchaseSupplyMaterial
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾BOM鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingOperationBOMData( businessTypes, isKeyProduct, createPurchaseSupplyMaterial, globalOTDTable, organcodelist );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingProductInLane/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingProductInLane/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..9e722b5
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingProductInLane/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾杩愯緭璺嚎浜у搧鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingProductInLaneData(globalOTDTable);
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingProduct_MP/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingProduct_MP/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..8c10d2f
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingProduct_MP/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,33 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Boolean isKeyProduct
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾浜у搧鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingProductData( businessTypes, globalOTDTable,isKeyProduct );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingSalesSegment_MP/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingSalesSegment_MP/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..fc881d2
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingSalesSegment_MP/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,32 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾閿�鍞儴闂ㄦ暟鎹�",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingSalesSegmentData( businessTypes, globalOTDTable );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingStockingPointCost/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingStockingPointCost/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..df0cc31
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingStockingPointCost/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾搴撳瓨鎴愭湰鏁版嵁",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingInventoryValueAndCostData(globalOTDTable);
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_Global_MappingUnitCost/StaticMethod_SynchronizeMacroPlanData.qbl b/_Main/BL/Type_Global_MappingUnitCost/StaticMethod_SynchronizeMacroPlanData.qbl
new file mode 100644
index 0000000..8f08b84
--- /dev/null
+++ b/_Main/BL/Type_Global_MappingUnitCost/StaticMethod_SynchronizeMacroPlanData.qbl
@@ -0,0 +1,33 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SynchronizeMacroPlanData (
+  GlobalOTDTable globalOTDTable,
+  MacroPlan macroPlan,
+  String executionUser,
+  Strings businessTypes,
+  Strings organcodelist
+)
+{
+  TextBody:
+  [*
+    global_BrokerExecuteLog := globalOTDTable.Global_BrokerExecuteLog( relnew,
+                                                                       Name        := "鍚屾鍒堕�犳垚鏈暟鎹�",
+                                                                       IsSuccess   := true,
+                                                                       ExecuteUser := executionUser
+                                                                      );
+                                            
+      
+    try {
+      macroPlan.MappingOperationCostData( globalOTDTable, businessTypes, organcodelist );
+      
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+      global_BrokerExecuteLog.SuccessDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+    } onerror {
+      global_BrokerExecuteLog.IsSuccess( false );
+      global_BrokerExecuteLog.ErrorNo( e.ErrorNr() );
+      global_BrokerExecuteLog.ErrorMessage( e.GeneralInformation() );
+      global_BrokerExecuteLog.ErrorDateTime( DateTime::ActualTime().Format( "Y-M-D H2:m:s" ) );
+      global_BrokerExecuteLog.ExecutionStatus( "Complete" );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_MacroPlan/Attribute_BusinessType.qbl b/_Main/BL/Type_MacroPlan/Attribute_BusinessType.qbl
new file mode 100644
index 0000000..52c8a46
--- /dev/null
+++ b/_Main/BL/Type_MacroPlan/Attribute_BusinessType.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute BusinessType
+{
+  #keys: '3[412960.0.300140034][412960.0.300140033][412960.0.300140035]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_MacroPlan/Attribute_CreatePurchaseSupplyMaterial.qbl b/_Main/BL/Type_MacroPlan/Attribute_CreatePurchaseSupplyMaterial.qbl
new file mode 100644
index 0000000..0d3c691
--- /dev/null
+++ b/_Main/BL/Type_MacroPlan/Attribute_CreatePurchaseSupplyMaterial.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute CreatePurchaseSupplyMaterial
+{
+  #keys: '3[412960.0.300140031][412960.0.300140030][412960.0.300140032]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MacroPlan/Attribute_IsKeyProduct.qbl b/_Main/BL/Type_MacroPlan/Attribute_IsKeyProduct.qbl
new file mode 100644
index 0000000..b31aee8
--- /dev/null
+++ b/_Main/BL/Type_MacroPlan/Attribute_IsKeyProduct.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsKeyProduct
+{
+  #keys: '3[412960.0.300140028][412960.0.300140027][412960.0.300140029]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl b/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl
new file mode 100644
index 0000000..1672b03
--- /dev/null
+++ b/_Main/BL/Type_MacroPlan/DefaultValue_BusinessType.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: BusinessType
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
index b488de3..66ea53b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditScenario/Method_OnOk.def
@@ -117,6 +117,9 @@
         MacroPlan::DoSync( macroPlanNew, 
                            data.BusinessType(), data.IsKeyProduct(), data.CreatePurchaseSupplyMaterial() ,GlobalOTDTable);
     }
+    macroPlanNew.BusinessType( businesstype );
+    macroPlanNew.IsKeyProduct( data.IsKeyProduct() );
+    macroPlanNew.CreatePurchaseSupplyMaterial( data.CreatePurchaseSupplyMaterial() );
     
     this.Close();
   *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInterfaceTest/Response_PanelInterfaceTest_ButtonSynchronizeDataToMacroPlan_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormInterfaceTest/Response_PanelInterfaceTest_ButtonSynchronizeDataToMacroPlan_OnClick.def
index 4596f3c..25b7662 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInterfaceTest/Response_PanelInterfaceTest_ButtonSynchronizeDataToMacroPlan_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInterfaceTest/Response_PanelInterfaceTest_ButtonSynchronizeDataToMacroPlan_OnClick.def
@@ -16,7 +16,25 @@
       GlobalOTDTable.SynchronizeDataToMacroPlan( MacroPlan, 
                                                  ApplicationMacroPlanner.GetUserName(),
                                                  CheckboxUnitOfMeasure_MP.Checked(),
-                                                 CheckboxCustomOrder.Checked()
+                                                 CheckboxCustomOrder.Checked(), 
+                                                 CheckboxForecast.Checked(),
+                                                 CheckboxSalesSegment_MP.Checked(),
+                                                 CheckboxProduct_MP.Checked(),
+                                                 CheckboxConversionFactor.Checked(),
+                                                 CheckboxOperation.Checked(),
+                                                 CheckboxOperationBOM.Checked(),
+                                                 CheckboxProductInLane.Checked(),
+                                                 CheckboxAIPISPIP.Checked(),
+                                                 CheckboxInventorySupply.Checked(),
+                                                 CheckboxStockingPointCost.Checked(),
+                                                 CheckboxOperationCost.Checked(),
+                                                 CheckboxDOI_DSI.Checked(),
+                                                 CheckboxCustomerGrade.Checked(),
+                                                 CheckboxStockingPoint_MP.Checked(),
+                                                 CheckboxCurrency_MP.Checked(),
+                                                 CheckboxCurrencyRate_MP.Checked(),
+                                                 CheckboxLane.Checked(),
+                                                 CheckboxLaneLeg.Checked() 
                                                 );
       
       WebMessageBox::Success( "鍚屾鎴愬姛锛�", true );
diff --git "a/_Main/UI/MacroPlannerWebApp/Views/\346\216\245\345\217\243\346\265\213\350\257\225.vw" "b/_Main/UI/MacroPlannerWebApp/Views/\346\216\245\345\217\243\346\265\213\350\257\225.vw"
index d4e8c6a..553a623 100644
--- "a/_Main/UI/MacroPlannerWebApp/Views/\346\216\245\345\217\243\346\265\213\350\257\225.vw"
+++ "b/_Main/UI/MacroPlannerWebApp/Views/\346\216\245\345\217\243\346\265\213\350\257\225.vw"
@@ -209,10 +209,10 @@
     userconfigurableinformation
     {
     }
+    index: 4
     image: 'SKIN_TIGER'
-    page: ''
+    page: 'applicationDevelopmentActionBarPageDef'
     group: ''
-    index: 0
     description: ''
   }
   formatversion: 2

--
Gitblit v1.9.3