فهرست منبع

导出报告中,增加夹杂物面积比表格,

zhangjiaxin 3 سال پیش
والد
کامیت
7505b67391

+ 1 - 1
Bin/x64/Debug/Config/ProData/ReportTemplateConfig.xml

@@ -1,7 +1,7 @@
 <XmlConfig>
   <M_SY>
     <str_tb_ZBT>Inclusion Analysis </str_tb_ZBT>
-    <str_tb_FBT>立中合金实验室</str_tb_FBT>
+    <str_tb_FBT>东北大学</str_tb_FBT>
     <str_tb_YPBH>0001</str_tb_YPBH>
     <str_tb_CKBZ>GB/T30834-2014</str_tb_CKBZ>
     <b_ck_ypsm>True</b_ck_ypsm>

BIN
Bin/x64/Debug/Resources/ReportTemplate/group1.rmf


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

@@ -396,11 +396,12 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     if (str_subparticles != null && str_subparticles != "")
                     {
                         //合并大颗粒
-                        double ScanFieldSize = 1142;
-                        Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
-                        int pixw = tempbit.Width;
-                        double xs = pixw / ScanFieldSize;
-                        bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
+                        //double ScanFieldSize = 1142;
+                        //Bitmap tempbit = fielddata.ReadImageFile(str_imagePath);
+                        //int pixw = tempbit.Width;
+                        //double xs = pixw / ScanFieldSize;
+                        //bp_particle = fielddata.GetBitmapForBig(str_subparticles, xs, str_resultPath);
+                        continue;
                     }
                     else
                     {
@@ -678,13 +679,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     dr2["AllElements"] = AllElements;
                     ls_element_dt.Rows.Add(dr2);
                 }
-                //获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
-                double totalInclusionArea = 0;
-                for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
-                {
-                    totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
-                }
 
+                InclusionAreaRatio(ls_gv);
                 m_list_dt.Add(ls_elementname_dt);
                 m_list_dt.Add(ls_element_dt);
 
@@ -698,6 +694,39 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         }
         #endregion
 
+        private void InclusionAreaRatio(DataGridView ls_gv)
+        {
+            DataTable AreaRatio = new DataTable();
+            AreaRatio.TableName = "InclusionAreaRatio";
+            AreaRatio.Columns.Add("e1");
+            AreaRatio.Columns.Add("e2");
+            AreaRatio.Columns.Add("e3");
+            AreaRatio.Columns.Add("e4");
+            AreaRatio.Columns.Add("e5");
+
+
+            //获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
+            double totalInclusionArea = 0;
+            for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
+            {
+                totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
+            }
+
+
+            for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
+            {
+                DataRow dr = AreaRatio.NewRow();
+                dr["e1"] = (i + 1).ToString();
+                dr["e2"] = ls_gv.Rows[i].Cells[1].Value.ToString();
+                dr["e3"] = ls_gv.Rows[i].Cells[2].Value.ToString();
+                dr["e4"] = Math.Round((Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value)/ totalInclusionArea)*100,2);
+                dr["e5"] = Math.Round((Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value) / Convert.ToDouble( m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
+                AreaRatio.Rows.Add(dr);
+            }
+
+            m_list_dt.Add(AreaRatio);
+        }
+
         #region 插入颗粒图chart
         /// <summary>
         /// 用于颗粒图chart

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

@@ -1313,9 +1313,26 @@ namespace OTSIncAReportApp
                 string[] strcoltypes_PicSYXT3T = { "BLOB", "BLOB", "BLOB" };
                 sh.CreateTable("PicSYXT3T", strcolumns_PicSYXT3T, strcoltypes_PicSYXT3T);
 
+                //创建 颗粒面积比表
+                string[] strcolums_AreaRatio = { "c1", "c2", "c3", "c4", "c5" };
+                string[] strcoltypes_AreaRatio = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                sh.CreateTable("AreaRatio", strcolums_AreaRatio, strcoltypes_AreaRatio);
+
                 //将数据插入到数据库中
                 List<DataTable> list_dt = m_export_reporttemplate.m_list_dt;
-                DataTable ls_resultgrid = list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0];
+                DataTable ls_AreaRatio = list_dt.Where(aa => aa.TableName.Contains("InclusionAreaRatio")).ToList()[0];
+                for (int i = 0; i < ls_AreaRatio.Rows.Count; i++)
+                {
+                    string ls_sqlstr = "insert into AreaRatio (c1, c2, c3, c4, c5) values('"
+                       + ls_AreaRatio.Rows[i][0].ToString() + "','"
+                       + ls_AreaRatio.Rows[i][1].ToString() + "','"
+                       + ls_AreaRatio.Rows[i][2].ToString() + "','"
+                       + ls_AreaRatio.Rows[i][3].ToString() + "','"
+                       + ls_AreaRatio.Rows[i][4].ToString() + "')";
+                    int iresult = sh.ExecuteQueryResult(ls_sqlstr, tr);
+                }
+
+                    DataTable ls_resultgrid = list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0];
                 for (int i = 0; i < ls_resultgrid.Rows.Count; i++)
                 {
                     string ls_sqlstr = "insert into ResultGrid (CLJGMC, YXSJ, SCZS, FLFA, YJCTZ, SCMJ, CKBZ) values('"

+ 9 - 0
OTSIncAReportTemplate/OTSIncAReportTemplate.cs

@@ -195,6 +195,10 @@ namespace OTSIncAReportTemplate
             rmReport1.AddVariable("RM_YJ", m_mbszclass.M_YMYJ.str_tb_yjwb, true);
             #region 判断是否显示
 
+            DataTable ls_dt_AreaRatio = list_dt.Where(aa => aa.TableName.Contains("AreaRatio")).ToList()[0];
+            rmReport1.AddDataSet(ls_dt_AreaRatio, "AreaRatio");
+
+
             if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//判断三元相图是否显示
             {
                 rmReport1.FindObject("GroupHeader81").Prop["Visible"] = true;
@@ -902,6 +906,11 @@ namespace OTSIncAReportTemplate
             ls_Largest20.TableName = "Largest20";
             list_dt.Add(ls_Largest20);
 
+            DataTable ls_AreaRatio = sh.ExecuteQuery("select * from AreaRatio");
+            ls_AreaRatio.TableName = "AreaRatio";
+            list_dt.Add(ls_AreaRatio);
+
+
             //DataTable ls_Largest2new = sh.ExecuteQuery("select * from Largest2new");
             //ls_Largest2new.TableName = "Largest2new";
             //list_dt.Add(ls_Largest2new);