Browse Source

报告添加结果路径搜索作为标准库的第一选择项

cxs 1 year ago
parent
commit
c16cb3662b

+ 1 - 1
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -210,7 +210,7 @@ namespace OTSIncAReportGrids
                 if (systype == OTSCommon.Model.OTS_SysType_ID.CleannessA)
                 {
                     string str_libraryName = result.GetSTDName();
-                    userLibrary = new UserLibraryData(str_libraryName);
+                    userLibrary = new UserLibraryData(str_libraryName,result.FilePath+"\\");
                     if (userLibrary.GetSqlHelper() != null)
                     {
                         userLibraryData = userLibrary.GetSubAttributeFromDatabase();

+ 18 - 1
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -177,7 +177,24 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             dt.Columns.Add("Hardness_detailed");
             
             
-            OTSCommon.SqLiteHelper sh = new OTSCommon.SqLiteHelper("data source='" + System.IO.Directory.GetCurrentDirectory()+ "\\Config\\SysData\\"+ str + ".db" + "'");
+            OTSCommon.SqLiteHelper sh = null;
+            string fullPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.CurResultFile.FilePath + str + ".db";
+            string fullPath2 = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + str + ".db";
+            if (System.IO.File.Exists(fullPath))
+            {
+                sh = new OTSCommon.SqLiteHelper ("data source='" + fullPath + "'");
+            }
+            else if (System.IO.File.Exists(fullPath2))
+            {
+                sh = new OTSCommon.SqLiteHelper("data source='" + fullPath2 + "'");
+            }
+            else
+            {
+                sh = null;
+                data = null;
+                return;
+            }
+
             DataTable dt_stl= sh.ExecuteQuery("select * from ClassifySTD");
             for (int i=0;i< dt_stl.Rows.Count;i++)
             {

+ 1 - 1
OTSIncAReportApp/1-UI/frmReMeasure.cs

@@ -467,7 +467,7 @@ namespace OTSIncAReportApp
             }
             string str_libraryName = ReportFun.resultFile.GetSTDName();
             DataTable userLibraryData = new DataTable();
-            UserLibraryData userLibrary = new UserLibraryData(str_libraryName);
+            UserLibraryData userLibrary = new UserLibraryData(str_libraryName, ReportFun.resultFile.FilePath+"\\");
             if (userLibrary.GetSqlHelper() != null)
             {
                 userLibraryData = userLibrary.GetSubAttributeFromDatabase();

+ 8 - 3
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -792,22 +792,27 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
     {
         private SqlHelper dbHelper;
 
-        public UserLibraryData(string libraryName)
+        public UserLibraryData(string libraryName,string resultpath)
         {
             NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
             if (!libraryName.Contains(".db"))
             {
                 libraryName += ".db";
             }
-            string fullPath = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + libraryName;
+            string fullPath = resultpath + libraryName;
+            string fullPath2 = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + libraryName;
             if (System.IO.File.Exists(fullPath))
             {
                 dbHelper = new SqlHelper("data source='" + fullPath + "'");
             }
+            else if(System.IO.File.Exists(fullPath2))
+            {
+                dbHelper = new SqlHelper("data source='" + fullPath2 + "'");
+            }
             else
             {
                 dbHelper = null;
-                log.Error("Failed to load user-defined library_"+ fullPath+"!");
+                log.Error("Failed to load user-defined library"+ "!");
             }
         }