Browse Source

区分夹杂物和清洁度报告导出时候的数据加载模式优化

zhangjiaxin 3 months ago
parent
commit
83e718b96d

+ 62 - 4
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ListOfSimilarParticles.cs

@@ -1,5 +1,6 @@
 using OTSCLRINTERFACE;
 using OTSCommon;
+using OTSCommon.DBOperate;
 using OTSCommon.DBOperate.Model;
 using OTSIncAReportApp.OTSRstMgrFunction;
 using OTSIncAReportGraph.Class;
@@ -548,8 +549,11 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                 string TypeColor = "";
                 string GroupName = "";
 				string GroupID = "";
-				DataTable da = _particlesGridDevidePage.Particledata.GetParticleListForParticlSizeID("area", "");
-                ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(da, CategoryName);
+				string GroupColor = "";
+
+				string[] resulta = _particlesGridDevidePage.result.GetSTDName().Split('.');
+				DataTable data = ReadClassification(_particlesGridDevidePage.result.FilePath, resulta[0]);
+				ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(data, CategoryName);
                 DialogResult result = modifyCategoryForm.ShowDialog();
                 if (modifyCategoryForm.DoYouWantToModifyIt)
                 {
@@ -558,13 +562,14 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                     TypeColor = modifyCategoryForm.OutTypeAndName[2];
                     GroupName = modifyCategoryForm.OutTypeAndName[3];
 					GroupID = modifyCategoryForm.OutTypeAndName[4];
+					GroupColor = modifyCategoryForm.OutTypeAndName[5];
 					_RenameInfo = new List<string>();
                     _RenameInfo.Add(TypeId);
                     _RenameInfo.Add(TypeName);
                     _RenameInfo.Add(TypeColor);
                     _RenameInfo.Add(GroupName);
                     _RenameInfo.Add(GroupID);
-
+					_RenameInfo.Add(GroupColor);
 				}
                 else
                 {
@@ -594,7 +599,60 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             this.Close();
         }
 
-        private void cBx_All_CheckedChanged(object sender, EventArgs e)
+		/// <summary>
+		/// 读取标准库的ClassifySTD表
+		/// </summary>
+		/// <param name="a_address"></param>
+		/// <returns></returns>
+		private DataTable ReadClassification(string a_address, string STDName)
+		{
+			DataTable dt_STDGroups = new DataTable();
+			DataTable dt_ClassifySTD = new DataTable();
+			DataTable dt_IncAData = new DataTable();
+			SqLiteHelper sh_STDGroups = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
+			dt_STDGroups = sh_STDGroups.ExecuteQuery("select * from STDGroups");
+
+			SqLiteHelper sh_ClassifySTD = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
+			dt_ClassifySTD = sh_ClassifySTD.ExecuteQuery("select * from ClassifySTD");
+
+			dt_ClassifySTD.Columns.Add("GroupName");
+			dt_ClassifySTD.Columns.Add("GroupColor");
+
+
+			for (int i = 0; i < dt_ClassifySTD.Rows.Count; i++)
+			{
+				for (int a = 0; a < dt_STDGroups.Rows.Count; a++)
+				{
+					if (dt_ClassifySTD.Rows[i]["GroupId"].ToString() == dt_STDGroups.Rows[a]["id"].ToString())
+					{
+						dt_ClassifySTD.Rows[i]["GroupName"] = dt_STDGroups.Rows[a]["name"].ToString();
+						dt_ClassifySTD.Rows[i]["GroupColor"] = dt_STDGroups.Rows[a]["color"].ToString();
+						continue;
+					}
+				}
+			}
+
+			SqLiteHelper sh_Inclusion = new SqLiteHelper("data source='" + a_address + "\\FIELD_FILES\\Inclusion.db" + "'");
+			dt_IncAData = sh_Inclusion.ExecuteQuery("select * from IncAData");
+			for (int i = 0; i < dt_IncAData.Rows.Count; i++)
+			{
+				if (Convert.ToInt64(dt_IncAData.Rows[i]["TypeId"]) > 50000)
+				{
+					DataRow newRow = dt_ClassifySTD.NewRow();
+					newRow["STDId"] = dt_IncAData.Rows[i]["TypeId"];
+					newRow["StrName"] = dt_IncAData.Rows[i]["TypeName"];
+					newRow["Color"] = dt_IncAData.Rows[i]["TypeColor"];
+					newRow["GroupId"] = dt_IncAData.Rows[i]["GroupId"];
+					newRow["GroupName"] = dt_IncAData.Rows[i]["GroupName"];
+					newRow["GroupColor"] = dt_IncAData.Rows[i]["GroupColor"];
+					dt_ClassifySTD.Rows.Add(newRow);
+				}
+			}
+
+			return dt_ClassifySTD;
+		}
+
+		private void cBx_All_CheckedChanged(object sender, EventArgs e)
         {
             CheckBox selectAllCheckBox = (CheckBox)sender;
 

+ 61 - 28
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ModifyCategoryForm.cs

@@ -1,4 +1,6 @@
-using System;
+using DevExpress.Utils;
+using DevExpress.XtraDiagram.Bars;
+using System;
 using System.Collections.Generic;
 using System.Data;
 using System.Windows.Forms;
@@ -29,7 +31,7 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
 
             for (int i=0;i< inputData.Rows.Count;i++)
             {
-                comboBox1.Items.Add(inputData.Rows[i]["TypeName"].ToString());
+                comboBox1.Items.Add(inputData.Rows[i]["StrName"].ToString());
             }
 
             // 假设 comboBox1 是你的 ComboBox 控件
@@ -79,29 +81,44 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                 return false;
             }
 
+
+
             int TypeId = 50000 + inputData.Rows.Count + 1;
             string TypeName = textBox1.Text;
-            Random random = new Random();
-            // 生成随机颜色
-            int r = random.Next(0, 256); // 红色分量,0到255
-            int g = random.Next(0, 256); // 绿色分量,0到255
-            int b = random.Next(0, 256); // 蓝色分量,0到255
-            // 创建Color对象
-            string hexColor = $"#{r:X2}{g:X2}{b:X2}";
-            string NewCategory = "Default";
-            string GroupID = "0";
+    
+            string hexColor = RandomColor();
+			string NewCategory = "Default";
+            string GroupID = "10000";
+			string GroupColor= "";
+            for (int i = 0; i < inputData.Rows.Count; i++)
+            {
+                if (inputData.Rows[i]["GroupId"].ToString() == "10000")
+                {
+					GroupColor= inputData.Rows[i]["GroupColor"].ToString();
+                    continue;
+				}
+                if (inputData.Rows[i]["GroupName"].ToString() == "Default")
+                {
+					GroupColor = inputData.Rows[i]["GroupColor"].ToString();
+					continue;
+				}
+            }
+            if (GroupColor == "")
+            {
+                GroupColor = "#C9C9C9";
+			}
 
 
 			for (int i = 0; i < inputData.Rows.Count; i++)
             {
-                if (textBox1.Text == inputData.Rows[i]["TypeName"].ToString())
+                if (textBox1.Text == inputData.Rows[i]["StrName"].ToString())
                 {
-                    TypeId = Convert.ToInt32(inputData.Rows[i]["TypeId"]);
-                    TypeName = inputData.Rows[i]["TypeName"].ToString();
-                    hexColor = inputData.Rows[i]["TypeColor"].ToString();
+                    TypeId = Convert.ToInt32(inputData.Rows[i]["STDId"]);
+                    TypeName = inputData.Rows[i]["StrName"].ToString();
+                    hexColor = inputData.Rows[i]["Color"].ToString();
                     NewCategory = inputData.Rows[i]["GroupName"].ToString();
 					GroupID= inputData.Rows[i]["GroupId"].ToString();
-
+					GroupColor = inputData.Rows[i]["GroupColor"].ToString();
 					break;
                 }
             }
@@ -114,20 +131,36 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
 			DoYouWantToModifyIt = true;
             return true;
         }
-        /// <summary>
-        /// 选择现有类别方法
-        /// </summary>
-        private void SelectExistingCategoryMethods()
+        private string RandomColor()
         {
-            string TypeId = inputData.Rows[comboBox1.SelectedIndex]["TypeId"].ToString();
-            string TypeName = inputData.Rows[comboBox1.SelectedIndex]["TypeName"].ToString();
-            string TypeColor = inputData.Rows[comboBox1.SelectedIndex]["TypeColor"].ToString();
-            string GroupName= inputData.Rows[comboBox1.SelectedIndex]["GroupName"].ToString();
-            OutTypeAndName.Add(TypeId);
+			Random random = new Random();
+			// 生成随机颜色
+			int r = random.Next(0, 256); // 红色分量,0到255
+			int g = random.Next(0, 256); // 绿色分量,0到255
+			int b = random.Next(0, 256); // 蓝色分量,0到255
+										 // 创建Color对象
+			string hexColor = $"#{r:X2}{g:X2}{b:X2}";
+            return hexColor;
+		}
+		/// <summary>
+		/// 选择现有类别方法
+		/// </summary>
+		private void SelectExistingCategoryMethods()
+        {
+           
+			int TypeId = Convert.ToInt32(inputData.Rows[comboBox1.SelectedIndex]["STDId"]);
+			string TypeName = inputData.Rows[comboBox1.SelectedIndex]["StrName"].ToString();
+			string hexColor = inputData.Rows[comboBox1.SelectedIndex]["Color"].ToString();
+			string NewCategory = inputData.Rows[comboBox1.SelectedIndex]["GroupName"].ToString();
+			string GroupID = inputData.Rows[comboBox1.SelectedIndex]["GroupId"].ToString();
+			string GroupColor = inputData.Rows[comboBox1.SelectedIndex]["GroupColor"].ToString();
+			OutTypeAndName.Add(TypeId.ToString());
             OutTypeAndName.Add(TypeName);
-            OutTypeAndName.Add(TypeColor);
-            OutTypeAndName.Add(GroupName);
-            DoYouWantToModifyIt = true;
+            OutTypeAndName.Add(hexColor);
+            OutTypeAndName.Add(NewCategory);
+			OutTypeAndName.Add(GroupID);
+			OutTypeAndName.Add(GroupColor);
+			DoYouWantToModifyIt = true;
         }
 
         private void button1_Click(object sender, EventArgs e)

+ 62 - 6
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -3,6 +3,7 @@ using NPOI.SS.UserModel.Charts;
 using NPOI.SS.Util;
 using NPOI.XSSF.UserModel;
 using OTSCLRINTERFACE;
+using OTSCommon.DBOperate;
 using OTSCommon.DBOperate.Model;
 
 using OTSIncAReportApp;
@@ -309,7 +310,7 @@ namespace OTSIncAReportGrids
                 {
                     RemoveMergeParticles(ref particlesAll, mergeParticles);
                 }
-            }                                                                                                                        
+            }
             if (sel == (int)SelItem.MergeParticles)
             {
                 particlesAll = Particledata.GetInfoForPartucleDevidePage_mergeParticles(condition);
@@ -1611,8 +1612,60 @@ namespace OTSIncAReportGrids
                 }
             }
         }
+		/// <summary>
+		/// 读取标准库的ClassifySTD表
+		/// </summary>
+		/// <param name="a_address"></param>
+		/// <returns></returns>
+		private DataTable ReadClassification(string a_address ,string STDName)
+        {
+            DataTable dt_STDGroups = new DataTable();
+			DataTable dt_ClassifySTD = new DataTable();
+			DataTable dt_IncAData = new DataTable();
+			SqLiteHelper sh_STDGroups = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
+			dt_STDGroups = sh_STDGroups.ExecuteQuery("select * from STDGroups");
+
+            SqLiteHelper sh_ClassifySTD = new SqLiteHelper("data source='" + a_address + "\\" + STDName + ".db" + "'");
+			dt_ClassifySTD = sh_ClassifySTD.ExecuteQuery("select * from ClassifySTD");
+
+            dt_ClassifySTD.Columns.Add("GroupName");
+            dt_ClassifySTD.Columns.Add("GroupColor");
+
 
-        private void ToolStripMenuItem3_Click(object sender, EventArgs e)
+			for (int i = 0; i < dt_ClassifySTD.Rows.Count; i++)
+            {
+                for (int a = 0; a < dt_STDGroups.Rows.Count; a++)
+                {
+                    if (dt_ClassifySTD.Rows[i]["GroupId"].ToString() == dt_STDGroups.Rows[a]["id"].ToString())
+                    {
+                        dt_ClassifySTD.Rows[i]["GroupName"] = dt_STDGroups.Rows[a]["name"].ToString();
+						dt_ClassifySTD.Rows[i]["GroupColor"] = dt_STDGroups.Rows[a]["color"].ToString();
+						continue;
+					}
+                }
+            }
+
+			SqLiteHelper sh_Inclusion = new SqLiteHelper("data source='" + a_address + "\\FIELD_FILES\\Inclusion.db" + "'");
+			dt_IncAData = sh_Inclusion.ExecuteQuery("select * from IncAData");
+            for (int i = 0; i < dt_IncAData.Rows.Count; i++)
+            {
+                if (Convert.ToInt64(dt_IncAData.Rows[i]["TypeId"]) > 50000)
+                {
+					DataRow newRow = dt_ClassifySTD.NewRow();
+                    newRow["STDId"] = dt_IncAData.Rows[i]["TypeId"];
+					newRow["StrName"] = dt_IncAData.Rows[i]["TypeName"];
+					newRow["Color"] = dt_IncAData.Rows[i]["TypeColor"];
+                    newRow["GroupId"] = dt_IncAData.Rows[i]["GroupId"];
+                    newRow["GroupName"] = dt_IncAData.Rows[i]["GroupName"];
+					newRow["GroupColor"] = dt_IncAData.Rows[i]["GroupColor"];
+					dt_ClassifySTD.Rows.Add(newRow);
+				}
+            }
+
+			return dt_ClassifySTD;
+        }
+	
+		private void ToolStripMenuItem3_Click(object sender, EventArgs e)
         {
             //如果没有选中颗粒退出
             if (dgV_ParticlesDevidePage.SelectedRows.Count == 0)
@@ -1631,10 +1684,12 @@ namespace OTSIncAReportGrids
             string TypeColor = "";
             string GroupName = "";
             string GroupID = "";
+			string GroupColor = "";
 
-			DataTable da = Particledata.GetParticleListForParticlSizeID("area", "");
-            ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(da, CategoryName);
-            DialogResult result = modifyCategoryForm.ShowDialog();
+			string[] resulta = result.GetSTDName().Split('.');
+            DataTable data = ReadClassification(result.FilePath, resulta[0]);
+            ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(data, CategoryName);
+            DialogResult result1 = modifyCategoryForm.ShowDialog();
             if (modifyCategoryForm.DoYouWantToModifyIt)
             {
                 TypeId = modifyCategoryForm.OutTypeAndName[0];
@@ -1642,7 +1697,7 @@ namespace OTSIncAReportGrids
                 TypeColor = modifyCategoryForm.OutTypeAndName[2];
                 GroupName = modifyCategoryForm.OutTypeAndName[3];
                 GroupID = modifyCategoryForm.OutTypeAndName[4];
-
+				GroupColor= modifyCategoryForm.OutTypeAndName[5];
 
 				List<string> strings = new List<string>();
                 strings.Add(TypeId);
@@ -1650,6 +1705,7 @@ namespace OTSIncAReportGrids
                 strings.Add(TypeColor);
                 strings.Add(GroupName);
 				strings.Add(GroupID);
+				strings.Add(GroupColor);
 				DialogResult result2 = MessageBox.Show("是否寻找相似颗粒并重命名?", "Tip", MessageBoxButtons.YesNo);
                 if (result2 == DialogResult.Yes)
                 {

+ 105 - 50
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ElementalAnalysis.cs

@@ -1,5 +1,6 @@
 
 using OTSCommon.DBOperate;
+using OTSCommon.DBOperate.Model;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSSampleReportInfo;
 using System;
@@ -8,6 +9,7 @@ using System.Data;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static OTSDataType.otsdataconst;
 using static OTSIncAReportApp.OTSReport_Export;
 
 namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
@@ -44,54 +46,32 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             }
 
             //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
-            List<string> ClassName = new List<string>();
-			//DataTable getClass_dt = basicData.GetAllClass();
-			DataTable getClass_dt  = ReadClassification(basicData);
-            for (int i = 0; i < getClass_dt.Rows.Count; i++)
-            {
-                ClassName.Add(getClass_dt.Rows[i][1].ToString());
-
-			}
-			//bool bl = false;
-   //         for (int i = 0; i < getClass_dt.Rows.Count; i++)
-   //         {
-   //             if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
-   //             && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
-   //                 if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
-   //                 {
-   //                     if (!bl)
-   //                     {
-   //                         ClassName.Add("Default");
-   //                         bl = true;
-   //                     }
-   //                 }
-   //                 else
-   //                 {
-			//			bool isDefault = false;
-
-			//			for (int a = 0; a < ClassName.Count; a++)
-			//			{
-			//				if (getClass_dt.Rows[i]["GroupName"].ToString() == "Default")
-			//				{
-			//					isDefault = true;
-			//				}
-			//			}
-			//			if (isDefault)
-			//			{
-			//				if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
-			//				{
-			//					ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-			//				}
-			//			}
-			//			else
-			//			{
-			//				ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-			//			}
-			//		}
-   //         }
-
-            //统计元素物质大类的元素信息和面积占比
-            DataTable dt_ElementalSubstance = ElementalSubstance(AllAnalysisDetails, ClassName, basicData.getParticleData());
+
+            List<string> ClassName = ObtainParticleCategory(m_otsreport_export, basicData);
+
+			//List<string> ClassName = new List<string>();
+			////DataTable getClass_dt = basicData.GetAllClass();
+			//DataTable get_dt = ReadClassification(basicData);
+			//DataTable getClass_dt = get_dt.Clone();
+			//DataRow[] dataRow = get_dt.Select("", "iorder ASC");
+			//foreach (DataRow row in dataRow)
+			//{
+			//	if (row.ItemArray[1].ToString() != "Default")
+			//	{
+			//		getClass_dt.ImportRow(row);
+			//	}
+			//}
+
+
+			//for (int i = 0; i < getClass_dt.Rows.Count; i++)
+			//{
+			//	ClassName.Add(getClass_dt.Rows[i][1].ToString());
+			//}
+			//ClassName.Add("Default");
+		
+
+			//统计元素物质大类的元素信息和面积占比
+			DataTable dt_ElementalSubstance = ElementalSubstance(AllAnalysisDetails, ClassName, basicData.getParticleData());
             DataTable dt_ElementSorting;
             //统计元素并按照Class Name自定义列表进行排序,大类中的小类元素信息按照面积从大到小排序
             if (lingge)
@@ -117,9 +97,84 @@ DataTable dtname = new DataTable();
             datas.Add(dtname);
             datas.Add(dtData);
             datas.Add(dt_ElementSorting);
-            return datas;
+			return datas;
+		}
+		/// <summary>
+		/// 获得颗粒类别
+		/// </summary>
+		/// <returns></returns>
+		private List<string> ObtainParticleCategory(OTSReport_Export m_otsreport_export ,BasicData basicData)
+        {
+			List<string> ClassName = new List<string>();
+            if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
+            {
+                DataTable get_dt = ReadClassification(basicData);
+                DataTable getClass_dt = get_dt.Clone();
+                DataRow[] dataRow = get_dt.Select("", "iorder ASC");
+                foreach (DataRow row in dataRow)
+                {
+                    if (row.ItemArray[1].ToString() != "Default")
+                    {
+                        getClass_dt.ImportRow(row);
+                    }
+                }
+                for (int i = 0; i < getClass_dt.Rows.Count; i++)
+                {
+                    ClassName.Add(getClass_dt.Rows[i][1].ToString());
+                }
+                ClassName.Add("Default");
+
+            }
+            else
+            {
+				DataTable getClass_dt = ReadClassification(basicData);
+				for (int i = 0; i < getClass_dt.Rows.Count; i++)
+				{
+					ClassName.Add(getClass_dt.Rows[i][1].ToString());
+
+				}
+
+                bool bl = false;
+                for (int i = 0; i < getClass_dt.Rows.Count; i++)
+                {
+                    if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
+                    && getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
+                        if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
+                        {
+                            if (!bl)
+                            {
+                                ClassName.Add("Default");
+                                bl = true;
+                            }
+                        }
+                        else
+                        {
+                            bool isDefault = false;
+
+                            for (int a = 0; a < ClassName.Count; a++)
+                            {
+                                if (getClass_dt.Rows[i]["GroupName"].ToString() == "Default")
+                                {
+                                    isDefault = true;
+                                }
+                            }
+                            if (isDefault)
+                            {
+                                if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
+                                {
+                                    ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
+                                }
+                            }
+                            else
+                            {
+                                ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
+                            }
+                        }
+                }
+            }
+			return ClassName;
+		}
 
-        }
 
 		private DataTable ReadClassification(BasicData basicData)
 		{

+ 99 - 48
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ParticleAnalysis.cs

@@ -8,6 +8,7 @@ using System.Data;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using static OTSDataType.otsdataconst;
 using static OTSIncAReportApp.OTSReport_Export;
 
 namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
@@ -186,7 +187,7 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
         /// 分类整合大小分类都有
         /// </summary>
         /// <returns></returns>
-        public List<DataTable>  GetClassificationConsolidationTable(BasicData basicData)
+        public List<DataTable>  GetClassificationConsolidationTable(OTSReport_Export m_otsreport_export, BasicData basicData)
         {
             List<DataTable> datas = new List<DataTable>();
             DataTable data = basicData.GetDBData();
@@ -258,63 +259,113 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                 }
                 ls_Particel_dt.Rows.Add(dr2);
             }
-            //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
-            List<string> ClassName = new List<string>();
-			//DataTable getClass_dt = basicData.GetAllClass();
+			//按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
+			List<string> ClassName = ObtainParticleCategory(m_otsreport_export, basicData);
+			//         List<string> ClassName = new List<string>();
+			////DataTable getClass_dt = basicData.GetAllClass();
 
-			DataTable getClass_dt=ReadClassification(basicData);
+			//DataTable get_dt=ReadClassification(basicData);
+			//         DataTable getClass_dt = get_dt.Clone();
+			//DataRow[] dataRow = get_dt.Select("", "iorder ASC");
+			//         foreach (DataRow row in dataRow)
+			//         {
+			//             if (row.ItemArray[1].ToString() != "Default")
+			//             {
+			//		getClass_dt.ImportRow(row);
+			//	}
+			//}
 
-            for (int i = 0; i < getClass_dt.Rows.Count; i++)
-            {
-                ClassName.Add(getClass_dt.Rows[i][1].ToString());
 
-			}
-			//bool bl = false;
-   //         for (int i = 0; i < getClass_dt.Rows.Count; i++)
-   //         {
-   //             if (getClass_dt.Rows[i]["name"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["name"].ToString() != "Invalid"
-   //             && getClass_dt.Rows[i]["name"].ToString() != "Not Identified")
-   //                 if (getClass_dt.Rows[i]["name"].ToString() == "")
-   //                 {
-   //                     if (!bl)
-   //                     {
-   //                         ClassName.Add("Default");
-   //                         bl = true;
-   //                     }
-   //                 }
-   //                 else
-   //                 {
-   //                     bool isDefault = false;
-
-			//			for (int a = 0; a < ClassName.Count; a++)
-   //                     {
-   //                         if (getClass_dt.Rows[i]["name"].ToString() == "Default")
-   //                         {
-   //                             isDefault = true;
-			//				}
-   //                     }
-   //                     if (isDefault)
-   //                     {
-   //                         if (getClass_dt.Rows[i]["name"].ToString() != "Default")
-   //                         {
-   //                             ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-   //                         }
-   //                     }
-   //                     else
-   //                     {
-			//				ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-			//			}
-   //                 }
-   //         }
+			//	for (int i = 0; i < getClass_dt.Rows.Count; i++)
+			//         {
+			//             ClassName.Add(getClass_dt.Rows[i][1].ToString());
+			//}
+			//         ClassName.Add("Default");
 
-            //获取大分类信息
-            DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
+
+
+			//获取大分类信息
+			DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
             DataTable data2 = classIfIcationSort(ls_Particel_dt, ClassName, dt, colidCount);
             datas.Add(ls_partsize_dt.Copy());
             datas.Add(data2.Copy());
             return datas;
         }
+		/// <summary>
+		/// 获得颗粒类别
+		/// </summary>
+		/// <returns></returns>
+		private List<string> ObtainParticleCategory(OTSReport_Export m_otsreport_export, BasicData basicData)
+		{
+			List<string> ClassName = new List<string>();
+			if (m_otsreport_export.m_ReportApp.m_RptConfigFile.Systype != OTS_SysType_ID.IncA)
+			{
+				DataTable get_dt = ReadClassification(basicData);
+				DataTable getClass_dt = get_dt.Clone();
+				DataRow[] dataRow = get_dt.Select("", "iorder ASC");
+				foreach (DataRow row in dataRow)
+				{
+					if (row.ItemArray[1].ToString() != "Default")
+					{
+						getClass_dt.ImportRow(row);
+					}
+				}
+				for (int i = 0; i < getClass_dt.Rows.Count; i++)
+				{
+					ClassName.Add(getClass_dt.Rows[i][1].ToString());
+				}
+				ClassName.Add("Default");
 
+			}
+			else
+			{
+				DataTable getClass_dt = ReadClassification(basicData);
+				for (int i = 0; i < getClass_dt.Rows.Count; i++)
+				{
+					ClassName.Add(getClass_dt.Rows[i][1].ToString());
+
+				}
+
+				bool bl = false;
+				for (int i = 0; i < getClass_dt.Rows.Count; i++)
+				{
+					if (getClass_dt.Rows[i]["GroupName"].ToString() != "NOT_INCLUTION" && getClass_dt.Rows[i]["GroupName"].ToString() != "Invalid"
+					&& getClass_dt.Rows[i]["GroupName"].ToString() != "Not Identified")
+						if (getClass_dt.Rows[i]["GroupName"].ToString() == "")
+						{
+							if (!bl)
+							{
+								ClassName.Add("Default");
+								bl = true;
+							}
+						}
+						else
+						{
+							bool isDefault = false;
+
+							for (int a = 0; a < ClassName.Count; a++)
+							{
+								if (getClass_dt.Rows[i]["GroupName"].ToString() == "Default")
+								{
+									isDefault = true;
+								}
+							}
+							if (isDefault)
+							{
+								if (getClass_dt.Rows[i]["GroupName"].ToString() != "Default")
+								{
+									ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
+								}
+							}
+							else
+							{
+								ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
+							}
+						}
+				}
+			}
+			return ClassName;
+		}
 		private DataTable ReadClassification(BasicData basicData )
 		{
 			DataTable dt_stl = new DataTable();

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

@@ -1322,7 +1322,7 @@ namespace OTSIncAReportApp._1_UI.OTSTemplateDesigner
 
                 xrPageBreak1.Visible = true;
             ParticleAnalysis particleList = new ParticleAnalysis();
-            List<DataTable> CompositeData = particleList.GetClassificationConsolidationTable(basicData);
+            List<DataTable> CompositeData = particleList.GetClassificationConsolidationTable(m_otsreport_export,basicData);
             DataTable classData= particleList.GetLargeClassification(basicData);
             DataTable subdivdeData = particleList.GetSubClassification(basicData);
             DataTable chartmax= particleList.GetChartDataCalss(basicData);

+ 8 - 6
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/SqlHelper.cs

@@ -668,7 +668,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
         public KeyValuePair<string, SQLiteParameter[]> UpdateINCAEntryData(List<int> particleID,List<string> particleData)
         {
             string sSQLCommand = "Update IncAData set TypeId=@TypeId,TypeName= @TypeName," +
-				"TypeColor=@TypeColor,GroupName=@GroupName,GroupId=@GroupId where FieldID =@FieldId and XrayId =@XrayId ";  //sSQLCommand.Format(sSQLCommand,a_pParticle->GetAveGray(),a_pParticle->GetArea(),a_pParticle->GetType(),a_pParticle->GetFieldId(),a_pParticle->GetTagId());
+				"TypeColor=@TypeColor,GroupName=@GroupName,GroupId=@GroupId,GroupColor=@GroupColor where FieldID =@FieldId and XrayId =@XrayId ";  //sSQLCommand.Format(sSQLCommand,a_pParticle->GetAveGray(),a_pParticle->GetArea(),a_pParticle->GetType(),a_pParticle->GetFieldId(),a_pParticle->GetTagId());
             //using (var command = new SQLiteCommand(sSQLCommand, dbCommand.Connection))
             //{
             //    // 添加参数并赋值
@@ -685,7 +685,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             //}
 
 
-            var paras = new SQLiteParameter[7];
+            var paras = new SQLiteParameter[8];
             paras[0] = new SQLiteParameter("TypeId");
             paras[0].Value = particleData[0];
             paras[1] = new SQLiteParameter("TypeName");
@@ -696,11 +696,13 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             paras[3].Value = particleData[3];
 			paras[4] = new SQLiteParameter("GroupId");
 			paras[4].Value = particleData[4];
+			paras[5] = new SQLiteParameter("GroupColor");
+			paras[5].Value = particleData[5];
 
-			paras[5] = new SQLiteParameter("XrayId");
-            paras[5].Value = particleID[1];
-            paras[6] = new SQLiteParameter("FieldId");
-            paras[6].Value = particleID[0];
+			paras[6] = new SQLiteParameter("XrayId");
+            paras[6].Value = particleID[1];
+            paras[7] = new SQLiteParameter("FieldId");
+            paras[7].Value = particleID[0];
 
             return new KeyValuePair<string, SQLiteParameter[]>(sSQLCommand, paras);
         }