Просмотр исходного кода

修改报告导出大分类(临时提交)

zhangjiaxin 3 лет назад
Родитель
Сommit
10be160aad

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

@@ -28,7 +28,7 @@
     <b_ck_ysfx_xsmk>True</b_ck_ysfx_xsmk>
     <index_cb_yxfx_jsfs>0</index_cb_yxfx_jsfs>
     <index_cb_ysfx_klfw>0</index_cb_ysfx_klfw>
-    <str_tb_ysfx_xsys>Al,Si,Ca,Mg,Mn,O,S</str_tb_ysfx_xsys>
+    <str_tb_ysfx_xsys>Al,Si,Ca,Mg,Mn,O,S,Ti,Na,K,Cr,C,Fe</str_tb_ysfx_xsys>
     <list_str_tb_ysfx_xsys>
       <YS0>Al</YS0>
       <YS1>Si</YS1>
@@ -37,6 +37,12 @@
       <YS4>Mn</YS4>
       <YS5>O</YS5>
       <YS6>S</YS6>
+      <YS7>Ti</YS7>
+      <YS8>Na</YS8>
+      <YS9>K</YS9>
+      <YS10>Cr</YS10>
+      <YS11>C</YS11>
+      <YS12>Fe</YS12>
     </list_str_tb_ysfx_xsys>
     <b_ck_yscf_xsmk>True</b_ck_yscf_xsmk>
     <index_cb_yscf_xstx>0</index_cb_yscf_xstx>

+ 1 - 1
Bin/x64/Debug/Config/ProData/lj.psf

@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<XMLData FileMark="626" Name="LiJi1" Sizes="1,1.5,2,5,10,15,20,25,30" Version="1.1.1" />
+<XMLData FileMark="626" Name="LiJi1" Sizes="2,5,10,20,30" Version="1.1.1" />

+ 21 - 10
Bin/x64/Debug/Resources/HTML/charts.html

@@ -549,7 +549,8 @@
 
             var _lineStyle =
             {
-                symbol: 'emptyCircle', symbolSize: 4,
+                //symbolSize 设置小三角形顶点的⚪ 0是实线启示默认是4虚线
+                symbol: 'emptyCircle', symbolSize: 0,
                 lineStyle: {
                     normal:
                         { width: 1, color: '#888888',type: 'dashed' }
@@ -565,19 +566,24 @@
             var item = {
                 name: 'TriangularEdge',
                 type: 'line',
-                itemStyle: { normal: { color: '#000066', barBorderRadius: 5 } },
+                itemStyle: { normal: { color: '#000000', barBorderRadius: 5 } },
                 data: [[0, 0], [50, 50 * 1.732]],
                 markPoint: {
                     label: {
                         normal:
                         {
-                           // color: '#000',
+                            color: '#000',
+                            textStyle: {
+                                color: '#000000',
+                                fontSize: 14,
+                                fontWeight:800
+                            },
                             show: true,
                             formatter: json.TopName
                         }
                     },
                     symbol: 'roundRect',
-                    symbolSize: [40, 20],
+                    symbolSize: [0, 40],
                     symbolOffset: [0, '-50%'],
                     data: [{
                         coord: [50, 50 * 1.732]
@@ -644,6 +650,7 @@
                         itemStyle: {
                             normal: {
                                 color: '#000066',
+                                
                                 barBorderRadius: 5,
                             }
                         }, symbol: _lineStyle.symbol,
@@ -700,6 +707,9 @@
                 '#6f3071', '#7711AF', '#CF77FF', '#AE004F', '#F35872', '#FA7729',
                 '#FFC526', '#F8E71C', '#34ADAE', '#3DDFD2', '#A0FFFF'
             ];
+
+
+            
             for (var i = 0; i < json.ListPartSize.length; i++) {
 
                 var d1 = {
@@ -709,14 +719,14 @@
                    // symbolSize: i * 2 + 6,
                      itemStyle: {
                         normal:
-                        {
-                            borderWidth: 0.5,
+                         {
+                            //三元图描边颜色0.8
+                            borderWidth: 0.8,
                              borderColor: '#000',
                              color: colorListrT[i]
                          }
                     },
                     data: json.ListPoint[i]
-
                 };
                 list.push(d1);
             }
@@ -727,7 +737,7 @@
 
             option = {
                 title: [{
-                    text: json.TopName + '.' + json.LeftName + '.' + json.RightName,
+                    text: json.TopName + '-' + json.LeftName + '-' + json.RightName,
                     //subtext: 'features:' + countL,
                     left: 'center'
 
@@ -752,8 +762,9 @@
                 legend: {
                     type: 'scroll',
                     data: json.ListPartSize,
-                    left: 'right',
-                    top:50
+                    left: '30%',
+                    top: 50,
+
                 },
                 tooltip: {
                     trigger: 'item',

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


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

@@ -5,7 +5,9 @@ using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.OTSDataMgrFunction;
 using OTSIncAReportApp.OTSSampleReportInfo;
+using OTSIncAReportApp.OTSTemplateDesigner;
 using OTSIncAReportApp.SysMgrTools;
+using OTSIncAReportGrids;
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -44,6 +46,7 @@ namespace OTSIncAReportApp.Control_ECharts
         List<string> NameList = new List<string>() { "过小颗粒", "过大颗粒", "亮度不在分析范围内的颗粒", "低计数率颗粒", "不含分析元素的颗粒", "非夹杂物颗粒SiC", "非夹杂物颗粒FeO", "未识别颗粒" };
         private frmReportConditionChoose m_conditionChoose;
         private ResultDataMgr m_DataMgr;
+        Export_ReportTemplate m_export_reporttemplate;
         #endregion
 
         #region 窗体加载及构造函数
@@ -57,6 +60,8 @@ namespace OTSIncAReportApp.Control_ECharts
             //国际化
             Language lan = new Language();
             table = lan.GetNameTable("CompositionDistributionGrid");
+
+            m_export_reporttemplate = new Export_ReportTemplate();
         }
         private void EChart_ParticlesComposition_Load(object sender, EventArgs e)
         {
@@ -311,6 +316,211 @@ namespace OTSIncAReportApp.Control_ECharts
             return chart;
         }
 
+        private Chartdate GetInclusionAreaRatioClassData(string path)
+        {
+            
+            //创建新的图形数据源
+            Chartdate chart = new Chartdate();
+            chart.Title = m_ReportApp.m_reportname;
+            chart.YName = m_str_AxisY;
+
+            //计算分类整个表的数据
+            DataTable dt= ClassificationIntegration(path);
+            List<string> listName = new List<string>();
+            //ListName
+            for (int i = 0; i < dt.Rows.Count; i++)
+            {
+                listName.Add(dt.Rows[i]["e1"].ToString());
+            }
+            chart.ListName = listName;
+            //DataTable dt 
+            //设置数据
+            List<Item> listData = new List<Item>();
+            //ListData
+            for (int k = 0; k < dt.Rows.Count; k++)
+            {
+                string str = dt.Rows[k]["e3"].ToString();
+                string name = dt.Rows[k]["e1"].ToString();
+                
+
+                Item item = new Item()
+                {
+                    value = decimal.Round(decimal.Parse(dt.Rows[k]["e3"].ToString()), 2).ToString(),
+                    name = name
+                };
+                listData.Add(item);
+
+            }
+            chart.ListData = listData;
+            return chart;
+        }
+
+        private DataTable ClassificationIntegration(string path )
+        {
+
+            //------------------加载模块,获取数据-------------------------------------------------
+            ResultGrid ls_resultgrid = new ResultGrid(m_ReportApp);
+            Dictionary<string, string> keyValues_ResultGrid = ls_resultgrid.GetData_ResultGrid();
+            //------------------加载模块,获取数据结束----------------------------------------------
+            Dictionary<string, string>.Enumerator en = keyValues_ResultGrid.GetEnumerator();
+            string str_CLJGMC = "";
+            string str_YXSJ = "";
+            string str_SCZS = "";
+            string str_FLFA = "";
+            string str_YJCTZ = "";
+            string str_SCMJ = "";
+            string str_CKBZ = "GB/T30834-2014";
+
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col1"].ToString(), out str_CLJGMC);//测量结果名称
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col4"].ToString(), out str_YXSJ);//运行时间
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col5"].ToString(), out str_SCZS);//视场总数
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col6"].ToString(), out str_FLFA);//分类方案
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col7"].ToString(), out str_YJCTZ);//已检测特征
+            keyValues_ResultGrid.TryGetValue(ls_resultgrid.table["col8"].ToString(), out str_SCMJ);//视场面积
+
+            //将获取到的数据转换成报告模板能接收的格式。
+            DataTable ls_new_dt = new DataTable();
+            ls_new_dt.TableName = "ResultGrid";
+            ls_new_dt.Columns.Add("CLJGMC"); //测量结果名称
+            ls_new_dt.Columns.Add("YXSJ");      //运行时间
+            ls_new_dt.Columns.Add("SCZS");      //视场总数
+            ls_new_dt.Columns.Add("FLFA");      //分类方案
+            ls_new_dt.Columns.Add("YJCTZ");     //已检测特征
+            ls_new_dt.Columns.Add("SCMJ");      //视场面积
+            ls_new_dt.Columns.Add("CKBZ");      //参考标准
+
+            //行转列,这里不会发生改变,所以这样写
+            DataRow dr = ls_new_dt.NewRow();
+            dr["CLJGMC"] = str_CLJGMC;
+            dr["YXSJ"] = str_YXSJ;
+            dr["SCZS"] = str_SCZS;
+            dr["FLFA"] = str_FLFA;
+            dr["YJCTZ"] = str_YJCTZ;
+            dr["SCMJ"] = str_SCMJ;
+            dr["CKBZ"] = str_CKBZ;
+
+            ls_new_dt.Rows.Add(dr);
+
+            DataOperation.DataAccess.ParticleData particledata = new DataOperation.DataAccess.ParticleData(path);
+            DataTable AreaInformationOfAllElements = particledata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
+            DataTable AllAnalysisDetails = new DataTable();
+            //AllAnalysisDetails.TableName = "ElementValue";
+            AllAnalysisDetails.Columns.Add("Name");
+            AllAnalysisDetails.Columns.Add("TypeId");
+            AllAnalysisDetails.Columns.Add("Area", typeof(double));
+            AllAnalysisDetails.Columns.Add("Class");
+            AllAnalysisDetails.Columns.Add("Cunt", typeof(double));
+            for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
+            {
+                if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
+                    continue;
+
+                DataRow dr2 = AllAnalysisDetails.NewRow();
+                dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
+                dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
+                dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
+                dr2["Cunt"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["con"]);
+                AllAnalysisDetails.Rows.Add(dr2);
+            }
+            //元素物质定义
+            List<List<string>> ElementData = new List<List<string>>();
+            ElementData.Add(new List<string> { "O", "S" });//氧硫化物
+
+            ElementData.Add(new List<string> { "C", "N" });//碳氮化物
+            ElementData.Add(new List<string> { "O", "N" });//碳氮化物
+
+            ElementData.Add(new List<string> { "O" });//氧化物
+
+            ElementData.Add(new List<string> { "S" });//硫化物
+            //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
+            List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
+            //给每个元素进行划分大类
+            m_export_reporttemplate.ElementClassification(ref AllAnalysisDetails, ElementData, particledata);
+
+
+            DataTable AreaRatio = new DataTable();
+            AreaRatio.TableName = "InclusionAreaRatio";
+            AreaRatio.Columns.Add("e1");
+            AreaRatio.Columns.Add("e2");
+            AreaRatio.Columns.Add("e3", typeof(double));
+            AreaRatio.Columns.Add("e4");
+            AreaRatio.Columns.Add("e5");
+
+
+            //获取夹杂物的总面积用于计算夹杂物类别的占比(gridview最后一个固定是未识别颗粒,要排除未识别颗粒所以for循环至grid view长度减一)
+            double totalInclusionArea = 0;
+            totalInclusionArea = Convert.ToDouble(decimal.Parse(AllAnalysisDetails.Compute("sum(Area)", "").ToString()));
+            for (int i = 0; i < AllAnalysisDetails.Rows.Count; i++)
+            {
+                DataRow dr2 = AreaRatio.NewRow();
+                dr2["e1"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
+                dr2["e2"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
+                dr2["e3"] = Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
+                dr2["e4"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
+                dr2["e5"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / Convert.ToDouble(ls_new_dt.Rows[0][5])) * 100, 4);
+                AreaRatio.Rows.Add(dr2);
+            }
+
+
+            DataTable AreaRatio_dt = AreaRatio.Copy();
+            AreaRatio_dt.Clear();
+
+            for (int i = 0; i < ClassName.Count(); i++)
+            {
+                DataTable dt = AreaRatio.Copy();
+                dt.Clear();
+                for (int a = 0; a < AreaRatio.Rows.Count; a++)
+                {
+                    if (AreaRatio.Rows[a]["e1"].ToString() == ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(AreaRatio.Rows[a].ItemArray);
+                    }
+                }
+
+                DataView dv = dt.DefaultView;
+                dv.Sort = "e3 DESC";
+                DataTable dt_Element = dv.ToTable();
+                for (int a = 0; a < dt_Element.Rows.Count; a++)
+                {
+                    AreaRatio_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
+                }
+            }
+
+
+            DataTable AllAnalysisDetails1 = AreaRatio_dt.Copy();
+            AllAnalysisDetails1.Clear();
+            //AllAnalysisDetails1.TableName = "InclusionAreaRatio";
+
+            for (int i = 0; i < ClassName.Count; i++)
+            {
+                DataTable dt = AreaRatio_dt.Copy();
+                dt.Clear();
+                for (int a = 0; a < AreaRatio_dt.Rows.Count; a++)
+                {
+                    if (AreaRatio_dt.Rows[a]["e1"].ToString() == ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(AreaRatio_dt.Rows[a].ItemArray);
+                    }
+                }
+                if (dt.Rows.Count > 0)
+                {
+                    double totalInclusionArea2 = Convert.ToDouble(decimal.Parse(AreaRatio_dt.Compute("sum(e3)", "").ToString()));
+                    double Area = Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
+                    DataRow dr3 = AllAnalysisDetails1.NewRow();
+                    dr3["e1"] = ClassName[i].ToString();
+                    dr3["e3"] = Math.Round(Area, 2);
+                    //Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
+                    dr3["e4"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / totalInclusionArea2) * 100, 2);
+                    dr3["e5"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / Convert.ToDouble(ls_new_dt.Rows[0][5])) * 100, 4);
+                    AllAnalysisDetails1.Rows.Add(dr3);
+                   
+                }
+
+            }
+            return AllAnalysisDetails1;
+
+
+        }
 
         /// <summary>
         /// 获取颗粒成分数据
@@ -602,6 +812,9 @@ namespace OTSIncAReportApp.Control_ECharts
                 case "InclusionareaRatio":
                     chartdate = GetInclusionAreaRatioData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
                     break;
+                case "InclusionareaClassRatio":
+                    chartdate=GetInclusionAreaRatioClassData(m_DataMgr.ResultFilesList[m_DataMgr.GetWorkingResult()].FilePath);
+                    break;
             }
 
 

+ 1 - 0
OTSIncAReportApp/1-UI/Control_Grids/ElementCompositionAvgGrid.cs

@@ -351,6 +351,7 @@ namespace OTSIncAReportGrids
         public void GetDataTableAndGridView(out DataTable out_dt, out DataGridView out_dg)
         {
             out_dt = m_dt;
+            //out_dt = (this.Gview_gz.DataSource as DataTable);
             out_dg = this.Gview_gz;
         }
         #endregion

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

@@ -47,6 +47,10 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             m_list_dt = new List<DataTable>();
         }
+        public Export_ReportTemplate()
+        {
+            m_list_dt = new List<DataTable>();
+        }
         #endregion
 
         #region 插入测量结果Grid表格
@@ -676,6 +680,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         {
             try
             {
+                ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
                 //加载模块
                 ParticlesSizeGrid ls_particlesizegrid = new ParticlesSizeGrid(m_otsreport_export.m_ReportApp);
                 List<string> vs = new List<string>() { "DMAX", "DMIN", "CIRCLE", "FERET" };
@@ -706,48 +711,48 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 for (int i = 1; i < 11; i++)
                 {
                     if (ls_gv.Columns.Count > col)
-                        if (i<10)
+                        if (i < 10)
                             dr["c" + i.ToString()] = ls_gv.Columns[col++].Name;
-                        
+
                 }
 
                 ls_partsize_dt.Rows.Add(dr);
 
                 DataTable ls_Particel_dt = new DataTable();
                 ls_Particel_dt.TableName = "Particel";
-                ls_Particel_dt.Columns.Add("c1");
-                ls_Particel_dt.Columns.Add("c2");
-                ls_Particel_dt.Columns.Add("c3");
-                ls_Particel_dt.Columns.Add("c4");
-                ls_Particel_dt.Columns.Add("c5");
-                ls_Particel_dt.Columns.Add("c6");
-                ls_Particel_dt.Columns.Add("c7");
-                ls_Particel_dt.Columns.Add("c8");
-                ls_Particel_dt.Columns.Add("c9");
-                ls_Particel_dt.Columns.Add("SName");
-                ls_Particel_dt.Columns.Add("total");
-                ls_Particel_dt.Columns.Add("Largest");
-                ls_Particel_dt.Columns.Add("Hardness");
-                ls_Particel_dt.Columns.Add("Density");
-                ls_Particel_dt.Columns.Add("Conductivity");
+
+                ls_Particel_dt.Columns.Add("c1", typeof(double));
+                ls_Particel_dt.Columns.Add("c2", typeof(double));
+                ls_Particel_dt.Columns.Add("c3", typeof(double));
+                ls_Particel_dt.Columns.Add("c4", typeof(double));
+                ls_Particel_dt.Columns.Add("c5", typeof(double));
+                ls_Particel_dt.Columns.Add("c6", typeof(double));
+                ls_Particel_dt.Columns.Add("c7", typeof(double));
+                ls_Particel_dt.Columns.Add("c8", typeof(double));
+                ls_Particel_dt.Columns.Add("c9", typeof(double));
+                ls_Particel_dt.Columns.Add("Name");
+                ls_Particel_dt.Columns.Add("total", typeof(double));
+                ls_Particel_dt.Columns.Add("TypeId");
+                ls_Particel_dt.Columns.Add("Class");
                 for (int i = 0; i < ls_gv.Rows.Count; i++)
                 {
+                    if (Convert.ToInt32(ls_gv.Rows[i].Cells[3].Value) < 100)
+                        continue;
+
+
                     DataRow dr2 = ls_Particel_dt.NewRow();
-                    dr2["SName"] = ls_gv.Rows[i].Cells[1].Value.ToString();
-                    dr2["Largest"] = ls_gv.Rows[i].Cells[4].Value.ToString();
-                    dr2["Hardness"] = ls_gv.Rows[i].Cells[6].Value.ToString();
-                    dr2["Density"] = ls_gv.Rows[i].Cells[7].Value.ToString();
-                    dr2["Conductivity"] = ls_gv.Rows[i].Cells[8].Value.ToString();
+                    dr2["Name"] = ls_gv.Rows[i].Cells[1].Value.ToString();
+
+                    dr2["TypeId"] = ls_gv.Rows[i].Cells[3].Value.ToString();//获取分类编号
                     int col2 = 6;
                     for (int j = 1; j < 11; j++)
                     {
                         if (ls_gv.Columns.Count > col2)
-                            if(j<10)
-                                dr2["c" + j.ToString()] = ls_gv.Rows[i].Cells[col2++].Value.ToString();
+                            if (j < 10)
+                                dr2["c" + j.ToString()] = Convert.ToDouble(ls_gv.Rows[i].Cells[col2++].Value);
                     }
 
-                    //total,不为空行,和不能是总计行
-                    if (dr2["SName"].ToString() != "" && dr2["SName"].ToString().IndexOf("number") < 0)
+                    if (dr2["Name"].ToString() != "" && dr2["Name"].ToString().IndexOf("number") < 0)
                     {
                         dr2["total"] = "0"; //求合
                         double d_total = 0;
@@ -763,8 +768,27 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
                     ls_Particel_dt.Rows.Add(dr2);
                 }
+
+                //元素物质定义
+                List<List<string>> ElementData = new List<List<string>>();
+                ElementData.Add(new List<string> { "O", "S" });//氧硫化物
+
+                ElementData.Add(new List<string> { "C", "N" });//碳氮化物
+                ElementData.Add(new List<string> { "O", "N" });//碳氮化物
+
+                ElementData.Add(new List<string> { "O" });//氧化物
+
+                ElementData.Add(new List<string> { "S" });//硫化物
+                                                          //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
+                List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
+                //给每个元素进行划分大类
+                ElementClassification(ref ls_Particel_dt, ElementData, fielddata);
+                //获取大分类信息
+                DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
+
+                ClassificationSort(ls_Particel_dt,ClassName, dt);
                 m_list_dt.Add(ls_partsize_dt);
-                m_list_dt.Add(ls_Particel_dt);
+                //m_list_dt.Add(ls_Particel_dt);
 
                 return true;
             }
@@ -774,6 +798,117 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 return false;
             }
         }
+
+        private DataTable QuantityOfIntegratedSubstances(DataTable dataTable, List<string> ClassName )
+        {
+            DataTable dt_Class = dataTable.Copy();
+            dt_Class.Clear();
+            dt_Class.TableName = "Particel";
+            dt_Class.Columns.Remove("Name");
+            dt_Class.Columns.Remove("TypeId");
+
+            for (int i = 0; i < ClassName.Count; i++)
+            {
+                //保留当前循环中大类物质,去除其他物质
+                DataTable dt = dataTable.Copy();
+                dt.Clear();
+                for (int a = 0; a < dataTable.Rows.Count; a++)
+                {
+                    if (dataTable.Rows[a]["Class"].ToString() == ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(dataTable.Rows[a].ItemArray);
+                    }
+                }
+                if (dt.Rows.Count == 0)
+                    continue;
+
+                DataTable dt_2 = new DataTable();
+                dt_2 = dataTable.Copy();
+                dt_2.Clear();
+                DataRow row = dt_2.NewRow();
+                dt_2.Rows.Add(row);
+
+                for (int a=0;a< dt.Columns.Count;a++)
+                {
+                    if (dt.Columns[a].ToString() != "Name" && dt.Columns[a].ToString() != "Class"&&dt.Columns[a].ToString()!= "TypeId")
+                    {
+                        bool bl = false;
+                        for (int b = 0; b < dt.Rows.Count; b++)
+                        {
+                            if (!dt.Rows[b].IsNull(dt.Columns[a].ToString()))
+                            {
+                                bl = true;
+                            }
+                        }
+                        if (bl)
+                        {
+                            dt_2.Rows[0][dt.Columns[a].ToString()] = decimal.Parse(dt.Compute("sum(" + dt.Columns[a].ToString() + ")", "").ToString());
+                        }
+                    }
+                }
+                dt_2.Columns.Remove("Name");
+                dt_2.Columns.Remove("TypeId");
+                dt_2.Rows[0]["Class"] = ClassName[i];
+                //dt_2.Rows[0]["TypeId"] = dt.Rows[0]["TypeId"].ToString();
+                dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
+            }
+            m_list_dt.Add(dt_Class);
+            return dt_Class;
+        }
+
+        private void ClassificationSort(DataTable dataTable,List<string> ClassName,DataTable data)
+        {
+            DataTable dt = new DataTable();
+            dt = dataTable.Copy();
+            dt.Clear();
+            dt.TableName = "Particel_subdivision";
+            //循环list中每个类型
+            for (int i=0;i< ClassName.Count();i++)
+            {
+                DataTable data1 = dt.Copy();
+                data1.Clear();
+                data1.Rows.Add();
+                for (int a=0;a< data.Rows.Count;a++)
+                {
+                    if (data.Rows[a]["Class"].ToString()== ClassName[i].ToString())
+                    {
+                        for (int b=1;b<10;b++)
+                        {
+                            data1.Rows[0]["c"+b.ToString()] = data.Rows[a]["c"+b.ToString()];
+                        }
+                        data1.Rows[0]["total"] = data.Rows[a]["total"];
+                        data1.Rows[0]["Class"] = data.Rows[a]["Class"];
+
+                        dt.Rows.Add(data1.Rows[0].ItemArray);
+                    }
+                }
+
+                DataTable dt_1 = new DataTable();
+                dt_1 = dt.Copy();
+                dt_1.Clear();
+                //循环DataTable中每个分类的数据
+                for (int a=0;a< dataTable.Rows.Count;a++)
+                {
+                    if (dataTable.Rows[a]["Class"].ToString()== ClassName[i])
+                    {
+                        dataTable.Rows[a]["Class"] = "";
+                        dt_1.Rows.Add(dataTable.Rows[a].ItemArray);
+                    }
+                }
+                //将颗粒数量排序(从大到小)
+                DataView dv = dt_1.DefaultView;
+                dv.Sort = "total DESC";
+                DataTable dt_1_sort = dv.ToTable();
+                for (int a = 0; a < dt_1_sort.Rows.Count; a++)
+                {
+                    dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
+                }
+            }
+            dt.Columns.Remove("TypeId");
+            
+
+            m_list_dt.Add(dt);
+        }
         #endregion
 
         #region 插入平均元素含量表
@@ -870,7 +1005,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                     ls_element_dt.Rows.Add(dr2);
                 }
 
-                InclusionAreaRatio(ls_gv);
+                
                 //把用户设置感兴趣的元素显示在前边
                 for (int i=0;i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count(); i++)
                 {
@@ -912,39 +1047,515 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 return false;
             }
         }
+
+        public bool InsertReportTemplateTable_ElementAvgGrid()
+        {
+            //根据sql条件,查询获取颗粒信息数据
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
+            DataTable AllAnalysisDetails = new DataTable();
+            AllAnalysisDetails.TableName = "ElementValue";
+            AllAnalysisDetails.Columns.Add("Name");
+            AllAnalysisDetails.Columns.Add("TypeId");
+            AllAnalysisDetails.Columns.Add("Area",typeof(double));
+            AllAnalysisDetails.Columns.Add("Class");
+            for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
+            {
+                if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
+                    continue;
+               
+                DataRow dr2 = AllAnalysisDetails.NewRow();
+                dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
+                dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
+                dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
+               
+                AllAnalysisDetails.Rows.Add(dr2);
+            }
+            //元素物质定义
+            List<List<string>> ElementData = new List<List<string>>();
+            ElementData.Add(new List<string> { "O", "S" });//氧硫化物
+
+            ElementData.Add(new List<string> { "C", "N" });//碳氮化物
+            ElementData.Add(new List<string> { "O", "N" });//碳氮化物
+
+            ElementData.Add(new List<string> { "O" });//氧化物
+
+            ElementData.Add(new List<string> { "S" });//硫化物
+            //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
+            List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
+            //给每个元素进行划分大类
+            ElementClassification(ref AllAnalysisDetails, ElementData, fielddata);
+            //统计元素物质大类的元素信息和面积占比
+            DataTable dt_ElementalSubstance=  ElementalSubstance(AllAnalysisDetails, ClassName, fielddata);
+            //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
+            DataTable dt_ElementSorting= ElementSorting( AllAnalysisDetails, ClassName, fielddata);
+            //生成最后导出时物质元素成分表
+            DataTable dt= MaterialElementComposition(dt_ElementalSubstance,13);//导出14个元素成分信息
+            //生成最后导出时物质元素细分表
+            SubdivisionOfMaterialElements(dt_ElementSorting, 13, ClassName, dt);
+
+
+
+            //夹杂物面积比添加大类
+            DataTable RawParticleData = InclusionAreaRatio();
+            //夹杂物面积比计算大类占比
+            ProportionOfParticleArea(RawParticleData, ClassName);
+            return true;
+
+        }
+
+        private bool ProportionOfParticleArea(DataTable dataTable, List<string> ClassName)
+        {
+            
+            DataTable AllAnalysisDetails = dataTable.Copy();
+            AllAnalysisDetails.Clear();
+            AllAnalysisDetails.TableName = "InclusionAreaRatio";
+
+            for (int i=0;i< ClassName.Count;i++)
+            {
+                DataTable dt = dataTable.Copy();
+                dt.Clear();
+                for (int a=0;a< dataTable.Rows.Count;a++)
+                {
+                    if (dataTable.Rows[a]["e1"].ToString()== ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(dataTable.Rows[a].ItemArray);
+                    }
+                }
+                if (dt.Rows.Count>0)
+                {
+                    double totalInclusionArea = Convert.ToDouble(decimal.Parse(dataTable.Compute("sum(e3)", "").ToString()));
+                    double Area= Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
+                    DataRow dr = AllAnalysisDetails.NewRow();
+                    dr["e1"] = ClassName[i].ToString();
+                    dr["e3"] = Math.Round(Area, 2);
+                    //Convert.ToDouble(decimal.Parse(dt.Compute("sum(e3)", "").ToString()));
+                    dr["e4"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / totalInclusionArea) * 100, 2);
+                    dr["e5"] = Math.Round((Convert.ToDouble(dt.Rows[0]["e3"]) / Convert.ToDouble(m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
+                    AllAnalysisDetails.Rows.Add(dr);
+
+                    DataView dv = dt.DefaultView;
+                    dv.Sort = "e3 DESC";
+                    DataTable dt_Area = dv.ToTable();
+                    for (int a=0;a< dt_Area.Rows.Count;a++)
+                    {
+                        dt_Area.Rows[a]["e1"] = "";
+                        dt_Area.Rows[a]["e3"] = Math.Round(Convert.ToDouble(dt_Area.Rows[a]["e3"]), 2);
+                        AllAnalysisDetails.Rows.Add(dt_Area.Rows[a].ItemArray);
+                    }
+                }
+                
+            }
+            m_list_dt.Add(AllAnalysisDetails);
+            return true;
+        }
+
+
+
+        public bool ElementClassification(ref DataTable AreaInformationOfAllElements, List<List<string>> ElementData, ParticleData fielddata)
+        {
+            
+            for (int i=0;i< AreaInformationOfAllElements.Rows.Count;i++)
+            {
+                List<string> ElementGroup = new List<string>();
+                DataTable ClassificationDetails = fielddata.GetAreaByIncA(AreaInformationOfAllElements.Rows[i]["TypeId"].ToString(), "");//获取单个分类的元素信息
+                for (int a=0;a< ClassificationDetails.Rows.Count;a++)
+                {
+                    ElementGroup.Add(ClassificationDetails.Rows[a]["Name"].ToString());
+                }
+
+                for (int a=0;a< ElementGroup.Count()-1;a++)
+                {
+                    ElementGroup[a] = ElementGroup[a].Split('-')[0];
+                }
+  
+                if (ElementData[0].All(b => ElementGroup.Any(a => a.Equals(b))))
+                {
+                    AreaInformationOfAllElements.Rows[i]["Class"] = "氧硫化物";
+                    continue;
+                }
+
+                if (ElementData[1].All(b => ElementGroup.Any(a => a.Equals(b)))|| ElementData[2].All(b => ElementGroup.Any(a => a.Equals(b))))
+                {
+                    AreaInformationOfAllElements.Rows[i]["Class"] = "碳氮化物";
+                    continue;
+                }
+
+                if (ElementData[4].All(b => ElementGroup.Any(a => a.Equals(b))))
+                {
+                    AreaInformationOfAllElements.Rows[i]["Class"] = "硫化物";
+                    continue;
+                }
+
+                if (ElementData[3].All(b => ElementGroup.Any(a => a.Equals(b))))
+                {
+                    AreaInformationOfAllElements.Rows[i]["Class"] = "氧化物";
+                    continue;
+                }
+                AreaInformationOfAllElements.Rows[i]["Class"] = "其他物质";
+             
+            }
+
+            return true;
+        }
+        private DataTable ElementSorting( DataTable AllAnalysisDetails, List<string> ClassName , ParticleData fielddata)
+        {
+            DataTable dte = fielddata.GetAllElement();
+            DataTable ElementSorting_dt = AllAnalysisDetails.Copy();
+            ElementSorting_dt.Clear();
+            for (int i=0; i< ClassName.Count;i++)
+            {
+                DataTable dt = AllAnalysisDetails.Copy();
+                dt.Clear();
+                for (int a=0;a< AllAnalysisDetails.Rows.Count;a++)
+                {
+                   if (AllAnalysisDetails.Rows[a]["Class"].ToString()== ClassName[i].ToString())
+                   {
+                        dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
+                   }
+                }
+                //将颗粒大小排序(从大到小)
+                DataView dv = dt.DefaultView;
+                dv.Sort = "Area DESC";
+                DataTable dt_Element = dv.ToTable();
+
+                for (int a=0;a< dt_Element.Rows.Count;a++)
+                {
+                    ElementSorting_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
+                }
+            }
+            //循环创建元素列(类型定义为double,为以后计算做准备)
+            for (int a = 0; a < dte.Rows.Count; a++)
+            {
+                ElementSorting_dt.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
+            }
+
+            for (int a = 0; a < ElementSorting_dt.Rows.Count; a++)
+            {
+                DataTable ClassificationDetails = fielddata.GetAreaByIncA(ElementSorting_dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
+                //DataRow dr2 = ElementSorting_dt.NewRow();
+
+                foreach (DataRow dr in ClassificationDetails.Rows)
+                {
+                    double doe = Convert.ToDouble(dr["pc"]);
+                    ElementSorting_dt.Rows[a][dr["Name"].ToString()] = Math.Round( doe/Convert.ToDouble(ElementSorting_dt.Rows[a]["Area"]),2);
+                }
+            }
+
+            return ElementSorting_dt;
+        }
+        private DataTable ElementalSubstance(DataTable AllAnalysisDetails, List<string> ClassName, ParticleData fielddata)
+        {
+            //当前元素物质类面积的总和
+            double ElementalSubstance = 0;
+            DataTable dte = fielddata.GetAllElement();
+            DataTable dt_Class = new DataTable();
+            dt_Class.Columns.Add("Name");
+            dt_Class.Columns.Add("Area");
+            //循环创建元素列(类型定义为double,为以后计算做准备)
+            for (int a = 0; a < dte.Rows.Count; a++)
+            {
+                dt_Class.Columns.Add(dte.Rows[a]["Name"].ToString(), typeof(double));
+            }
+            //循环大类物质列表
+            for (int i = 0; i < ClassName.Count; i++)
+            {
+                //保留当前循环中大类物质,去除其他物质
+                DataTable dt = AllAnalysisDetails.Copy();
+                dt.Clear();
+                for (int a = 0; a < AllAnalysisDetails.Rows.Count; a++)
+                {
+                    if (AllAnalysisDetails.Rows[a]["Class"].ToString() == ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
+                    }
+                }
+                if (dt.Rows.Count == 0)
+                    continue;
+                //计算出当前循环中大类物质的面积
+                ElementalSubstance=Convert.ToDouble(decimal.Parse(dt.Compute("sum(Area)", "").ToString()));
+
+                DataTable ta = new DataTable();
+                ta = dt_Class.Copy();
+                ta.Clear();
+                
+                for (int a = 0; a < dt.Rows.Count; a++)
+                {
+                    DataTable ClassificationDetails = fielddata.GetAreaByIncA(dt.Rows[a]["TypeId"].ToString(), "");//获取单个分类的元素信息
+                    DataRow dr2 = ta.NewRow();
+                    
+                    foreach (DataRow dr in ClassificationDetails.Rows)
+                    {
+                        double doe = Convert.ToDouble(dr["pc"]);
+                        dr2[dr["Name"].ToString()] = doe;
+                    }
+                    ta.Rows.Add(dr2);
+                }
+                DataTable dataTable = ta.Copy();
+                dataTable.Clear();
+                DataRow row = dataTable.NewRow();
+                dataTable.Rows.Add(row);
+                for (int a=0;a< ta.Columns.Count;a++)
+                {
+                    if (ta.Columns[a].ToString()!="Name"&& ta.Columns[a].ToString() !="Class")
+                    {
+                        bool bl = false;
+                        for (int b=0;b<ta.Rows.Count;b++)
+                        {
+                            if (!ta.Rows[b].IsNull(ta.Columns[a].ToString()))
+                            {
+                                bl = true;
+                            }
+                        }
+                        if (bl)
+                            dataTable.Rows[0][ta.Columns[a].ToString()] = Math.Round( Convert.ToDouble(decimal.Parse(ta.Compute("sum(" + ta.Columns[a].ToString() + ")", "").ToString()))/ ElementalSubstance,2);
+                    }
+                }
+                dataTable.Rows[0]["Name"] = ClassName[i].ToString();
+                dataTable.Rows[0]["Area"] = ElementalSubstance;
+
+                dt_Class.Rows.Add(dataTable.Rows[0].ItemArray);
+                
+            }
+            return dt_Class;
+        }
+        private DataTable MaterialElementComposition(DataTable a_ElementalSubstance,int NumberOfColumns)
+        {
+            DataTable dt_ElementalSubstance = new DataTable();
+            dt_ElementalSubstance.TableName = "ElementalSubstance_Value";
+            dt_ElementalSubstance.Columns.Add("Name");
+            dt_ElementalSubstance.Columns.Add("Area");
+            for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
+            {
+                dt_ElementalSubstance.Rows.Add(a_ElementalSubstance.Rows[i]["Name"]);
+                dt_ElementalSubstance.Rows[i]["Area"]=Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"]),2) ;
+            }
+            int cunt = 1;
+            for (int i=0;i< NumberOfColumns; i++)
+            {
+                
+                if (i< m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Count())
+                {
+                    dt_ElementalSubstance.Columns.Add(m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]);
+                    for (int a=0;a< a_ElementalSubstance.Rows.Count;a++)
+                    {
+                        if (a_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]].ToString() == "")
+                        {
+                            dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = 0;
+                        }
+                        else
+                        {
+                            dt_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]] = a_ElementalSubstance.Rows[a][m_otsreport_export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys[i]];
+                        }
+                    }
+                }
+                else
+                {
+                    dt_ElementalSubstance.Columns.Add("Null"+ cunt.ToString());
+                    cunt = cunt + 1;
+                    for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
+                    {
+                        dt_ElementalSubstance.Rows[a][i+2] = "-";
+                    }
+                }
+            }
+
+            DataTable dataTable = new DataTable();
+            dataTable = dt_ElementalSubstance.Copy();
+            dataTable.Clear();
+            DataRow row = dataTable.NewRow();
+            dataTable.Rows.Add(row);
+            dataTable.TableName = "ElementalSubstance_Name";
+            for (int i=0;i< dataTable.Columns.Count;i++)
+            {
+                dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
+            }
+
+            m_list_dt.Add(dataTable);
+            m_list_dt.Add(dt_ElementalSubstance);
+
+            return dt_ElementalSubstance;
+        }
+        private bool SubdivisionOfMaterialElements(DataTable a_ElementalSubstance, int NumberOfColumns, List<string> ClassName,DataTable data)
+        {
+
+            DataTable dt_ElementalSubstance = new DataTable();
+            dt_ElementalSubstance= data.Copy();
+            dt_ElementalSubstance.Clear();
+            dt_ElementalSubstance.TableName = "ElementSubdivision_Value";
+            dt_ElementalSubstance.Columns["Name"].ColumnName = "Class";
+            dt_ElementalSubstance.Columns.Add("Name");
+            //处理元素面积保留小数点后两位
+            for (int i=0;i< a_ElementalSubstance.Rows.Count;i++)
+            {
+                a_ElementalSubstance.Rows[i]["Area"] = Math.Round(Convert.ToDouble(a_ElementalSubstance.Rows[i]["Area"].ToString()), 2);
+            }
+
+
+            //循环元素物质大类
+            for (int i = 0; i < ClassName.Count; i++)
+            {
+                DataTable dt_1 = new DataTable();
+                dt_1 = data.Copy();
+                dt_1.Clear();
+                for (int a = 0; a < data.Rows.Count; a++)
+                {
+                    if (data.Rows[a]["Name"].ToString() == ClassName[i].ToString())
+                    {
+                        dt_1.Rows.Add(data.Rows[a].ItemArray);
+                    }
+                }
+                dt_1.Columns["Name"].ColumnName = "Class";
+                dt_1.Columns.Add("Name");
+
+                DataTable dt_2 = new DataTable();
+                dt_2 = dt_1.Copy();
+                dt_2.Clear();
+                dt_2.Rows.Add();
+                //循环整个表筛选出当前的物质
+                for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
+                {
+                    if (ClassName[i].ToString() == a_ElementalSubstance.Rows[a]["Class"].ToString())
+                    {
+                        
+                        for (int b=0;b< dt_1.Columns.Count;b++)
+                        {
+                            if (dt_2.Columns[b].ToString()!="Class")
+                            {
+                                if (a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()].ToString() == "")
+                                {
+                                    dt_2.Rows[0][dt_2.Columns[b].ToString()] = 0;
+                                }
+                                else
+                                {
+                                    dt_2.Rows[0][dt_2.Columns[b].ToString()] = a_ElementalSubstance.Rows[a][dt_2.Columns[b].ToString()];
+                                }
+                            }
+                        }
+                        dt_1.Rows.Add(dt_2.Rows[0].ItemArray);
+                    }
+                }
+
+                for (int a=0;a< dt_1.Rows.Count;a++)
+                {
+                    dt_ElementalSubstance.Rows.Add(dt_1.Rows[a].ItemArray);
+                }
+            }
+
+
+
+            DataTable dataTable = new DataTable();
+            dataTable = dt_ElementalSubstance.Copy();
+            dataTable.Clear();
+            DataRow row = dataTable.NewRow();
+            dataTable.Rows.Add(row);
+            dataTable.TableName = "ElementSubdivision_Name";
+            for (int i = 0; i < dataTable.Columns.Count; i++)
+            {
+                dataTable.Rows[0][dataTable.Columns[i].ToString()] = dataTable.Columns[i].ToString();
+            }
+
+            m_list_dt.Add(dataTable);
+            m_list_dt.Add(dt_ElementalSubstance);
+            return true;
+        }
         #endregion
 
-        private void InclusionAreaRatio(DataGridView ls_gv)
+        private DataTable InclusionAreaRatio()
         {
+
+            //根据sql条件,查询获取颗粒信息数据
+            ParticleData fielddata = new ParticleData(m_otsreport_export.m_ReportApp.m_rstDataMgr.ResultFilesList[m_otsreport_export.m_ReportApp.m_rstDataMgr.GetWorkingResult()].FilePath);
+            DataTable AreaInformationOfAllElements = fielddata.GetAreaByAllIncA("");//获取所有分类面积和数量信息
+            DataTable AllAnalysisDetails = new DataTable();
+            //AllAnalysisDetails.TableName = "ElementValue";
+            AllAnalysisDetails.Columns.Add("Name");
+            AllAnalysisDetails.Columns.Add("TypeId");
+            AllAnalysisDetails.Columns.Add("Area", typeof(double));
+            AllAnalysisDetails.Columns.Add("Class");
+            AllAnalysisDetails.Columns.Add("Cunt",typeof(double));
+            for (int i = 0; i < AreaInformationOfAllElements.Rows.Count; i++)
+            {
+                if (Convert.ToInt32(AreaInformationOfAllElements.Rows[i]["TypeId"]) < 100)
+                    continue;
+
+                DataRow dr2 = AllAnalysisDetails.NewRow();
+                dr2["Name"] = AreaInformationOfAllElements.Rows[i]["TypeName"].ToString();
+                dr2["Area"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["ar"]);
+                dr2["TypeId"] = AreaInformationOfAllElements.Rows[i]["TypeId"].ToString();
+                dr2["Cunt"] = Convert.ToDouble(AreaInformationOfAllElements.Rows[i]["con"]);
+                AllAnalysisDetails.Rows.Add(dr2);
+            }
+            //元素物质定义
+            List<List<string>> ElementData = new List<List<string>>();
+            ElementData.Add(new List<string> { "O", "S" });//氧硫化物
+
+            ElementData.Add(new List<string> { "C", "N" });//碳氮化物
+            ElementData.Add(new List<string> { "O", "N" });//碳氮化物
+
+            ElementData.Add(new List<string> { "O" });//氧化物
+
+            ElementData.Add(new List<string> { "S" });//硫化物
+            //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
+            List<string> ClassName = new List<string>() { "氧硫化物", "碳氮化物", "氧化物", "硫化物", "其他物质" };
+            //给每个元素进行划分大类
+            ElementClassification(ref AllAnalysisDetails, ElementData, fielddata);
+
+
             DataTable AreaRatio = new DataTable();
             AreaRatio.TableName = "InclusionAreaRatio";
             AreaRatio.Columns.Add("e1");
             AreaRatio.Columns.Add("e2");
-            AreaRatio.Columns.Add("e3");
+            AreaRatio.Columns.Add("e3", typeof(double));
             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++)
+            //for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
+            //{
+            //    totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
+            //}
+            totalInclusionArea= Convert.ToDouble(decimal.Parse(AllAnalysisDetails.Compute("sum(Area)", "").ToString())); 
+            for (int i=0;i< AllAnalysisDetails.Rows.Count;i++)
             {
-                totalInclusionArea = totalInclusionArea + Convert.ToDouble(ls_gv.Rows[i].Cells[2].Value.ToString());
+                DataRow dr = AreaRatio.NewRow();
+                dr["e1"] = AllAnalysisDetails.Rows[i]["Class"].ToString();
+                dr["e2"] = AllAnalysisDetails.Rows[i]["Name"].ToString();
+                dr["e3"] =  Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]);
+                dr["e4"]= Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / totalInclusionArea) * 100, 2);
+                dr["e5"] = Math.Round((Convert.ToDouble(AllAnalysisDetails.Rows[i]["Area"]) / Convert.ToDouble(m_list_dt.Where(aa => aa.TableName.Contains("ResultGrid")).ToList()[0].Rows[0][5])) * 100, 4);
+                AreaRatio.Rows.Add(dr);
             }
 
 
-            for (int i = 0; i < ls_gv.Rows.Count - 1; i++)
+            DataTable AreaRatio_dt =  AreaRatio.Copy();
+            AreaRatio_dt.Clear();
+
+            for (int i=0;i< ClassName.Count();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);
+                DataTable dt = AreaRatio.Copy();
+                dt.Clear();
+                for (int a=0; a< AreaRatio.Rows.Count;a++)
+                {
+                    if (AreaRatio.Rows[a]["e1"].ToString()== ClassName[i].ToString())
+                    {
+                        dt.Rows.Add(AreaRatio.Rows[a].ItemArray);
+                    }
+                }
+
+                DataView dv = dt.DefaultView;
+                dv.Sort = "e3 DESC";
+                DataTable dt_Element = dv.ToTable();
+                for (int a = 0; a < dt_Element.Rows.Count;a++)
+                {
+                    AreaRatio_dt.Rows.Add(dt_Element.Rows[a].ItemArray);
+                }
+            }
+            return AreaRatio_dt;
+            //m_list_dt.Add(AreaRatio_dt);
         }
 
         #region 插入颗粒图chart
@@ -974,13 +1585,13 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         }
         #endregion
 
-        private DataTable GetPicDataTable_InclusionAreaRatio()
+        private DataTable GetPicDataTable_InclusionAreaRatio(string str)
         {
-            if (m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList().Count == 0)
+            if (m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList().Count == 0)
             {
                 //创建二进制列的数据表
                 DataTable ls_dt = new DataTable();
-                ls_dt.TableName = "Pic_InclusionAreaRatio";
+                ls_dt.TableName = str;
                 DataColumn colpict = new DataColumn("pict");
                 colpict.DataType = System.Type.GetType("System.Byte[]");
                 ls_dt.Columns.Add(colpict);
@@ -991,7 +1602,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             }
             else
             {
-                return m_list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionAreaRatio")).ToList()[0];
+                return m_list_dt.Where(aa => aa.TableName.Contains(str)).ToList()[0];
             }
         }
 
@@ -1023,6 +1634,49 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         }
         #endregion
 
+        #region 插入大分类夹杂物面积比图
+        public bool InsertReportTemplateChart_InclusionAreaClassRatio(string a_GraphicStyle)
+        {
+            //加载模块
+            m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition = new EChart_ParticlesComposition(m_otsreport_export.m_ReportApp, "InclusionareaClassRatio");
+            m_otsreport_export.m_ReportApp.m_reportname = "夹杂物质面积比";
+            m_otsreport_export.m_ReportApp.type = a_GraphicStyle;
+            m_otsreport_export.m_ReportApp.timerKG = true;
+            m_otsreport_export.m_ReportApp.m_ChartsWindow.Controls.Add(m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition);
+
+            //弹出加载图片窗体
+            OTSReport_GetEChartImage og = new OTSReport_GetEChartImage();
+
+            //将EChart委托事件注册给加载图片窗体的方法
+            m_otsreport_export.m_ReportApp.im_EChart_ParticlesComposition.butclic += og.get_ParticalesCompositionChart;
+            og.ShowDialog();
+
+            //获取图片数据
+            string str = og.PicStr;
+
+            //将Base64String转为图片并保存
+            byte[] arr = Convert.FromBase64String(str.Substring(str.IndexOf(',') + 1));
+            MemoryStream ms = new MemoryStream(arr);
+            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
+
+            //再将图转成流,流再转二进制-------------------------------------------
+            MemoryStream newms = new MemoryStream();
+            bmp.Save(newms, System.Drawing.Imaging.ImageFormat.Bmp);
+            newms.Seek(0, SeekOrigin.Begin);
+            byte[] newarr = new byte[newms.Length];
+            newms.Read(newarr, 0, newarr.Length);
+            newms.Dispose();
+            DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionareaClassRatio");
+
+            DataRow dr = ls_dt.NewRow();
+            dr["pict"] = newarr;//图像二进制
+            ls_dt.Rows.Add(dr);
+
+            return true;
+        }
+
+        #endregion
+
         #region 插入夹杂物面积比图
         public bool InsertReportTemplateChart_InclusionAreaRatio(string a_GraphicStyle)
         {
@@ -1055,7 +1709,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             byte[] newarr = new byte[newms.Length];
             newms.Read(newarr, 0, newarr.Length);
             newms.Dispose();
-            DataTable ls_dt = GetPicDataTable_InclusionAreaRatio();
+            DataTable ls_dt = GetPicDataTable_InclusionAreaRatio("Pic_InclusionAreaRatio");
 
             DataRow dr = ls_dt.NewRow();
             dr["pict"] = newarr;//图像二进制

+ 64 - 10
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.cs

@@ -1260,13 +1260,6 @@ namespace OTSIncAReportApp
             "BLOB","BLOB","BLOB"};
                 
 
-                //创建表 Largest2new
-            //    string[] strcolumns_Largest2new = { "pid", "Size", "Width", "Class", "ColName1", "ColName2", "ColName3", "ColName4", "ColName5", "ColName6",
-            //    "ColVal1", "ColVal2", "ColVal3", "ColVal4", "ColVal5", "ColVal6" ,"p1"};
-            //    string[] strcoltypes_Largest2new = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" ,
-            //"BLOB"};
-            //    sh.CreateTable("Largest2new", strcolumns_Largest2new, strcoltypes_Largest2new);
-
                 //创建表 field_dt
                 string[] strcolumns_field_dt = { "FieldId", "FieldImg" };
                 string[] strcoltypes_field_dt = { "INT", "BLOB" };
@@ -1281,6 +1274,16 @@ namespace OTSIncAReportApp
                 string[] strcolumns_ElementValue = { "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9","e10","e11","e12","e13","e14", "PName", "Count" , "AllElements" };
                 string[] strcoltypes_ElementValue = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
 
+                //创建元素物质表
+                string[] strcolumns_ElementalSubstance_Name = { "Name", "Area", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "e10", "e11", "e12", "e13" };
+                string[] strcoltypes_ElementalSubstance_Name = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                string[] strcolumns_ElementalSubstance_Value = { "Name", "Area", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "e10", "e11", "e12", "e13" };
+                string[] strcoltypes_ElementalSubstance_Value = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                //创建元素物质细分表
+                string[] strcolumns_ElementSubdivision_Name = { "Class", "Area", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "e10", "e11", "e12", "e13", "Name" };
+                string[] strcoltypes_ElementSubdivision_Name = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+                string[] strcolumns_ElementSubdivision_Value = { "Class", "Area", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8", "e9", "e10", "e11", "e12", "e13", "Name" };
+                string[] strcoltypes_ElementSubdivision_Value = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
 
                 //创建表 PartSize
                 string[] strcolumns_PartSize = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9" };
@@ -1288,9 +1291,13 @@ namespace OTSIncAReportApp
 
 
                 //创建表 Particel
-                string[] strcolumns_Particel = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "SName", "total" };
+                string[] strcolumns_Particel = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "total", "Name" };
                 string[] strcoltypes_Particel = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
 
+                //创建表 Particel_subdivision
+                string[] strcolumns_Particel_subdivision = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "Name", "total" ,"Class"};
+                string[] strcoltypes_Particel_subdivision = { "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT", "TEXT" };
+
                 //创建表 PicKL
                 string[] strcolumns_PicKL = { "pict" };
                 string[] strcoltypes_PicKL = { "BLOB" };
@@ -1299,7 +1306,11 @@ namespace OTSIncAReportApp
                 //创建表 夹杂物面积比
                 string[] strcolumns_PicInclusionAreaRatio = { "pict" };
                 string[] strcoltypes_PicInclusionAreaRatio = { "BLOB" };
-                
+
+                //创建表 大分类夹杂物面积比
+                string[] strcolumns_PicInclusionAreaClassRatio = { "pict" };
+                string[] strcoltypes_PicInclusionAreaClassRatio = { "BLOB" };
+
 
                 //创建表 PicYS
                 string[] strcolumns_PicYS = { "pict" };
@@ -1322,6 +1333,17 @@ namespace OTSIncAReportApp
 
                 //将数据插入到数据库中
                 List<DataTable> list_dt = m_export_reporttemplate.m_list_dt;
+                //元素分析-物质大分类保存至数据库
+                if (JudgeWhetherTheTableExists(list_dt, "ElementalSubstance_Name"))
+                    DataTableSurfaceSaveToDB(list_dt, "ElementalSubstance_Name", "ElementalSubstance_Name", sh, strcolumns_ElementalSubstance_Name, strcoltypes_ElementalSubstance_Name, tr);
+                if (JudgeWhetherTheTableExists(list_dt, "ElementalSubstance_Value"))
+                    DataTableSurfaceSaveToDB(list_dt, "ElementalSubstance_Value", "ElementalSubstance_Value", sh, strcolumns_ElementalSubstance_Value, strcoltypes_ElementalSubstance_Value, tr);
+                //元素分析-物质小分类细分保存至数据库
+                if (JudgeWhetherTheTableExists(list_dt, "ElementSubdivision_Name"))
+                    DataTableSurfaceSaveToDB(list_dt, "ElementSubdivision_Name", "ElementSubdivision_Name", sh, strcolumns_ElementSubdivision_Name, strcoltypes_ElementSubdivision_Name, tr);
+                if (JudgeWhetherTheTableExists(list_dt, "ElementSubdivision_Value"))
+                    DataTableSurfaceSaveToDB(list_dt, "ElementSubdivision_Value", "ElementSubdivision_Value", sh, strcolumns_ElementSubdivision_Value, strcoltypes_ElementSubdivision_Value, tr);
+
                 //创建 颗粒面积比表
                 if (JudgeWhetherTheTableExists(list_dt, "InclusionAreaRatio"))
                     DataTableSurfaceSaveToDB(list_dt, "AreaRatio", "InclusionAreaRatio", sh, strcolums_AreaRatio, strcoltypes_AreaRatio, tr);
@@ -1519,6 +1541,10 @@ namespace OTSIncAReportApp
                     DataTableSurfaceSaveToDB(list_dt, "Particel", "Particel", sh, strcolumns_Particel, strcoltypes_Particel, tr);
 
 
+                //插入 Particel_subdivision
+                if (JudgeWhetherTheTableExists(list_dt, "Particel_subdivision"))
+                    DataTableSurfaceSaveToDB(list_dt, "Particel_subdivision", "Particel_subdivision", sh, strcolumns_Particel_subdivision, strcoltypes_Particel_subdivision, tr);
+
                 //插入 PicKL
                 if (JudgeWhetherTheTableExists(list_dt, "PicKL"))
                 {
@@ -1634,7 +1660,31 @@ namespace OTSIncAReportApp
                         int iresult = sh.ExecuteQuery(ls_sqlstr, "pict", byte_p1, "pict2", byte_p2, "pict3", byte_p3, tr);
                     }
                 }
-                
+
+
+
+                //插入 PicKL
+                if (JudgeWhetherTheTableExists(list_dt, "Pic_InclusionareaClassRatio"))
+                {
+                    sh.CreateTable("Pic_InclusionareaClassRatio", strcolumns_PicInclusionAreaClassRatio, strcoltypes_PicInclusionAreaClassRatio);
+                    DataTable ls_PicKL = list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionareaClassRatio")).ToList()[0];
+                    for (int i = 0; i < ls_PicKL.Rows.Count; i++)
+                    {
+                        if (ls_PicKL.Rows[i][0] == null)
+                        {
+                            continue;
+                        }
+                        if (ls_PicKL.Rows[i][0] == DBNull.Value)
+                        {
+                            continue;
+                        }
+
+                        string ls_sqlstr = "insert into Pic_InclusionareaClassRatio (pict) values(:pict)";
+                        byte[] byte_p1 = (byte[])ls_PicKL.Rows[i][0];
+                        int iresult = sh.ExecuteQuery(ls_sqlstr, "pict", byte_p1, tr);
+                    }
+                }
+
 
                 //事务提交
                 sh.TranscationCommit(tr);
@@ -1880,6 +1930,10 @@ namespace OTSIncAReportApp
 
                     if (ls_str.IndexOf(table["rictbox18"].ToString()) > -1)
                     {
+                        m_export_reporttemplate.InsertReportTemplateTable_ElementAvgGrid();
+                        m_export_reporttemplate.InsertReportTemplateChart_InclusionAreaClassRatio("pie");
+
+
                         m_export_reporttemplate.InsertReportTemplateTable_ElementCompositionAvgGrid();
                         m_export_reporttemplate.InsertReportTemplateChart_InclusionAreaRatio("pie");
                         lock (m_thread_flag)

+ 46 - 6
OTSIncAReportTemplate/OTSIncAReportTemplate.cs

@@ -85,13 +85,13 @@ namespace OTSIncAReportTemplate
                 //m_arg4 = "0-983";
                 //m_arg5 = "";
 
-                m_arg1 = "C:\\Users\\admin\\Desktop\\OTS测量结果\\北京测试\\20211110\\1110上\\3#-2\\Sample1\\ReportGBDB.db";
+                m_arg1 = "C:\\Users\\admin\\Desktop\\马钢\\71-3\\71-3\\Sample71-3\\ReportTemplateDBParticleList.db";
                 m_arg2 = "./Config/ProData/ReportTemplateConfig.xml";
-                m_arg3 = "GBReport";
+                m_arg3 = "MainReport";
                 m_arg4 = "100";
                 m_arg5 = "0-100";
             }
-            //MessageBox.Show("");
+            MessageBox.Show("");
 
             //初始化xml类
             xmlutil = new XmlConfigUtil(m_arg2);
@@ -202,6 +202,9 @@ namespace OTSIncAReportTemplate
             DataTable ls_dt_PicInclusionAreaRatio = list_dt.Where(aa => aa.TableName.Contains("PicInclusionAreaRatio")).ToList()[0];
             rmReport1.AddDataSet(ls_dt_PicInclusionAreaRatio, "PicInclusionAreaRatio");
 
+            DataTable ls_dt_PicInclusionAreaClassRatio = list_dt.Where(aa => aa.TableName.Contains("Pic_InclusionareaClassRatio")).ToList()[0];
+            rmReport1.AddDataSet(ls_dt_PicInclusionAreaClassRatio, "Pic_InclusionareaClassRatio");
+
 
             if (m_mbszclass.M_SYXT.b_ck_syxt_xsmk)//判断三元相图是否显示
             {
@@ -269,8 +272,10 @@ namespace OTSIncAReportTemplate
                 {
                     DataTable ls_dt_PartSize = list_dt.Where(aa => aa.TableName.Contains("PartSize")).ToList()[0];//插入 颗粒尺寸表
                     DataTable ls_dt_Particel = list_dt.Where(aa => aa.TableName.Contains("Particel")).ToList()[0];
+                    DataTable ls_dt_Particel_subdivision = list_dt.Where(aa => aa.TableName.Contains("Particel_subdivision")).ToList()[0];
                     rmReport1.AddDataSet(ls_dt_PartSize, "PartSize");
                     rmReport1.AddDataSet(ls_dt_Particel, "Particel");
+                    rmReport1.AddDataSet(ls_dt_Particel_subdivision, "Particel_subdivision");
                     List<string> vs = new List<string>() { "DMAX", "DMIN", "Area", "FERET" };
                     string str = vs[m_mbszclass.M_KLFXJG.index_cb_klcc_jsfs];
                     rmReport1.AddVariable("klccfxjg_jsfx", str, true);
@@ -325,6 +330,17 @@ namespace OTSIncAReportTemplate
                     DataTable ls_dt_element = list_dt.Where(aa => aa.TableName == "ElementValue").ToList()[0];
                     rmReport1.AddDataSet(ls_dt_elementname, "ElementName");
                     rmReport1.AddDataSet(ls_dt_element, "ElementValue");
+
+
+                    DataTable ls_dt_ElementalSubstance_Name = list_dt.Where(aa => aa.TableName.Contains("ElementalSubstance_Name")).ToList()[0];
+                    DataTable ls_dt_ElementalSubstance_Value = list_dt.Where(aa => aa.TableName == "ElementalSubstance_Value").ToList()[0];
+                    rmReport1.AddDataSet(ls_dt_ElementalSubstance_Name, "ElementalSubstance_Name");
+                    rmReport1.AddDataSet(ls_dt_ElementalSubstance_Value, "ElementalSubstance_Value");
+                    DataTable ls_dt_ElementSubdivision_Name = list_dt.Where(aa => aa.TableName.Contains("ElementSubdivision_Name")).ToList()[0];
+                    DataTable ls_dt_ElementSubdivision_Value = list_dt.Where(aa => aa.TableName == "ElementSubdivision_Value").ToList()[0];
+                    rmReport1.AddDataSet(ls_dt_ElementSubdivision_Name, "ElementSubdivision_Name");
+                    rmReport1.AddDataSet(ls_dt_ElementSubdivision_Value, "ElementSubdivision_Value");
+
                     ls_dt_elementname.Dispose();
                     //ls_dt_elementname.Clear();
                     ls_dt_element.Dispose();
@@ -349,7 +365,7 @@ namespace OTSIncAReportTemplate
                     rmReport1.AddDataSet(ls_dt_picYS, "PicYS");
                     ls_dt_picYS.Dispose();
                     //ls_dt_picYS.Clear();
-                    rmReport1.FindObject("MasterData91").Prop["Visible"] = true;
+                    //rmReport1.FindObject("MasterData91").Prop["Visible"] = true;
                 }
                 else
                 {
@@ -357,7 +373,7 @@ namespace OTSIncAReportTemplate
                     rmReport1.AddDataSet(dataTable, "PicYS");
                     dataTable.Dispose();
                     dataTable.Clear();
-                    rmReport1.FindObject("MasterData91").Prop["Visible"] = false;
+                    //rmReport1.FindObject("MasterData91").Prop["Visible"] = false;
                 }
 
             }
@@ -947,6 +963,10 @@ namespace OTSIncAReportTemplate
             ls_Particel.TableName = "Particel";
             list_dt.Add(ls_Particel);
 
+            DataTable ls_Particel_subdivision = sh.ExecuteQuery("select * from Particel_subdivision");
+            ls_Particel_subdivision.TableName = "Particel_subdivision";
+            list_dt.Add(ls_Particel_subdivision);
+
             //DataTable ls_PicKL = sh.ExecuteQuery("select * from PicKL");
             //ls_PicKL.TableName = "PicKL";
             //list_dt.Add(ls_PicKL);
@@ -961,6 +981,11 @@ namespace OTSIncAReportTemplate
             list_dt.Add(ls_PicInclusionAreaRatio);
 
 
+            DataTable ls_PicInclusionAreaClassRatio = sh.ExecuteQuery("select * from Pic_InclusionareaClassRatio");
+            ls_PicInclusionAreaClassRatio.TableName = "Pic_InclusionareaClassRatio";
+            list_dt.Add(ls_PicInclusionAreaClassRatio);
+
+
             DataTable ls_PicSYXT2T = sh.ExecuteQuery("select * from PicSYXT2T");
             ls_PicSYXT2T.TableName = "PicSYXT2T";
             list_dt.Add(ls_PicSYXT2T);
@@ -968,7 +993,22 @@ namespace OTSIncAReportTemplate
             DataTable ls_PicSYXT3T = sh.ExecuteQuery("select * from PicSYXT3T");
             ls_PicSYXT3T.TableName = "PicSYXT3T";
             list_dt.Add(ls_PicSYXT3T);
-       
+
+
+
+            DataTable ls_ElementalSubstance_Name = sh.ExecuteQuery("select * from ElementalSubstance_Name");
+            ls_ElementalSubstance_Name.TableName = "ElementalSubstance_Name";
+            list_dt.Add(ls_ElementalSubstance_Name);
+            DataTable ls_ElementalSubstance_Value = sh.ExecuteQuery("select * from ElementalSubstance_Value");
+            ls_ElementalSubstance_Value.TableName = "ElementalSubstance_Value";
+            list_dt.Add(ls_ElementalSubstance_Value);
+
+            DataTable ls_ElementSubdivision_Name = sh.ExecuteQuery("select * from ElementSubdivision_Name");
+            ls_ElementSubdivision_Name.TableName = "ElementSubdivision_Name";
+            list_dt.Add(ls_ElementSubdivision_Name);
+            DataTable ls_ElementSubdivision_Value = sh.ExecuteQuery("select * from ElementSubdivision_Value");
+            ls_ElementSubdivision_Value.TableName = "ElementSubdivision_Value";
+            list_dt.Add(ls_ElementSubdivision_Value);
         }
 
         /// <summary>