From b728f7bcf0d1c358acb836851893b412f153b837 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期四, 07 九月 2023 16:17:15 +0800
Subject: [PATCH] 修复全局数据集GlobalDTO

---
 _Main/BL/Type_GlobalDTOTable/StaticMethod_GetDatasetName.qbl   |    6 ++++++
 _Main/BL/Type_GlobalDTOTable/StaticMethod_GetLoadedDataset.qbl |   20 ++++++++++++++++++++
 _Main/BL/Type_GlobalDTOTable/StaticMethod_OnServerStartup.qbl  |   15 ++++++++++-----
 3 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/_Main/BL/Type_GlobalDTOTable/StaticMethod_GetDatasetName.qbl b/_Main/BL/Type_GlobalDTOTable/StaticMethod_GetDatasetName.qbl
new file mode 100644
index 0000000..4bf5e3a
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/StaticMethod_GetDatasetName.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDatasetName () as String
+{
+  TextBody: 'return typeof( GlobalDTOTable ).ShortName();'
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/StaticMethod_GetLoadedDataset.qbl b/_Main/BL/Type_GlobalDTOTable/StaticMethod_GetLoadedDataset.qbl
new file mode 100644
index 0000000..a3fae08
--- /dev/null
+++ b/_Main/BL/Type_GlobalDTOTable/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 := GlobalDTOTable::GetDatasetName();
+    
+    oinfo := MDSEditor::Editor().LoadedObjectInfo( datasetName, folder, datasetName );
+    
+    if(  not isnull( oinfo ) )
+    {
+      mds := oinfo.MDSID();
+    }  
+    
+    return &mds;
+  *]
+}
diff --git a/_Main/BL/Type_GlobalDTOTable/StaticMethod_OnServerStartup.qbl b/_Main/BL/Type_GlobalDTOTable/StaticMethod_OnServerStartup.qbl
index e8e18e6..a6b172d 100644
--- a/_Main/BL/Type_GlobalDTOTable/StaticMethod_OnServerStartup.qbl
+++ b/_Main/BL/Type_GlobalDTOTable/StaticMethod_OnServerStartup.qbl
@@ -4,19 +4,24 @@
 {
   TextBody:
   [*
-    debuginfo( '// =============================================================== Scenario manager =====================================================================')
+    debuginfo( '================================ MPDomainHandler =======================================')
     folder := DomainModel::Domain().MDSFolderDefinitions().FindFolder( "/root" );
     
-    oinfo := MDSEditor::Editor().ObjectInfos( "GlobalDTOTable", folder.FolderID(), "GlobalDTOTable" );
+    datasetName := GlobalDTOTable::GetDatasetName();
+    
+    oinfo := MDSEditor::Editor().ObjectInfos( datasetName, folder.FolderID(), datasetName );
     
     o := select( oinfo, Elements, o, not o.IsLoaded() );
-    if( isnull( o ) )
+    emptydataset := isnull( o );
+    
+    if( emptydataset )
     {
-      MDSScenarioManager::CreateMDS( "GlobalDTOTable", GlobalParameters_MP::GetStorageState() );
+      MDSGlobalDTOTable::CreateMDS( datasetName, GlobalParameters_MP::GetStorageState() );
+      GlobalDTOTable::GetLoadedDataset();
     }
     else
     {
-      MDSScenarioManager::LoadMDSAndConvert( o.MDSID(), GlobalParameters_MP::GetStorageState() );
+      MDSGlobalDTOTable::LoadMDSAndConvert( o.MDSID(), GlobalParameters_MP::GetStorageState() );
     }
   *]
 }

--
Gitblit v1.9.3