瀏覽代碼

修改报告多个样品切换失效的BUG

zhangjiaxin 3 年之前
父節點
當前提交
d93046019f

+ 1 - 1
OTSIncAReportApp/1-UI/Control_ECharts/EChart_ParticlesComposition.cs

@@ -360,7 +360,7 @@ namespace OTSIncAReportApp.Control_ECharts
 
             //------------------加载模块,获取数据-------------------------------------------------
             ResultGrid ls_resultgrid = new ResultGrid(m_ReportApp);
-            Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid();
+            Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid_Report();
             //------------------加载模块,获取数据结束----------------------------------------------
             Dictionary<string, string>.Enumerator en = keyValues_ResultGrid.GetEnumerator();
          

+ 13 - 2
OTSIncAReportApp/1-UI/Control_ECharts/EChart_Trianglediagram.cs

@@ -35,6 +35,7 @@ namespace OTSIncAReportApp.Control_ECharts
         frmReportApp m_ReportApp;
         frmReportConditionChoose m_condition;
         ResultDataMgr m_DataMgr;
+        private bool ReportExporting = false;
         #endregion
 
         #region 构造函数及窗体加载
@@ -72,7 +73,7 @@ namespace OTSIncAReportApp.Control_ECharts
             m_ReportApp = ReportApp;
             m_condition = ReportApp.m_conditionChoose;
             m_DataMgr = ReportApp.m_rstDataMgr;
-
+            ReportExporting = true;
             InitializeComponent();
         }
         private void EChart_Trianglediagram_Load(object sender, EventArgs e)
@@ -140,7 +141,17 @@ namespace OTSIncAReportApp.Control_ECharts
                     m_ReportApp.trans = true;
                 }
                 m_ReportApp.more = false;
-                DataOperation.Model.ResultFile resultFile = m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()];
+
+                DataOperation.Model.ResultFile resultFile;
+                if (ReportExporting)
+                {
+                     resultFile = m_DataMgr.ResultFilesList[m_DataMgr.getSelectedIndex()];
+                }
+                else
+                {
+                     resultFile = m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()];
+                }
+                ReportExporting = false;
                 TriangleJsonClass cl = GettriangleJsonClass(resultFile.FilePath, resultFile.FileName, nameList, TemplateName);
                 m_list_trianglejsonclass.Add(cl);
             }

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

@@ -83,6 +83,8 @@ namespace OTSIncAReportGrids
             }
             else
             {
+                //int item= (int)m_frmReportApp.m_conditionChoose.m_SourceGridData.GetPropItemDisplayValueByPropItem(OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE);
+                //m_frmReportApp.m_rstDataMgr.SetWorkingResult(item);
                 addGrid(m_frmReportApp.m_rstDataMgr.ResultFilesList[m_frmReportApp.m_rstDataMgr.GetWorkingResult()]);
             }
         }
@@ -93,7 +95,7 @@ namespace OTSIncAReportGrids
         /// <returns></returns>
         public Dictionary<string, string> GetData_ResultGrid()
         {
-            ResultFile resfile = m_frmReportApp.m_rstDataMgr.ResultFilesList[m_frmReportApp.m_rstDataMgr.getSelectedIndex()];
+            ResultFile resfile = m_frmReportApp.m_rstDataMgr.ResultFilesList[m_frmReportApp.m_rstDataMgr.GetWorkingResult()];
            
             Dictionary<string, string> keyValues = new Dictionary<string, string>() { };
             keyValues.Add(table["col1"].ToString(), resfile.FileName);
@@ -168,6 +170,83 @@ namespace OTSIncAReportGrids
             return keyValues;
         }
 
+        public Dictionary<string, string> GetData_ResultGrid_Report()
+        {
+            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);
+
+            string path = resfile.FilePath;
+            FieldData fielddata = new FieldData(path);
+            DataTable dt = fielddata.GetGeneralInfo();
+            DateTime star = new DateTime();
+            DateTime end = new DateTime();
+
+            System.Globalization.DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo();
+            dtFormat.ShortDatePattern = "dd/MM/yyyy hh:mm:ss";
+
+            if (dt.Rows.Count > 0)
+            {
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    if (dt.Rows[i]["name"].ToString() == "TimeStart")
+                    {
+                        star = Convert.ToDateTime(dt.Rows[i]["value"], dtFormat);
+                    }
+                    if (dt.Rows[i]["name"].ToString() == "TimeEnd")
+                    {
+                        end = Convert.ToDateTime(dt.Rows[i]["value"], dtFormat);
+                    }
+                }
+
+            }
+            TimeSpan timeSpan = end - star;
+
+            int filedCount = fielddata.GetFiledCount();
+            Dictionary<string, object> sampleMembers = ((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"]);
+            Dictionary<string, object> semDataMsr = (Dictionary<string, object>)sampleMembers["SEMDataMsr"];
+            double scanFieldSize = Convert.ToDouble(semDataMsr["ScanFieldSize"]);
+            Dictionary<string, object> imageScanParam = (Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)sampleMembers["MsrParams"])["Members"])["ImageScanParam"];
+            string ImageResolution = imageScanParam["ImageResolution"].ToString();
+            double wide = Convert.ToDouble(ImageResolution.Split('_')[1]);
+            double high = Convert.ToDouble(ImageResolution.Split('_')[2]);
+            double pixelSize = scanFieldSize / wide;
+            double filedsArea = Math.Round(high * wide * pixelSize * pixelSize * filedCount, 2);
+            int particleArea = fielddata.GetparticleArea();
+
+            double ratio = particleArea / filedsArea;
+
+            //报告参数文件
+            string xmlpath = Application.StartupPath + m_frmReportApp.m_OTSReportMgrParamFile;
+            DataSet ds = XMLoperate.GetXmlData(xmlpath, "XMLData");
+            DataTable dt1 = ds.Tables["Member"];
+            string sizestr = "1000";
+            for (int i = 0; i < dt1.Rows.Count; i++)
+            {
+                if (dt1.Rows[i]["RegName"].ToString() == "Scale")
+                {
+                    sizestr = dt1.Rows[i]["strValue"].ToString();
+                    break;
+                }
+            }
+
+            keyValues.Add(table["col2"].ToString(), star.ToString("yyyy-MM-dd HH:mm:ss"));
+            keyValues.Add(table["col3"].ToString(), end.ToString("yyyy-MM-dd HH:mm:ss"));
+            keyValues.Add(table["col4"].ToString(), Math.Round(timeSpan.TotalMinutes, 2).ToString() + "mins");
+            keyValues.Add(table["col5"].ToString(), filedCount.ToString());
+
+            keyValues.Add(table["col6"].ToString(), ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)resfile.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString());
+            keyValues.Add(table["col7"].ToString(), fielddata.GetparticleCount().ToString());
+            keyValues.Add(table["col8"].ToString(), filedsArea.ToString());
+            keyValues.Add(table["col9"].ToString(), particleArea.ToString());
+            keyValues.Add(table["col10"].ToString(), ratio.ToString());
+
+            keyValues.Add(table["col11"].ToString(), sizestr);
+
+            return keyValues;
+        }
+
         /// <summary>
         /// 绑定GridView显示
         /// </summary>

+ 11 - 0
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/OTSSampleReportInfo/OTSSampleReportInfo.cs

@@ -305,6 +305,17 @@ namespace OTSIncAReportApp.OTSSampleReportInfo
             }
             return -1;
         }
+        public object GetPropItemDisplayValueByPropItem(OTS_REPORT_PROP_GRID_ITEMS in_orpgi)
+        {
+            for (int i = 0; i < ConditionItemList.Count; i++)
+            {
+                if (ConditionItemList[i].iItemId == in_orpgi)
+                {
+                    return i;
+                }
+            }
+            return -1;
+        }
         public void SetPropByPropItemName(OTS_REPORT_PROP_GRID_ITEMS in_orpgi, string val)
         {
             int i = GetPropIndexByPropItemName(in_orpgi);

+ 4 - 4
OTSIncAReportApp/1-UI/OTSDisplaySourceGridData/frmReportConditionChoose.cs

@@ -291,9 +291,9 @@ namespace OTSIncAReportApp
       
                 sampleData = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE];
                 list.Add(sampleData);
-
+                m_ReportApp.m_rstDataMgr.SetWorkingResult((int)sampleData.itemVal);
                 //测量图类别 分布图 or 排列图
-    
+
                 sampleData = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.IMAGE_DISPLAY_TYPE];
                 list.Add(sampleData);
 
@@ -387,7 +387,7 @@ namespace OTSIncAReportApp
 
                 sampleData = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE];
                 list.Add(sampleData);
-
+                m_ReportApp.m_rstDataMgr.SetWorkingResult((int)sampleData.itemVal);
 
                 //数据表类型
                 var sampleData3 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.CALCULATE_TABLE_TYPE];
@@ -441,7 +441,7 @@ namespace OTSIncAReportApp
 
                 sampleData = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE];
                 list.Add(sampleData);
-
+                m_ReportApp.m_rstDataMgr.SetWorkingResult((int)sampleData.itemVal);
                 var sampleData1 = m_CurrentConditions[OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE_TYPE];
                 list.Add(sampleData1);
 

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

@@ -64,7 +64,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
            
                 //------------------加载模块,获取数据-------------------------------------------------
                 ResultGrid ls_resultgrid = new ResultGrid(m_otsreport_export.m_ReportApp);
-                Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid();
+                Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid_Report();
                 //------------------加载模块,获取数据结束----------------------------------------------
                 Dictionary<string, string>.Enumerator en = keyValues_ResultGrid.GetEnumerator();
                 string str_CLJGMC = "";

+ 3 - 1
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -40,7 +40,8 @@ namespace OTSIncAReportApp
         public XmlConfigUtil xmlutil;
         public XmlConfigUtil xmlutil2;
         public MBSZClass m_mbszclass = null;
-        
+        /*public bool ReportExporting = false;*///判断报告是不在是在导出的过程中
+
         #endregion
 
         #region 条件参数变量
@@ -66,6 +67,7 @@ namespace OTSIncAReportApp
 
         #endregion
 
+       
         #region 模板设置类
         /// <summary>
         /// 模板设置类