Browse Source

修改报告多样品导出是选择不了样品BUG

zhangjiaxin 3 years ago
parent
commit
a0a453a30c

+ 2 - 1
OTSIncAReportApp/1-UI/Control_Grids/ResultGrid.cs

@@ -93,7 +93,8 @@ namespace OTSIncAReportGrids
         /// <returns></returns>
         public Dictionary<string, string> GetData_ResultGrid()
         {
-            ResultFile resfile = m_frmReportApp.m_rstDataMgr.ResultFilesList[m_frmReportApp.m_rstDataMgr.GetWorkingResult()];
+            ResultFile resfile = m_frmReportApp.m_rstDataMgr.ResultFilesList[m_frmReportApp.m_rstDataMgr.getSelectedIndex()];
+           
             Dictionary<string, string> keyValues = new Dictionary<string, string>() { };
             keyValues.Add(table["col1"].ToString(), resfile.FileName);
 

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

@@ -118,7 +118,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             dt.Columns.Add("TypeId");
             dt.Columns.Add("Hardness", typeof(double));
             dt.Columns.Add("Hardness_detailed");
-            ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()];
+            ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()];
             string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
             
             OTSSysMgrTools.SqLiteHelper sh = new OTSSysMgrTools.SqLiteHelper("data source='" + System.IO.Directory.GetCurrentDirectory()+ "\\Config\\SysData\\"+ str_libraryName + ".db" + "'");
@@ -145,7 +145,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             m_bt_DBData.Clear();
             m_bt_DBData.Columns.Clear();
-            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
             List<string> colid = new List<string>() { "TypeName", "ar", "TypeId", "Largest", "Class", "con" };
             //获取粒级表
             string path1 = m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFileFolder + m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.PartSizeFile;
@@ -259,14 +259,14 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
 
             //根据sql条件,查询获取颗粒信息数据
-            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
             DataTable dt = InvalidRemoval(fielddata.GetIncaSurfaceData(),"TypeName") ;
             //将颗粒大小排序(从大到小)
             DataView dv = dt.DefaultView;
             dv.Sort = "DMAX DESC";
             DataTable dt_ParticlesGridDevidePage = dv.ToTable();
 
-            string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath;
+            string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath;
             //------------------加载模块,获取数据结束----------------------------------------------
             #region 创建要插入数据库表结构
             //插入模板需父子表,结构
@@ -632,7 +632,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             m_otsreport_export.m_ReportApp.im_ParticlesGridDevidePage = new ParticlesGridDevidePage(m_otsreport_export.m_ReportApp);
 
             //根据sql条件,查询获取颗粒信息数据
-            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
             DataTable dt = InvalidRemoval(fielddata.GetIncaSurfaceData(), "TypeName");
 
             dt.Columns.Add("Hardness", typeof(double));
@@ -655,7 +655,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             dv.Sort = "Hardness DESC";
             DataTable dt_ParticlesGridDevidePage = dv.ToTable();
 
-            string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath;
+            string str_resultPath = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath;
             //------------------加载模块,获取数据结束----------------------------------------------
             #region 创建要插入数据库表结构
             //插入模板需父子表,结构
@@ -1114,7 +1114,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     DataRow dr = FrameGraphSubTable.NewRow();
                     dr["p1"] = newarr_p1;
                     newms_p1.Dispose();
-                    ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()];
+                    ResultFile resfile = m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()];
                     if (((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["SysType"].ToString() == "0:IncA")
                     {
                         dr["pid"] = str_fieldid + dt_ParticlesGridDevidePage.Rows[i_row]["particleid"].ToString();
@@ -1196,7 +1196,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 double d = Convert.ToDouble(sizestr.Split(',')[sizestr.Split(',').Length - 1]);
                 colid.Add(d.ToString() + "~MAX");
 
-                ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+                ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
 
                 //------------------------------------------------
                 DataTable ls_partsize_dt = new DataTable();
@@ -1556,7 +1556,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             }
 
             //根据sql条件,查询获取颗粒信息数据
-            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
           
             DataTable AllAnalysisDetails = new DataTable();
             AllAnalysisDetails.TableName = "ElementValue";
@@ -1945,7 +1945,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         {
 
             //根据sql条件,查询获取颗粒信息数据
-            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath);
             //DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
 
             DataTable AreaInformationOfAllElements = InvalidRemoval(InvalidRemoval(fielddata.GetAreaByAllIncA(""), "GroupName"),"TypeName") ;

+ 4 - 2
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -29,6 +29,7 @@ namespace OTSIncAReportApp
         public string m_strDBpath = "";                                 //报表模板数据库文件
         public string m_strDBpathGB = "";                               //报告国标导出
         public string m_strDBpath_ParticleList = "";                    //报表模板,颗粒列表数据库文件
+        public int m_SelectedIndex = 0;
         System.Collections.Hashtable table;
         public frmReportApp m_ReportApp = null;                         //报告项目总进程对象
         public string m_export_type = "Excel";                          //导出文件的格式类型Excel,Word,Pdf
@@ -1145,7 +1146,8 @@ namespace OTSIncAReportApp
                     return;
                 }
             }
-
+            m_ReportApp.m_rstDataMgr.setSelectedIndex(cbo_sjy.SelectedIndex);
+            
             //重新导出报表数据
             m_ReportApp.m_ChartsWindow.Activate();
 
@@ -1503,7 +1505,7 @@ namespace OTSIncAReportApp
 
                 //-----------------------------------------------------------------------------------------------------------------------------------
                 ////插入标记帧部份,进行特殊处理,从硬盘中拿现已经生成好的标记图像,进行加载,然后转成byte数组,存入到数据库中                ////准备存放标记图的文件夹
-                string m_strFieldPath_Mark = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath + "\\FIELD_FILES_MARK\\";
+                string m_strFieldPath_Mark = m_ReportApp.m_rstDataMgr.ResultFilesList[m_ReportApp.m_rstDataMgr.getSelectedIndex()].FilePath + "\\FIELD_FILES_MARK\\";
 
                 //插入 field_dt
                 if (JudgeWhetherTheTableExists(list_dt, "field_dt"))

+ 9 - 0
OTSIncAReportApp/2-CommonFunction/OTSDataMgrFunction/ResultDataMgr.cs

@@ -30,6 +30,7 @@ namespace OTSIncAReportApp.OTSDataMgrFunction
         public CReportMgrClr m_ReportMgr;
         private List<ResultFile> resultFilesList = new List<ResultFile>();   //测量结果列表
         private int workingResult = -1;
+        private int SelectedIndex = 0;
         public DataOperation.Model.RptConfigFile m_RptConfigFile = new DataOperation.Model.RptConfigFile(Application.StartupPath +m_ReportMgrParamFile);         //报表程序的配置文件
         #endregion
 
@@ -48,6 +49,14 @@ namespace OTSIncAReportApp.OTSDataMgrFunction
             workingResult = value;
             m_curResultFile = resultFilesList[value];
         }
+        public void setSelectedIndex(int value)
+        {
+            SelectedIndex = value;
+        }
+        public int getSelectedIndex()
+        {
+            return SelectedIndex;
+        }
 
         public List<ResultFile> ResultFilesList { get => resultFilesList; set => resultFilesList = value; }
         public ResultFile CurResultFile { get => m_curResultFile; set => m_curResultFile = value; }