From cbaf9b93e0393cc7205285b047dec7fcef6ab0ed Mon Sep 17 00:00:00 2001
From: haorenhui <renhui.hao@capgemini.com>
Date: 星期三, 18 十月 2023 10:48:00 +0800
Subject: [PATCH] Merge branch 'dev' into dev_hrh_global

---
 _Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def                                |   22 +
 _Main/BL/Type_GlobalOTDLog/_ROOT_Type_GlobalOTDLog.qbl                                                                            |    9 
 _Main/BL/Type_DataDistributionLog/Attribute_MacroPlanMDSID.qbl                                                                    |    8 
 _Main/BL/Relations/Relation_GlobalOTDLog_DataDistributionLog_DataDistributionLog_GlobalOTDLog.qbl                                 |   23 +
 _Main/BL/Type_MacroPlan/StaticMethod_DoASync.qbl                                                                                  |    4 
 _Main/UI/MacroPlannerWebApp/Views/数据分发.vw                                                                                         |  250 +++++++++++++++++++
 _Main/BL/Dataset_GlobalOTDLog/_ROOT_Dataset_GlobalOTDLog.qbl                                                                      |    9 
 _Main/BL/Type_DataDistributionLog/Attribute_ErrorNo.qbl                                                                           |    8 
 _Main/BL/Type_MacroPlan/StaticMethod_DoASyncOnException.qbl                                                                       |   12 
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuSelectionAll_OnClick.def       |   17 +
 _Main/BL/Type_DataDistributionLog/_ROOT_Type_DataDistributionLog.qbl                                                              |    9 
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listContextMenuDataDistributionLog.def                    |   36 ++
 _Main/BL/Type_DataDistributionLog/StaticMethod_OnError.qbl                                                                        |   18 +
 _Main/BL/Type_MacroPlan/StaticMethod_DoASyncSuccess.qbl                                                                           |   10 
 _Main/BL/Type_DMF_CustomLogic/Method_OnFinished.qbl                                                                               |    3 
 _Main/BL/Type_DataDistributionLog/Attribute_ErrorMessage.qbl                                                                      |    8 
 _Main/BL/Type_DataDistributionLog/Attribute_ExecuteUser.qbl                                                                       |    8 
 _Main/BL/Type_GlobalOTDLog/StaticMethod_GetLoadedDataset.qbl                                                                      |   20 +
 _Main/BL/Type_DataDistributionLog/Attribute_ScenarioName.qbl                                                                      |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/_ROOT_Component_FormDataDistributionLog.def                         |   17 +
 _Main/BL/Type_DataDistributionLog/Attribute_ExecuteStatus.qbl                                                                     |   14 +
 /dev/null                                                                                                                         |    8 
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_ListDataDistributionLog.def                               |   59 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuDelete_OnClick.def             |   18 +
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_cmTestAttempt.def                                         |   15 +
 _Main/BL/Type_MacroPlan/StaticMethod_DoASync#896.qbl                                                                              |    4 
 _Main/BL/Type_DataDistributionLog/StaticMethod_OnSuccess.qbl                                                                      |   14 +
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_cmTestAttempt_mnDataDistribution_OnClick.def |   16 +
 _Main/Sys/ImgAttr/DataDistributionLog.dme                                                                                         |   31 ++
 _Main/BL/Type_GlobalOTDLog/StaticMethod_GetDatasetName.qbl                                                                        |    6 
 _Main/BL/Type_DataDistributionLog/StaticMethod_Create.qbl                                                                         |   19 +
 _Main/BL/Type_GlobalOTDLog/StaticMethod_OnServerStartup.qbl                                                                       |   27 ++
 _Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listActionBarPageDataDistributionLog.def                  |   10 
 33 files changed, 720 insertions(+), 20 deletions(-)

diff --git a/_Main/BL/Dataset_GlobalOTDLog/_ROOT_Dataset_GlobalOTDLog.qbl b/_Main/BL/Dataset_GlobalOTDLog/_ROOT_Dataset_GlobalOTDLog.qbl
new file mode 100644
index 0000000..9c7e0a4
--- /dev/null
+++ b/_Main/BL/Dataset_GlobalOTDLog/_ROOT_Dataset_GlobalOTDLog.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Dataset GlobalOTDLog
+{
+  #keys: '2[414702.1.146900052][414702.1.146900051]'
+  DefaultMDSName: 'GlobalOTDLog'
+  InstanceType: GlobalOTDLog
+}
diff --git a/_Main/BL/Relations/Relation_GlobalOTDLog_DataDistributionLog_DataDistributionLog_GlobalOTDLog.qbl b/_Main/BL/Relations/Relation_GlobalOTDLog_DataDistributionLog_DataDistributionLog_GlobalOTDLog.qbl
new file mode 100644
index 0000000..2a49fb7
--- /dev/null
+++ b/_Main/BL/Relations/Relation_GlobalOTDLog_DataDistributionLog_DataDistributionLog_GlobalOTDLog.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation GlobalOTDLog_DataDistributionLog_DataDistributionLog_GlobalOTDLog
+{
+  #keys: '1[414702.1.153774700]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide DataDistributionLog
+  {
+    #keys: '3[414702.1.153774702][414702.1.153774701][414702.1.153774703]'
+    Cardinality: '1toN'
+    ObjectDefinition: GlobalOTDLog
+    OwningSide: 'Owned'
+  }
+  RelationSide.RightSide GlobalOTDLog
+  {
+    #keys: '3[414702.1.153774705][414702.1.153774704][414702.1.153774706]'
+    Cardinality: '0to1'
+    ObjectDefinition: DataDistributionLog
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Type_DMF_CustomLogic/Method_OnFinished.qbl b/_Main/BL/Type_DMF_CustomLogic/Method_OnFinished.qbl
index 082e4a6..d2c5af4 100644
--- a/_Main/BL/Type_DMF_CustomLogic/Method_OnFinished.qbl
+++ b/_Main/BL/Type_DMF_CustomLogic/Method_OnFinished.qbl
@@ -31,6 +31,9 @@
     // 鍒涘缓澶╅┈SOP鍏ㄥ眬鏁版嵁闆�
     GlobalOTDSOP::OnServerStartup();
     
+    // 鍒涘缓澶╅┈鍏ㄥ眬鏃ュ織鏁版嵁闆�
+    GlobalOTDLog::OnServerStartup();
+    
     // Create a MemoryOnly-dataset that is used to receive SOAP-calls from the DataManager.
     MDSScenarioManager::CreateMemoryOnlyMDS( ScenarioManager::GetDatasetNameReceiver() );
     
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_ErrorMessage.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_ErrorMessage.qbl
new file mode 100644
index 0000000..eb0383f
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_ErrorMessage.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ErrorMessage
+{
+  #keys: '3[414702.1.153847470][414702.1.153847469][414702.1.153847471]'
+  Description: '閿欒娑堟伅'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_ErrorNo.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_ErrorNo.qbl
new file mode 100644
index 0000000..15c0f4e
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_ErrorNo.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ErrorNo
+{
+  #keys: '3[414702.1.153847460][414702.1.153847459][414702.1.153847461]'
+  Description: '閿欒鍙�'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteStatus.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteStatus.qbl
new file mode 100644
index 0000000..a085ee8
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteStatus.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ExecuteStatus
+{
+  #keys: '3[414702.1.153847412][414702.1.153847411][414702.1.153847413]'
+  Description:
+  [*
+    鎵ц鐘舵��
+    Running
+    Success
+    Error
+  *]
+  ValueType: String
+}
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteUser.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteUser.qbl
new file mode 100644
index 0000000..b2cbfe4
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_ExecuteUser.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ExecuteUser
+{
+  #keys: '3[414702.1.153847399][414702.1.153847398][414702.1.153847400]'
+  Description: '鎵ц鐢ㄦ埛'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_MacroPlanMDSID.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_MacroPlanMDSID.qbl
new file mode 100644
index 0000000..2f6b4b0
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_MacroPlanMDSID.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute MacroPlanMDSID
+{
+  #keys: '3[414702.1.153847422][414702.1.153847421][414702.1.153847423]'
+  Description: 'MacroPlan鏁版嵁闆嗙殑ID'
+  ValueType: Key
+}
diff --git a/_Main/BL/Type_DataDistributionLog/Attribute_ScenarioName.qbl b/_Main/BL/Type_DataDistributionLog/Attribute_ScenarioName.qbl
new file mode 100644
index 0000000..966147d
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/Attribute_ScenarioName.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ScenarioName
+{
+  #keys: '3[414702.1.153820151][414702.1.153820150][414702.1.153820152]'
+  Description: '鍦烘櫙鍚嶇О'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_DataDistributionLog/StaticMethod_Create.qbl b/_Main/BL/Type_DataDistributionLog/StaticMethod_Create.qbl
new file mode 100644
index 0000000..1bd9437
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/StaticMethod_Create.qbl
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Create (
+  GlobalOTDLog globalOTDLog,
+  String executeUser,
+  Key macroPlanMDSID,
+  String scenarioName
+)
+{
+  TextBody:
+  [*
+    globalOTDLog.DataDistributionLog( relnew,
+                                      ExecuteStatus  := "Running",
+                                      ExecuteUser    := executeUser,
+                                      MacroPlanMDSID := macroPlanMDSID,
+                                      ScenarioName   := scenarioName
+                                     );
+  *]
+}
diff --git a/_Main/BL/Type_DataDistributionLog/StaticMethod_OnError.qbl b/_Main/BL/Type_DataDistributionLog/StaticMethod_OnError.qbl
new file mode 100644
index 0000000..45dd941
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/StaticMethod_OnError.qbl
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod OnError (
+  GlobalOTDLog globalOTDLog,
+  Key macroPlanMDSID,
+  Number errorNo,
+  String errorMessage
+)
+{
+  TextBody:
+  [*
+    targetDataDistributionLog := select( globalOTDLog, DataDistributionLog, tempDDL, tempDDL.MacroPlanMDSID() = macroPlanMDSID );
+    
+    targetDataDistributionLog.ExecuteStatus( "Error" );
+    targetDataDistributionLog.ErrorNo( errorNo );
+    targetDataDistributionLog.ErrorMessage( errorMessage );
+  *]
+}
diff --git a/_Main/BL/Type_DataDistributionLog/StaticMethod_OnSuccess.qbl b/_Main/BL/Type_DataDistributionLog/StaticMethod_OnSuccess.qbl
new file mode 100644
index 0000000..0d4b122
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/StaticMethod_OnSuccess.qbl
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod OnSuccess (
+  GlobalOTDLog globalOTDLog,
+  Key macroPlanMDSID
+)
+{
+  TextBody:
+  [*
+    targetDataDistributionLog := select( globalOTDLog, DataDistributionLog, tempDDL, tempDDL.MacroPlanMDSID() = macroPlanMDSID );
+    
+    targetDataDistributionLog.ExecuteStatus( "Success" );
+  *]
+}
diff --git a/_Main/BL/Type_DataDistributionLog/_ROOT_Type_DataDistributionLog.qbl b/_Main/BL/Type_DataDistributionLog/_ROOT_Type_DataDistributionLog.qbl
new file mode 100644
index 0000000..ce88a55
--- /dev/null
+++ b/_Main/BL/Type_DataDistributionLog/_ROOT_Type_DataDistributionLog.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type DataDistributionLog
+{
+  #keys: '5[414702.1.153774697][414702.1.153774695][0.0.0][414702.1.153774696][414702.1.153774698]'
+  BaseType: Object
+  StructuredName: 'DataDistributionLogs'
+}
diff --git a/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetDatasetName.qbl b/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetDatasetName.qbl
new file mode 100644
index 0000000..71c12d1
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetDatasetName.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDatasetName () as String
+{
+  TextBody: 'return typeof( GlobalOTDLog ).ShortName();'
+}
diff --git a/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetLoadedDataset.qbl b/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetLoadedDataset.qbl
new file mode 100644
index 0000000..cdc29f7
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDLog/StaticMethod_GetLoadedDataset.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetLoadedDataset () as owning MDSID
+{
+  TextBody:
+  [*
+    mds := null( MDSID, owning );
+    folder := '/root';
+    datasetName := GlobalOTDLog::GetDatasetName();
+    
+    oinfo := MDSEditor::Editor().LoadedObjectInfo( datasetName, folder, datasetName );
+    
+    if(  not isnull( oinfo ) )
+    {
+      mds := oinfo.MDSID();
+    }  
+    
+    return &mds;
+  *]
+}
diff --git a/_Main/BL/Type_GlobalOTDLog/StaticMethod_OnServerStartup.qbl b/_Main/BL/Type_GlobalOTDLog/StaticMethod_OnServerStartup.qbl
new file mode 100644
index 0000000..e2ce947
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDLog/StaticMethod_OnServerStartup.qbl
@@ -0,0 +1,27 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod OnServerStartup
+{
+  TextBody:
+  [*
+    debuginfo( '================================ GlobalOTDLog =======================================')
+    folder := DomainModel::Domain().MDSFolderDefinitions().FindFolder( "/root" );
+    
+    datasetName := GlobalOTDLog::GetDatasetName();
+    
+    oinfo := MDSEditor::Editor().ObjectInfos( datasetName, folder.FolderID(), datasetName );
+    
+    o := select( oinfo, Elements, o, not o.IsLoaded() );
+    emptydataset := isnull( o );
+    
+    if( emptydataset )
+    {
+      MDSGlobalOTDLog::CreateMDS( datasetName, GlobalParameters_MP::GetStorageState() );
+      GlobalOTDLog::GetLoadedDataset();
+    }
+    else
+    {
+      MDSGlobalOTDLog::LoadMDSAndConvert( o.MDSID(), GlobalParameters_MP::GetStorageState() );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_GlobalOTDLog/_ROOT_Type_GlobalOTDLog.qbl b/_Main/BL/Type_GlobalOTDLog/_ROOT_Type_GlobalOTDLog.qbl
new file mode 100644
index 0000000..289fd9a
--- /dev/null
+++ b/_Main/BL/Type_GlobalOTDLog/_ROOT_Type_GlobalOTDLog.qbl
@@ -0,0 +1,9 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type GlobalOTDLog
+{
+  #keys: '5[414702.1.146900046][414702.1.146900044][0.0.0][414702.1.146900045][414702.1.146900047]'
+  BaseType: Object
+  StructuredName: 'GlobalOTDLogs'
+}
diff --git a/_Main/BL/Type_MacroPlan/Method_DoASyncCreateLog.qbl b/_Main/BL/Type_MacroPlan/Method_DoASyncCreateLog.qbl
deleted file mode 100644
index 615b14d..0000000
--- a/_Main/BL/Type_MacroPlan/Method_DoASyncCreateLog.qbl
+++ /dev/null
@@ -1,8 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method DoASyncCreateLog (
-  GlobalOTDTable globalOTDTable
-)
-{
-  TextBody: 'Global_BrokerExecuteLog::CreateInOperation( globalOTDTable, "DataDistribution", "" );'
-}
diff --git "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043896.qbl" "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043896.qbl"
index b543dcf..fc549a7 100644
--- "a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043896.qbl"
+++ "b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync\043896.qbl"
@@ -6,7 +6,7 @@
   Boolean isKeyProduct,
   Boolean createPurchaseSupplyMaterial,
   const GlobalOTDTable globalOTDTable
-)
+) as stream[MacroPlan]
 {
   Description: '鍗曟鍚屾'
   TextBody:
@@ -17,5 +17,7 @@
         businessTypes := businessTypeStr.Tokenize( ',' );
     }
     MacroPlan::DoASync( macroPlan, businessTypes, isKeyProduct, createPurchaseSupplyMaterial ,globalOTDTable);
+    
+    return emit( macroPlan );
   *]
 }
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync.qbl
index f0f1769..4fb0a6b 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoASync.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoASync.qbl
@@ -13,13 +13,13 @@
     info( scenario.DatasetMDSID(), "    浜嬩笟閮細", businessTypeStr, "    isKeyProduct锛�", isKeyProduct, "    createPurchaseSupplyMaterial锛�", createPurchaseSupplyMaterial );
     
     MDSMacroPlan::Root( scenario.DatasetMDSID() )
-    //-> DoASyncCreateLog( globalOTDTable )
     -> MacroPlan::DoASync( businessTypeStr,
                            isKeyProduct,
                            createPurchaseSupplyMaterial,
                            globalOTDTable
                           )
+    -> MacroPlan::DoASyncSuccess( scenario.DatasetMDSID() )
     -> Exception()
-    -> MacroPlan::DoASyncOnException( globalOTDTable );
+    -> MacroPlan::DoASyncOnException( globalOTDTable, scenario.DatasetMDSID() );
   *]
 }
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncOnException.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncOnException.qbl
index 92fef0b..13d9e8c 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncOnException.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncOnException.qbl
@@ -2,12 +2,18 @@
 #parent: #root
 StaticMethod DoASyncOnException (
   Exception exception,
-  GlobalOTDTable globalOTDTable
+  GlobalOTDTable globalOTDTable,
+  Key macroPlanMDSID
 )
 {
   TextBody:
   [*
-    Global_BrokerExecuteLog::CreateInOperation( globalOTDTable, "DataDistribution", "" );
-    globalOTDTable.SettingFailureDetails( exception.ErrorNumber(), exception.Message(), "DataDistribution", "鏁版嵁鍒嗗彂" );
+    options := DatasetFindOptions::Construct( "GlobalOTDLog" ).IncludeOffline( true );
+    
+    mdskey := DatasetController::FindUnique( options );
+    
+    MDSGlobalOTDLog::Root( mdskey ) -> DataDistributionLog::OnError( macroPlanMDSID, 
+                                                                     exception.ErrorNumber(), 
+                                                                     exception.Message() );
   *]
 }
diff --git a/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncSuccess.qbl b/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncSuccess.qbl
index dfc34f1..b045feb 100644
--- a/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncSuccess.qbl
+++ b/_Main/BL/Type_MacroPlan/StaticMethod_DoASyncSuccess.qbl
@@ -1,12 +1,16 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod DoASyncSuccess (
-  Void void,
-  GlobalOTDTable globalOTDTable
+  MacroPlan macroPlan,
+  Key macroPlanMDSID
 )
 {
   TextBody:
   [*
-    // hongjli Oct-15-2023 (created)
+    options := DatasetFindOptions::Construct( "GlobalOTDLog" ).IncludeOffline( true );
+    
+    mdskey := DatasetController::FindUnique( options );
+    
+    MDSGlobalOTDLog::Root( mdskey ) -> DataDistributionLog::OnSuccess( macroPlanMDSID );
   *]
 }
diff --git a/_Main/Sys/ImgAttr/DataDistributionLog.dme b/_Main/Sys/ImgAttr/DataDistributionLog.dme
new file mode 100644
index 0000000..322f0c9
--- /dev/null
+++ b/_Main/Sys/ImgAttr/DataDistributionLog.dme
@@ -0,0 +1,31 @@
+Quintiq file version 2.0
+#parent: #root
+TypeDataInterface DataDistributionLog
+{
+  TypeKey: '[414702.1.153774695]'
+  ImageDataMember ImgExecuteStatus
+  {
+    #keys: '1[414702.1.154090897]'
+    ImageSpecifications:
+    [
+      ImageDataMemberImageSpecification
+      {
+        Image: 'MEDIA_PLAY_GREEN'
+        Quill: 'object.ExecuteStatus() = "Running"'
+        Value: 'Running'
+      }
+      ImageDataMemberImageSpecification
+      {
+        Image: 'CHECK'
+        Quill: 'object.ExecuteStatus() = "Success"'
+        Value: 'Success'
+      }
+      ImageDataMemberImageSpecification
+      {
+        Image: 'DELETE2'
+        Quill: 'object.ExecuteStatus() = "Error"'
+        Value: 'Error'
+      }
+    ]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_cmTestAttempt.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_cmTestAttempt.def
index 9dd6fd4..05a14f4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_cmTestAttempt.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_cmTestAttempt.def
@@ -23,7 +23,7 @@
       Properties:
       [
         Image: 'PIG'
-        Taborder: 5
+        Taborder: 6
         Title: '骞村害浜ч攢澶嶇洏'
       ]
     }
@@ -56,7 +56,7 @@
       Properties:
       [
         Separator: true
-        Taborder: 4
+        Taborder: 5
       ]
     }
     Component mnDockingERPForPRRelease
@@ -70,6 +70,17 @@
         Title: '瀵规帴ERP杩涜PR閲婃斁'
       ]
     }
+    Component mnDataDistribution
+    {
+      #keys: '[414702.1.155392180]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'PALM_TREE'
+        Taborder: 4
+        Title: '鏁版嵁鍒嗗彂'
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_cmTestAttempt_mnDataDistribution_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_cmTestAttempt_mnDataDistribution_OnClick.def
new file mode 100644
index 0000000..bd5095a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_TIANMA_JITUAN_cmTestAttempt_mnDataDistribution_OnClick.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: cmTestAttempt/mnDataDistribution
+Response OnClick () id:Response_TIANMA_JITUAN_cmTestAttempt_mnDataDistribution_OnClick
+{
+  #keys: '[414702.1.156607596]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebMenu_OnClick'
+  GroupServerCalls: true
+  QuillAction
+  {
+    Body:
+    [*
+      ApplicationScope.ViewManager().ResetUserViewById( "鏁版嵁鍒嗗彂", true );
+    *]
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def
index f2e440f..fcba155 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_DialogDataDistribution/Response_pnlActions_btnOk_OnClick.def
@@ -4,6 +4,26 @@
 {
   #keys: '[414702.1.84941735]'
   DefinitionID: 'Responsedef_WebButton_OnClick'
+  Precondition:
+  [*
+    flag := not isnull( GlobalOTDTable ) and not isnull( GlobalOTDLog );
+    
+    activeScenario := DataHolderActiveScenario.Data();
+    currentScenario := DataHolderScenario.Data();
+    
+    if ( activeScenario = currentScenario ) {
+      flag := false;
+      feedback := "鏃犳硶瀵瑰綋鍓嶉�変腑鍦烘櫙杩涜鍒嗗彂";
+    }
+    
+    isExists := exists( GlobalOTDLog, DataDistributionLog, tempDD, tempDD.ExecuteStatus() = "Running" and tempDD.MacroPlanMDSID() = currentScenario.DatasetMDSID() );
+    if ( flag and isExists ) {
+      flag := false;
+      feedback := "褰撳墠鍦烘櫙姝e湪杩涜鍒嗗彂";
+    }
+    
+    return flag;
+  *]
   QuillAction
   {
     Body:
@@ -16,7 +36,7 @@
                               b.ScenarioName() = dropDownStringListGeneral.Text()
                              );
       
-      //Global_BrokerExecuteLog::CreateInOperation( GlobalOTDTable, "DataDistribution", ApplicationMacroPlanner.GetUserName() );
+      DataDistributionLog::Create( GlobalOTDLog, ApplicationMacroPlanner.GetUserName(), DataHolderScenario.Data().DatasetMDSID(), DataHolderScenario.Data().Name() );
       MacroPlan::DoASync( DataHolderScenario.Data(), 
                           businessType.BusinessTypeName(),
                           checkboxIsKeyProduct.Checked(), 
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_ListDataDistributionLog.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_ListDataDistributionLog.def
new file mode 100644
index 0000000..56c7d3f
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_ListDataDistributionLog.def
@@ -0,0 +1,59 @@
+Quintiq file version 2.0
+Component ListDataDistributionLog
+{
+  #keys: '[414702.1.155206692]'
+  BaseType: 'WebList'
+  Children:
+  [
+    Component DataExtractorDataDistributionLog
+    {
+      #keys: '[414702.1.155206693]'
+      BaseType: 'WebDataExtractor'
+      Properties:
+      [
+        DataType: 'GlobalOTDLog'
+        Source: 'GlobalOTDLog'
+        Taborder: 0
+        Transformation: 'DataDistributionLog'
+      ]
+    }
+    #child: listActionBarPageDataDistributionLog
+    Component DataSetLevelDataDistributionLog
+    {
+      #keys: '[414702.1.155206698]'
+      BaseType: 'WebDataSetLevel'
+      Children:
+      [
+        #child: listContextMenuDataDistributionLog
+      ]
+      Properties:
+      [
+        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgExecuteStatus","title":"ImgExecuteStatus","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgExecuteStatus"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ExecuteUser","title":"鎵ц鐢ㄦ埛","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ExecuteUser"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"MacroPlanMDSID","title":"MacroPlanMDSID","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"MacroPlanMDSID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ErrorNo","title":"閿欒鍙�","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ErrorNo"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ErrorMessage","title":"閿欒娑堟伅","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ErrorMessage"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ScenarioName","title":"鍦烘櫙鍚嶇О","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"ScenarioName"}}]'
+        ContextMenu: 'listContextMenuDataDistributionLog'
+        Taborder: 2
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 0
+  ]
+  ResponseDefinitions:
+  [
+    DelegatedResponseDefinition OnClick id:Responsedef_ListDataDistributionLog_WebMenu_OnClick
+    {
+      #keys: '[414702.1.156607910]'
+      Initiator: 'WebMenu'
+      IsInherited: false
+      ResponseType: 'OnClick'
+      Arguments:
+      [
+        ResponseDefinitionArgument selection
+        {
+          #keys: '[373.0.2183601]'
+          Binding: 'this.Selection()'
+        }
+      ]
+    }
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listActionBarPageDataDistributionLog.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listActionBarPageDataDistributionLog.def
new file mode 100644
index 0000000..4784630
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listActionBarPageDataDistributionLog.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component listActionBarPageDataDistributionLog
+{
+  #keys: '[414702.1.155206695]'
+  BaseType: 'listActionBarPage'
+  Properties:
+  [
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listContextMenuDataDistributionLog.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listContextMenuDataDistributionLog.def
new file mode 100644
index 0000000..da61870
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Component_listContextMenuDataDistributionLog.def
@@ -0,0 +1,36 @@
+Quintiq file version 2.0
+Component listContextMenuDataDistributionLog
+{
+  #keys: '[414702.1.155206700]'
+  BaseType: 'listContextMenu'
+  Children:
+  [
+    Component MenuDelete
+    {
+      #keys: '[414702.1.155342244]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'DELETE'
+        Taborder: 3
+        Title: '鍒犻櫎'
+      ]
+    }
+    Component MenuSelectionAll
+    {
+      #keys: '[414702.1.156679633]'
+      BaseType: 'WebMenu'
+      Properties:
+      [
+        Image: 'SELECTION'
+        Shortcut: 'Ctrl+A'
+        Taborder: 4
+        Title: '鍏ㄩ��'
+      ]
+    }
+  ]
+  Properties:
+  [
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuDelete_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuDelete_OnClick.def
new file mode 100644
index 0000000..5a819e4
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuDelete_OnClick.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: ListDataDistributionLog
+Response OnClick (
+  DataDistributionLog selection
+) id:Response_ListDataDistributionLog_MenuDelete_OnClick
+{
+  #keys: '[414702.1.156508213]'
+  DefinitionID => /ListDataDistributionLog/Responsedef_ListDataDistributionLog_WebMenu_OnClick
+  Initiator: 'MenuDelete'
+  QuillAction
+  {
+    Body:
+    [*
+      selection.Delete();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuSelectionAll_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuSelectionAll_OnClick.def
new file mode 100644
index 0000000..1dc8b1a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/Response_ListDataDistributionLog_MenuSelectionAll_OnClick.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#parent: ListDataDistributionLog
+Response OnClick () id:Response_ListDataDistributionLog_MenuSelectionAll_OnClick
+{
+  #keys: '[414702.1.156679773]'
+  CanBindMultiple: false
+  DefinitionID => /ListDataDistributionLog/Responsedef_ListDataDistributionLog_WebMenu_OnClick
+  Initiator: 'MenuSelectionAll'
+  QuillAction
+  {
+    Body:
+    [*
+      this.SelectAll();
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/_ROOT_Component_FormDataDistributionLog.def b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/_ROOT_Component_FormDataDistributionLog.def
new file mode 100644
index 0000000..4e8269a
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormDataDistributionLog/_ROOT_Component_FormDataDistributionLog.def
@@ -0,0 +1,17 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent FormDataDistributionLog
+{
+  #keys: '[414702.1.154060867]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: ListDataDistributionLog
+  ]
+  Properties:
+  [
+    Image: 'MUSHROOM'
+    Title: '鏁版嵁鍒嗗彂鏃ュ織'
+  ]
+}
diff --git "a/_Main/UI/MacroPlannerWebApp/Views/\346\225\260\346\215\256\345\210\206\345\217\221.vw" "b/_Main/UI/MacroPlannerWebApp/Views/\346\225\260\346\215\256\345\210\206\345\217\221.vw"
new file mode 100644
index 0000000..0747398
--- /dev/null
+++ "b/_Main/UI/MacroPlannerWebApp/Views/\346\225\260\346\215\256\345\210\206\345\217\221.vw"
@@ -0,0 +1,250 @@
+Quintiq file version 2.0
+{
+  viewcontents
+  {
+    forms
+    {
+      form_FormBusinessType
+      {
+        title: 'QTIANMA_JITUAN::FormBusinessType'
+        shown: true
+        componentID: 'QTIANMA_JITUAN::FormBusinessType'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 15
+          columnPosition: 1
+          columnSpan: 4
+        }
+        components
+        {
+          FormBusinessType_ListBusinessType
+          {
+          }
+          FormBusinessType_DataSetLevelBusinessType
+          {
+            groupDepth: -1
+            sort: 'ScenarioName'
+            column_BusinessTypeName
+            {
+              columnId: 'BusinessTypeName'
+              dataPath: 'BusinessTypeName'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+            column_DisplayType
+            {
+              columnId: 'DisplayType'
+              dataPath: 'DisplayType'
+              dataType: 'string'
+              index: 1
+              subtotals: ''
+              width: 147
+            }
+            column_ScenarioName
+            {
+              columnId: 'ScenarioName'
+              dataPath: 'ScenarioName'
+              dataType: 'string'
+              index: 2
+              subtotals: ''
+              width: 150
+            }
+          }
+          FormBusinessType_PanelBusinessType
+          {
+            sizeRatio: 1
+          }
+          FormBusinessType_ListOrganCode
+          {
+          }
+          FormBusinessType_DataSetLevelOrganCode
+          {
+            groupDepth: -1
+            column_OrganCodeName
+            {
+              columnId: 'OrganCodeName'
+              dataPath: 'OrganCodeName'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 150
+            }
+          }
+        }
+      }
+      form_FormScenarioManager
+      {
+        title: 'QLibMacroPlannerWebUI::FormScenarioManager'
+        shown: true
+        componentID: 'QLibMacroPlannerWebUI::FormScenarioManager'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 8
+          columnPosition: 5
+          columnSpan: 8
+        }
+        components
+        {
+          FormScenarioManager_ListScenario
+          {
+          }
+          FormScenarioManager_DataSetLevelScenario
+          {
+            groupDepth: -1
+            column_All_constraints
+            {
+              columnId: 'All constraints'
+              dataPath: 'All constraints'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 100
+            }
+            column_Name
+            {
+              columnId: 'Name'
+              dataPath: 'Name'
+              dataType: 'string'
+              index: 1
+              subtotals: ''
+              width: 150
+            }
+            column_ChangedBy
+            {
+              columnId: 'ChangedBy'
+              dataPath: 'ChangedBy'
+              dataType: 'string'
+              index: 2
+              subtotals: ''
+              width: 150
+            }
+            column_ChangedOn
+            {
+              columnId: 'ChangedOn'
+              dataPath: 'ChangedOn'
+              dataType: 'datetime'
+              index: 3
+              subtotals: ''
+              width: 150
+            }
+            column_StorageMode
+            {
+              columnId: 'StorageMode'
+              dataPath: 'StorageMode'
+              dataType: 'string'
+              index: 4
+              subtotals: ''
+              width: 150
+            }
+            column_ImgOptimizerStatus
+            {
+              columnId: 'ImgOptimizerStatus'
+              dataPath: 'ImgOptimizerStatus'
+              dataType: 'string'
+              index: 5
+              subtotals: ''
+              width: 150
+            }
+          }
+        }
+      }
+      form_FormDataDistributionLog
+      {
+        title: 'QTIANMA_JITUAN::FormDataDistributionLog'
+        shown: true
+        componentID: 'QTIANMA_JITUAN::FormDataDistributionLog'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 9
+          rowSpan: 7
+          columnPosition: 5
+          columnSpan: 8
+        }
+        components
+        {
+          FormDataDistributionLog_ListDataDistributionLog
+          {
+          }
+          FormDataDistributionLog_DataSetLevelDataDistributionLog
+          {
+            groupDepth: -1
+            column_ImgExecuteStatus
+            {
+              columnId: 'ImgExecuteStatus'
+              dataPath: 'ImgExecuteStatus'
+              dataType: 'string'
+              index: 0
+              subtotals: ''
+              width: 42
+            }
+            column_ExecuteUser
+            {
+              columnId: 'ExecuteUser'
+              dataPath: 'ExecuteUser'
+              dataType: 'string'
+              index: 1
+              subtotals: ''
+              width: 115
+            }
+            column_MacroPlanMDSID
+            {
+              columnId: 'MacroPlanMDSID'
+              dataPath: 'MacroPlanMDSID'
+              dataType: 'string'
+              index: 2
+              subtotals: ''
+              width: 132
+            }
+            column_ErrorNo
+            {
+              columnId: 'ErrorNo'
+              dataPath: 'ErrorNo'
+              dataType: 'number'
+              index: 3
+              subtotals: ''
+              width: 150
+            }
+            column_ErrorMessage
+            {
+              columnId: 'ErrorMessage'
+              dataPath: 'ErrorMessage'
+              dataType: 'string'
+              index: 4
+              subtotals: ''
+              width: 150
+            }
+            column_ScenarioName
+            {
+              columnId: 'ScenarioName'
+              dataPath: 'ScenarioName'
+              dataType: 'string'
+              index: 5
+              subtotals: ''
+              width: 150
+            }
+          }
+        }
+      }
+    }
+    userconfigurableinformation
+    {
+    }
+    page: ''
+    group: ''
+    index: 0
+    image: 'PALM_TREE'
+    description: ''
+  }
+  formatversion: 2
+  id: '鏁版嵁鍒嗗彂'
+  name: '鏁版嵁鍒嗗彂'
+  isglobal: false
+  isroot: true
+}

--
Gitblit v1.9.3