Browse Source

Merge branch 'OTSRelease3_2' of http://36.129.163.148:30080/gogsadmin/OTS into OTSRelease3_2

gsp 7 months ago
parent
commit
047c3b9bb2

+ 1 - 2
Bin/x64/Debug/Config/ReportTemplate/Inca_Template/ReportTemplateConfig.xml

@@ -125,8 +125,7 @@
     </list_str_kllb_DeleteClass>
     <list_int_kllb_number>18</list_int_kllb_number>
     <list_str_kllb_DeleteClass_Serial>
-      <YS0>10002</YS0>
-      <YS1>20001</YS1>
+  
     </list_str_kllb_DeleteClass_Serial>
   </M_KLLBXX>
   <M_address>

+ 4 - 3
Bin/x64/Debug/Config/ReportTemplate/TCleannessA_Template/ReportTemplateConfig.xml

@@ -136,15 +136,16 @@
   <whole>
     <list_str_MainPriority>System.Collections.Generic.List`1[System.String]</list_str_MainPriority>
     <list_str_SecondaryPriority>System.Collections.Generic.List`1[System.String]<YS0>Nialloy</YS0><YS1>Fe-O</YS1><YS2>Fe-Cr</YS2><YS3>Fe-alloy</YS3></list_str_SecondaryPriority>
-    <str_MainPriority>Corundum Al2O3 , Corundum Al2O3 , Al Alloy Si&lt;5 , Zr , Al Alloy Si&lt;5 , Al Alloy Si&gt;5 , Mineral Blasting , F Rich, PTFE , Other Particles , Other Particles , Non-Ferrous Metals , SiO2 , Si/Si-C/Si-N , Mineral Fibre , Mineral Si-Al-O , Mineral Si-Al-Ca-O , Mineral Si-Al-K-O , Talc Si-Mg-(Al)-O , Calcium Carbonate , Calcium Compounds , Mineral With Na , Other Mineral , Mineral With Na , Other Mineral , Iron Rich , Steel , Steel , Low-Alloy St. Other , Low-Mn Steel , Low-Cr Steel , Low-Mn Steel , Low-Alloy St. Other , Ferrous Blasting , High-Alloy Steel , Coating Mn-P , Coating Cr , Coating Zn-Cr , Coating Zn-Ni , Coating Zn , Coating Zn-P , Ferrous Blasting , Iron Rich , Coating V , Brass Cu-Zn , Bronze Cu-Sn , Titanium , Non-Ferrous Metals , Cl Rich, PVC , Salts , Cl Rich, PVC , Cl Rich, PVC , Salts , Lubricants Mo/Ba-S , Calcium Carbonate , Al Alloy Si&gt;5 , Al Alloy Si&lt;5 , Salts , Mineral Si-Al-Ca-O , Mineral with Na , Other Mineral , Coating Zn-Cr , Coating Zn , Coating Zn-P , F Rich, PTFE , Lubricants Mo/Ba-S , Other Particles , Other Particles</str_MainPriority>
+    <str_MainPriority>
+    </str_MainPriority>
     <str_SecondaryPriority>Nialloy,Fe-O,Fe-Cr,Fe-alloy</str_SecondaryPriority>
-    <list_str_MainPriority_Serial>System.Collections.Generic.List`1[System.String]<YS0>40001</YS0><YS1>40002</YS1><YS2>40003</YS2><YS3>40004</YS3><YS4>40005</YS4><YS5>40006</YS5><YS6>40007</YS6><YS7>40008</YS7><YS8>40009</YS8><YS9>40010</YS9><YS10>40011</YS10><YS11>40012</YS11><YS12>40013</YS12><YS13>40014</YS13><YS14>40015</YS14><YS15>40016</YS15><YS16>40017</YS16><YS17>40018</YS17><YS18>40019</YS18><YS19>40020</YS19><YS20>40021</YS20><YS21>40022</YS21><YS22>40023</YS22><YS23>40024</YS23><YS24>40025</YS24><YS25>40026</YS25><YS26>40027</YS26><YS27>40028</YS27><YS28>40029</YS28><YS29>40030</YS29><YS30>40031</YS30><YS31>40032</YS31><YS32>40033</YS32><YS33>40034</YS33><YS34>40035</YS34><YS35>40036</YS35><YS36>40037</YS36><YS37>40038</YS37><YS38>40039</YS38><YS39>40040</YS39><YS40>40041</YS40><YS41>40042</YS41><YS42>40043</YS42><YS43>40044</YS43><YS44>40045</YS44><YS45>40046</YS45><YS46>40047</YS46><YS47>40048</YS47><YS48>40049</YS48><YS49>40050</YS49><YS50>40051</YS50><YS51>40052</YS51><YS52>40053</YS52><YS53>40054</YS53><YS54>40055</YS54><YS55>40056</YS55><YS56>40057</YS56><YS57>40058</YS57><YS58>40059</YS58><YS59>40060</YS59><YS60>40061</YS60><YS61>40062</YS61><YS62>40063</YS62><YS63>40064</YS63><YS64>40065</YS64><YS65>40066</YS65><YS66>40067</YS66></list_str_MainPriority_Serial>
+    <list_str_MainPriority_Serial>System.Collections.Generic.List`1[System.String]</list_str_MainPriority_Serial>
   </whole>
   <M_DZ>
     <Notes>
     </Notes>
   </M_DZ>
   <M_VDA19>
-    <IsVDA19>True</IsVDA19>
+    <IsVDA19>False</IsVDA19>
   </M_VDA19>
 </XmlConfig>

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

@@ -94,8 +94,21 @@ namespace OTSIncAReportApp.Control_ECharts
                 checkButton3.Visible = false;
                 return;
             }
+            List<DataTable> listDt = new List<DataTable>();
+            for (int i=0;i< list_dt.Count;i++)
+            {
+                DataTable dt = list_dt[i].Clone();
+                for (int a=0;a< list_dt[i].Rows.Count;a++)
+                {
+                    if (list_dt[i].Rows[a]["name"].ToString() != "")
+                    {
+                        dt.Rows.Add(list_dt[i].Rows[a].ItemArray);
+                    }
+                }
+                listDt.Add(dt);
+            }
 
-            prListData = list_dt.Copy();
+            prListData = listDt.Copy();
             prListString.Clear();
             for (int i = 0; i < list_dt.Count; i++)
             {

+ 2 - 2
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/BasicData.cs

@@ -151,7 +151,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                 }
             }
 
-            if (m_mbszclass.list_str_MainPriority.Count == 0)
+            if (m_mbszclass.list_str_MainPriority_Serial.Count == 0)
             {
                 BData = m_bt_DBData.Copy();
                 return;
@@ -179,7 +179,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             DataTable dt_stl = sh.ExecuteQuery("select * from ClassifySTD");
             DataTable LargeClassificationTable = sh.ExecuteQuery("select * from STDGroups");
 
-            for (int i = 0; i < m_mbszclass.list_str_MainPriority.Count; i++)
+            for (int i = 0; i < m_mbszclass.list_str_MainPriority_Serial.Count; i++)
             {
                 bool bl = false;
                 for (int a = 0; a < m_bt_DBData.Rows.Count; a++)

+ 95 - 5
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ElementalAnalysis.cs

@@ -22,7 +22,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
         /// <param name="m_mbszclass"></param>
         /// <param name="m_otsreport_export"></param>
         /// <returns></returns>
-        public List<DataTable> GetElementData(BasicData basicData, OTSReport_Export m_otsreport_export)
+        public List<DataTable> GetElementData(BasicData basicData, OTSReport_Export m_otsreport_export,bool lingge)
         {
             DataTable data = basicData.GetDBData();
             //根据sql条件,查询获取颗粒信息数据
@@ -66,12 +66,25 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
 
             //统计元素物质大类的元素信息和面积占比
             DataTable dt_ElementalSubstance = ElementalSubstance(AllAnalysisDetails, ClassName, basicData.getParticleData());
+            DataTable dt_ElementSorting;
             //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
-            DataTable dt_ElementSorting = ElementSorting(AllAnalysisDetails, ClassName, basicData.getParticleData());
-            //生成最后导出时物质元素成分表
+            if (lingge)
+            {
+               //单个大类
+                dt_ElementSorting = ElementSortingSS(AllAnalysisDetails, ClassName, basicData.getParticleData());
+                
+            }
+            else
+            {
+                dt_ElementSorting = ElementSorting(AllAnalysisDetails, ClassName, basicData.getParticleData());
+
+            }
+            //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
+            //DataTable dt_ElementSorting = ElementSorting(AllAnalysisDetails, ClassName, basicData.getParticleData());
+            ////生成最后导出时物质元素成分表
             DataTable dt = MaterialElementComposition(dt_ElementalSubstance, 13, m_otsreport_export);//导出14个元素成分信息
-                                                                                                     //生成最后导出时物质元素细分表
-            DataTable dtname = new DataTable();
+            dt.Columns.Add("TypeId");                                                                     //生成最后导出时物质元素细分表
+DataTable dtname = new DataTable();
             DataTable dtData = new DataTable();
             SubdivisionOfMaterialElements(dt_ElementSorting, 13, ClassName, dt, out dtname, out dtData);
             List<DataTable> datas = new List<DataTable>();
@@ -120,6 +133,34 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                 //循环整个表筛选出当前的物质
                 for (int a = 0; a < a_ElementalSubstance.Rows.Count; a++)
                 {
+                    if(ClassName.Count==1)
+                    {
+                        for (int b = 0; b < dt_1.Columns.Count; b++)
+                        {
+                            if (dt_2.Columns[b].ToString() != "Class")
+                            {
+                                if (a_ElementalSubstance.Columns.Contains(dt_2.Columns[b].ToString()))
+                                {
+                                    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()];
+                                    }
+                                }
+                                else
+                                {
+                                    dt_2.Rows[0][dt_2.Columns[b].ToString()] = 0;
+                                }
+
+                            }
+                        }
+                        dt_1.Rows.Add(dt_2.Rows[0].ItemArray);
+                    }
+                    else
+
                     if (ClassName[i].ToString() == a_ElementalSubstance.Rows[a]["Class"].ToString())
                     {
                         for (int b = 0; b < dt_1.Columns.Count; b++)
@@ -146,6 +187,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                         }
                         dt_1.Rows.Add(dt_2.Rows[0].ItemArray);
                     }
+                    
                 }
 
                 for (int a = 0; a < dt_1.Rows.Count; a++)
@@ -282,6 +324,54 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             return ElementSorting_dt;
         }
 
+        private DataTable ElementSortingSS(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();
+                DataTable dt_Element = dt.Copy();
+                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)
         {
             //当前元素物质类面积的总和

+ 4 - 3
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ParticleAnalysis.cs

@@ -605,7 +605,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             dt_Class.Clear();
             dt_Class.TableName = "Particel";
             dt_Class.Columns.Remove("Name");
-            dt_Class.Columns.Remove("TypeId");
+            //dt_Class.Columns.Remove("TypeId");
 
             for (int i = 0; i < ClassName.Count; i++)
             {
@@ -645,9 +645,10 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                             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.Columns.Remove("TypeId");
                 dt_2.Rows[0]["Class"] = ClassName[i];
                 dt_Class.Rows.Add(dt_2.Rows[0].ItemArray);
             }
@@ -702,7 +703,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                     dt.Rows.Add(dt_1_sort.Rows[a].ItemArray);
                 }
             }
-            dt.Columns.Remove("TypeId");
+            //dt.Columns.Remove("TypeId");
 
             return dt;
 

+ 8 - 17
OTSIncAReportApp/1-UI/OTSReportExport/OTSReport_Template_CleannessA.cs

@@ -1,4 +1,5 @@
 
+using NPOI.Util;
 using OTSCommon.DBOperate;
 using OTSIncAReportApp._1_UI.OTSReportExport;
 using OTSIncAReportApp._1_UI.OTSTemplateDesigner;
@@ -358,26 +359,15 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             {
                 m_OTSReport_Export.m_mbszclass.M_YSFXJG.list_str_tb_ysfx_xsys.Add(after[i]);
             }
-            //拆分,物质分类
-            //m_OTSReport_Export.m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Clear();
-            //for (int i = 0; i < delete_Class.Text.Split(',').Length; i++)
-            //{
-            //    if (delete_Class.Text.Split(',')[i] != "")
-            //        m_OTSReport_Export.m_mbszclass.M_KLLBXX.list_str_kllb_DeleteClass.Add(delete_Class.Text.Split(',')[i]);
-            //}
+         
             //主要优先显示
             m_OTSReport_Export.m_mbszclass.list_str_MainPriority.Clear();
-            m_OTSReport_Export.m_mbszclass.list_str_MainPriority = list_MainPriority;
-            //string[] MainPriority = textBox_zypxss.Text.Split(new char[] { '/' });
-            //for (int i = 0; i < MainPriority.Length; i++)
-            //{
-            //    if (textBox_zypxss.Text.Split('/')[i] != "")
-            //        m_OTSReport_Export.m_mbszclass.list_str_MainPriority.Add(MainPriority[i]);
-            //}
+            m_OTSReport_Export.m_mbszclass.list_str_MainPriority = list_MainPriority.Copy();
+  
 
             //主要优先显示顺序
             m_OTSReport_Export.m_mbszclass.list_str_MainPriority_Serial.Clear();
-            m_OTSReport_Export.m_mbszclass.list_str_MainPriority_Serial= TCCleannessAList;
+            m_OTSReport_Export.m_mbszclass.list_str_MainPriority_Serial= TCCleannessAList.Copy();
          
 
 
@@ -473,7 +463,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
 
             textBox1.Text = m_OTSReport_Export.m_mbszclass.M_DZ.Notes;
-            TCCleannessAList = m_OTSReport_Export.m_mbszclass.list_str_MainPriority_Serial;
+            TCCleannessAList = m_OTSReport_Export.m_mbszclass.list_str_MainPriority_Serial.Copy();
+            list_MainPriority = m_OTSReport_Export.m_mbszclass.list_str_MainPriority.Copy();
             LoadingIcon();
         }
         private void  LoadingIcon()
@@ -771,7 +762,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             category.ShowDialog();
             List<string> ls = category.OutElementList;
             TCCleannessAList = category.vs;
-            list_MainPriority = category.OutElementList;
+            list_MainPriority = category.OutElementList.Copy();
             string str = "";
             for (int i = 0; i < ls.Count; i++)
             {

+ 69 - 19
OTSIncAReportApp/1-UI/OTSReportExport/Template/DataTemplate.cs

@@ -15,6 +15,7 @@ using System.Collections.Generic;
 using System.Data;
 using System.Drawing;
 using System.Windows.Forms;
+using static OTSDataType.otsdataconst;
 using static OTSIncAReportApp.OTSReport_Export;
 
 namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
@@ -368,7 +369,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             xrChart_ParticelSizeSubdivision.Visible = true;
             List<List<ParticleSizeDEVData>> list_ParticelSizeData = new List<List<ParticleSizeDEVData>>();
             int ls = 0;
-            DataTable REORDER_data = REORDER(CompositeData[1], "Name");
+            DataTable REORDER_data = REORDER(surface_dt2, "TypeId");
             for (int i = 0; i < REORDER_data.Rows.Count; i++)
             {
                 if (REORDER_data.Rows[i]["Name"].ToString() == "" || REORDER_data.Rows[i]["Name"].ToString() == null)
@@ -507,14 +508,14 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
            
             for (int i=0;i< data.Rows.Count;i++)
             {
-                if (TemplateClass.list_str_MainPriority.Count!=0)
+                if (TemplateClass.list_str_MainPriority_Serial.Count!=0)
                 {
-                    for (int a = 0; a < TemplateClass.list_str_MainPriority.Count; a++)
+                    for (int a = 0; a < TemplateClass.list_str_MainPriority_Serial.Count; a++)
                     {
-                        if (data.Rows[i][field].ToString() == TemplateClass.list_str_MainPriority[a])
+                        if (data.Rows[i][field].ToString() == TemplateClass.list_str_MainPriority_Serial[a])
                         {
                             dataTable.Rows.Add(data.Rows[i].ItemArray);
-                            break; ;
+                            break;
                         }
                     }
                 }
@@ -523,18 +524,26 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
                     dataTable.Rows.Add(data.Rows[i].ItemArray);
                 }
             }
-            
+
+            //for (int i=0;i< dataTable.Rows.Count;i++)
+            //{
+            //    if (!string.IsNullOrWhiteSpace(dataTable.Rows[i]["Name"].ToString()))
+            //    {
+            //        dataTable.Rows[i].Delete();
+            //    }
+            //}
+
+            //dataTable.AcceptChanges();
+            DataTable dt = dataTable.Clone();
             for (int i=0;i< dataTable.Rows.Count;i++)
             {
-                if (!string.IsNullOrWhiteSpace(dataTable.Rows[i]["Class"].ToString()))
+                if (dataTable.Rows[i]["Name"].ToString()!="")
                 {
-                    dataTable.Rows[i].Delete();
+                    dt.Rows.Add(dataTable.Rows[i].ItemArray);
                 }
             }
 
-            dataTable.AcceptChanges();
-
-            return dataTable.Copy();
+            return dt.Copy();
        
         }
         /// <summary>
@@ -683,6 +692,10 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             int pos = 3;
             for (int i=0; i< listMin.Count; i++)
             {
+                if(i>7)
+                {
+                    continue;
+                }
                 xt_TCleannessA.Rows[0].Cells[pos].Text = listMin[i].ToString() + " ~";
                 if (listMax[i] == int.MaxValue)
                     xt_TCleannessA.Rows[1].Cells[pos].Text = "MAX";
@@ -864,23 +877,53 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         /// <param name="a_pieSeries">小分类</param>
         public void setParticleSizeTable(bool a_pieSeriesClass, bool a_pieSeries, bool isStacking)
         {
-            
+            //if (m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
 
-            xrPageBreak1.Visible = true;
+                xrPageBreak1.Visible = true;
             ParticleAnalysis particleList = new ParticleAnalysis();
             List<DataTable> CompositeData = particleList.GetClassificationConsolidationTable(basicData);
             DataTable classData= particleList.GetLargeClassification(basicData);
             DataTable subdivdeData = particleList.GetSubClassification(basicData);
             DataTable chartmax= particleList.GetChartDataCalss(basicData);
             DataTable surface_dt2 = CompositeData[1].Clone();
-            for (int i=0;i< CompositeData[1].Rows.Count;i++)
+
+            if (m_otsreport_export.m_ReportApp.m_rstDataMgr.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
             {
-                if (CompositeData[1].Rows[i]["Name"].ToString()!="")
+                for(int i=0;i< subdivdeData.Rows.Count;i++)
+                {
+                    if (subdivdeData.Rows[i]["Name"].ToString() != "")
+                    {
+                        DataRow dr = surface_dt2.NewRow();
+                        dr["c1"] = subdivdeData.Rows[i]["c1"];
+                        dr["c2"] = subdivdeData.Rows[i]["c2"];
+                        dr["c3"] = subdivdeData.Rows[i]["c3"];
+                        dr["c4"] = subdivdeData.Rows[i]["c4"];
+                        dr["c5"] = subdivdeData.Rows[i]["c5"];
+                        dr["c6"] = subdivdeData.Rows[i]["c6"];
+                        dr["c7"] = subdivdeData.Rows[i]["c7"];
+                        dr["c8"] = subdivdeData.Rows[i]["c8"];
+                        dr["c9"] = subdivdeData.Rows[i]["c9"];
+                        dr["Name"] = subdivdeData.Rows[i]["Name"];
+                        dr["total"] = subdivdeData.Rows[i]["total"];
+                        dr["Class"] = subdivdeData.Rows[i]["Class"];
+                        dr["TypeId"] = subdivdeData.Rows[i]["TypeId"];
+                        surface_dt2.Rows.Add(dr);
+                    }
+                }
+            }
+            else
+            {
+                for (int i = 0; i < CompositeData[1].Rows.Count; i++)
                 {
-                    surface_dt2.Rows.Add(CompositeData[1].Rows[i].ItemArray);
+                    if (CompositeData[1].Rows[i]["Name"].ToString() != "")
+                    {
+                        surface_dt2.Rows.Add(CompositeData[1].Rows[i].ItemArray);
+                    }
                 }
             }
 
+            
+
             for (int i = 0; i < classData.Rows.Count; i++)
             {
                 classData.Rows[i]["Class"] = subscript.Getsubscriptstring(classData.Rows[i]["Class"].ToString());
@@ -1021,7 +1064,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
             dt.Columns.Add("num");
             for (int i = 0; i < dataTable.Rows.Count; i++)
             {
-                for (int a = 0; a < 11; a++)
+                for (int a = 0; a < 10; a++)
                 {
                     if (string.IsNullOrEmpty(TypeRange.Rows[0][a].ToString()))
                         continue;
@@ -1167,7 +1210,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
 
             int ls = 0;
-            DataTable REORDER_data = REORDER(a_datas[1], "Name");
+            DataTable REORDER_data = REORDER(a_datas[1], "TypeId");
             if (REORDER_data.Rows.Count == 0)
                 return;
 
@@ -1254,11 +1297,18 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
         public void setElementAvgGrid()
         {
             ElementalAnalysis elementalAnalysis = new ElementalAnalysis();
-            List<DataTable> datas = elementalAnalysis.GetElementData(basicData, m_otsreport_export);
+            
             if (basicData.GetIsThereAMajorClassification())
+            {
+                List<DataTable> datas = elementalAnalysis.GetElementData(basicData, m_otsreport_export,false);
                 add_SetElementAvgGridS(datas);
+            }
             else
+            {
+                List<DataTable> datas = elementalAnalysis.GetElementData(basicData, m_otsreport_export,true);
                 add_SetElementAvgGrid(datas);
+            }
+               
         }
 
         private XRTableRow AddInclusionIndex(string a_str)