Browse Source

修改报告清洁度分组信息优化,颗粒类别修改功能修改

zhangjiaxin 3 months ago
parent
commit
5b02639ad0

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

@@ -547,7 +547,8 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                 string TypeName = "";
                 string TypeColor = "";
                 string GroupName = "";
-                DataTable da = _particlesGridDevidePage.Particledata.GetParticleListForParticlSize("area", "");
+				string GroupID = "";
+				DataTable da = _particlesGridDevidePage.Particledata.GetParticleListForParticlSizeID("area", "");
                 ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(da, CategoryName);
                 DialogResult result = modifyCategoryForm.ShowDialog();
                 if (modifyCategoryForm.DoYouWantToModifyIt)
@@ -556,13 +557,15 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                     TypeName = modifyCategoryForm.OutTypeAndName[1];
                     TypeColor = modifyCategoryForm.OutTypeAndName[2];
                     GroupName = modifyCategoryForm.OutTypeAndName[3];
-
-                    _RenameInfo = new List<string>();
+					GroupID = modifyCategoryForm.OutTypeAndName[4];
+					_RenameInfo = new List<string>();
                     _RenameInfo.Add(TypeId);
                     _RenameInfo.Add(TypeName);
                     _RenameInfo.Add(TypeColor);
                     _RenameInfo.Add(GroupName);
-                }
+                    _RenameInfo.Add(GroupID);
+
+				}
                 else
                 {
                     return;

+ 8 - 5
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ModifyCategoryForm.cs

@@ -88,10 +88,11 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             int b = random.Next(0, 256); // 蓝色分量,0到255
             // 创建Color对象
             string hexColor = $"#{r:X2}{g:X2}{b:X2}";
-            string NewCategory = "New Category";
+            string NewCategory = "Default";
+            string GroupID = "0";
 
 
-            for (int i = 0; i < inputData.Rows.Count; i++)
+			for (int i = 0; i < inputData.Rows.Count; i++)
             {
                 if (textBox1.Text == inputData.Rows[i]["TypeName"].ToString())
                 {
@@ -99,7 +100,9 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                     TypeName = inputData.Rows[i]["TypeName"].ToString();
                     hexColor = inputData.Rows[i]["TypeColor"].ToString();
                     NewCategory = inputData.Rows[i]["GroupName"].ToString();
-                    break;
+					GroupID= inputData.Rows[i]["GroupId"].ToString();
+
+					break;
                 }
             }
 
@@ -107,8 +110,8 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             OutTypeAndName.Add(TypeName);
             OutTypeAndName.Add(hexColor);
             OutTypeAndName.Add(NewCategory);
-
-            DoYouWantToModifyIt = true;
+			OutTypeAndName.Add(GroupID);
+			DoYouWantToModifyIt = true;
             return true;
         }
         /// <summary>

+ 8 - 3
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -1630,7 +1630,9 @@ namespace OTSIncAReportGrids
             string TypeName = "";
             string TypeColor = "";
             string GroupName = "";
-            DataTable da = Particledata.GetParticleListForParticlSize("area", "");
+            string GroupID = "";
+
+			DataTable da = Particledata.GetParticleListForParticlSizeID("area", "");
             ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(da, CategoryName);
             DialogResult result = modifyCategoryForm.ShowDialog();
             if (modifyCategoryForm.DoYouWantToModifyIt)
@@ -1639,13 +1641,16 @@ namespace OTSIncAReportGrids
                 TypeName = modifyCategoryForm.OutTypeAndName[1];
                 TypeColor = modifyCategoryForm.OutTypeAndName[2];
                 GroupName = modifyCategoryForm.OutTypeAndName[3];
+                GroupID = modifyCategoryForm.OutTypeAndName[4];
+
 
-                List<string> strings = new List<string>();
+				List<string> strings = new List<string>();
                 strings.Add(TypeId);
                 strings.Add(TypeName);
                 strings.Add(TypeColor);
                 strings.Add(GroupName);
-                DialogResult result2 = MessageBox.Show("是否寻找相似颗粒并重命名?", "Tip", MessageBoxButtons.YesNo);
+				strings.Add(GroupID);
+				DialogResult result2 = MessageBox.Show("是否寻找相似颗粒并重命名?", "Tip", MessageBoxButtons.YesNo);
                 if (result2 == DialogResult.Yes)
                 {
                     int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);

+ 69 - 22
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ElementalAnalysis.cs

@@ -1,4 +1,5 @@
 
+using OTSCommon.DBOperate;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.OTSSampleReportInfo;
 using System;
@@ -44,25 +45,50 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
 
             //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
             List<string> ClassName = new List<string>();
-            DataTable getClass_dt = basicData.GetAllClass();
-            bool bl = false;
+			//DataTable getClass_dt = basicData.GetAllClass();
+			DataTable getClass_dt  = ReadClassification(basicData);
             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
-                    {
-                            ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-                    }
-            }
+                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());
@@ -94,7 +120,15 @@ DataTable dtname = new DataTable();
             return datas;
 
         }
-        private bool SubdivisionOfMaterialElements(DataTable a_ElementalSubstance, int NumberOfColumns, List<string> ClassName, DataTable data, out DataTable dt1, out DataTable dt2)
+
+		private DataTable ReadClassification(BasicData basicData)
+		{
+			DataTable dt_stl = new DataTable();
+			SqLiteHelper sh = new SqLiteHelper("data source='" + basicData.GetFilePath() + "\\" + basicData.GetResfile() + "'");
+			dt_stl = sh.ExecuteQuery("select * from STDGroups");
+			return dt_stl;
+		}
+		private bool SubdivisionOfMaterialElements(DataTable a_ElementalSubstance, int NumberOfColumns, List<string> ClassName, DataTable data, out DataTable dt1, out DataTable dt2)
         {
 
             DataTable dt_ElementalSubstance = new DataTable();
@@ -398,10 +432,23 @@ DataTable dtname = new DataTable();
                         dt.Rows.Add(AllAnalysisDetails.Rows[a].ItemArray);
                     }
                 }
-                if (dt.Rows.Count == 0)
-                    continue;
-                //计算出当前循环中大类物质的面积
-                ElementalSubstance = Convert.ToDouble(decimal.Parse(dt.Compute("sum(Area)", "").ToString()));
+				//if (dt.Rows.Count == 0)
+				//    continue;
+				if (dt.Rows.Count == 0)
+                {
+                    DataRow dataRow = dt.NewRow();
+                    dataRow["Area"] = 0;
+                    dt.Rows.Add(dataRow);
+
+					DataRow dataRow2 = dt_Class.NewRow();
+					dataRow2["Name"]= ClassName[i].ToString();
+                    double ar0 = 0;
+                    dataRow2["Area"] = ar0;
+                    dt_Class.Rows.Add(dataRow2);
+					continue;
+				}
+					//计算出当前循环中大类物质的面积
+					ElementalSubstance = Convert.ToDouble(decimal.Parse(dt.Compute("sum(Area)", "").ToString()));
 
                 DataTable ta = new DataTable();
                 ta = dt_Class.Copy();

+ 66 - 26
OTSIncAReportApp/1-UI/OTSReportExport/DataIntegration/ParticleAnalysis.cs

@@ -1,5 +1,6 @@
 
 
+using OTSCommon.DBOperate;
 using OTSIncAReportApp.DataOperation.DataAccess;
 using System;
 using System.Collections.Generic;
@@ -259,25 +260,52 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             }
             //按照list列表进行物质类排序,物质类中的元素分类按照面积的大小进行排序
             List<string> ClassName = new List<string>();
-            DataTable getClass_dt = basicData.GetAllClass();
-            bool bl = false;
+			//DataTable getClass_dt = basicData.GetAllClass();
+
+			DataTable getClass_dt=ReadClassification(basicData);
+
             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
-                    {
-                            ClassName.Add(getClass_dt.Rows[i]["GroupName"].ToString());
-                    }
-            }
+                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());
+			//			}
+   //                 }
+   //         }
 
             //获取大分类信息
             DataTable dt = QuantityOfIntegratedSubstances(ls_Particel_dt, ClassName);
@@ -287,13 +315,21 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
             return datas;
         }
 
-        /// <summary>
-        /// 大分类chart数据
-        /// </summary>
-        /// <param name="m_mbszclass"></param>
-        /// <param name="m_otsreport_export"></param>
-        /// <returns></returns>
-        public DataTable GetChartDataCalss(BasicData basicData)
+		private DataTable ReadClassification(BasicData basicData )
+		{
+			DataTable dt_stl = new DataTable();
+			SqLiteHelper sh = new SqLiteHelper("data source='" + basicData.GetFilePath()+ "\\"+basicData.GetResfile() + "'");
+			dt_stl = sh.ExecuteQuery("select * from STDGroups");
+			return dt_stl;
+		}
+
+		/// <summary>
+		/// 大分类chart数据
+		/// </summary>
+		/// <param name="m_mbszclass"></param>
+		/// <param name="m_otsreport_export"></param>
+		/// <returns></returns>
+		public DataTable GetChartDataCalss(BasicData basicData)
         {
             DataTable data =basicData.GetDBData();
             //获取粒级表
@@ -544,8 +580,8 @@ namespace OTSIncAReportApp._1_UI.OTSReportExport.DataIntegration
                         dt.Rows.Add(dataTable.Rows[a].ItemArray);
                     }
                 }
-                if (dt.Rows.Count == 0)
-                    continue;
+                //if (dt.Rows.Count == 0)
+                //    continue;
 
                 DataTable dt_2 = new DataTable();
                 dt_2 = dataTable.Copy();
@@ -569,6 +605,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());
                         }
+                        else
+                        {
+                            dt_2.Rows[0][dt.Columns[a].ToString()] = 0;
+						}
                     }
                   
                 }

+ 2 - 1
OTSIncAReportApp/1-UI/OTSReportExport/OTSReport_Template_CleannessA.cs

@@ -63,7 +63,8 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
 			TableHeaderData HeaderData = new TableHeaderData();
 			DataTable data = HeaderData.GetData(m_OTSReport_Export);
-			string strResultLibraryName = data.Rows[3][1].ToString()+".db";
+			string[] result = data.Rows[3][1].ToString().Split('.');
+			string strResultLibraryName = result[0] + ".db";
 			label_StandardLibraryName.Text= table["standardlibrary"].ToString() + m_OTSReport_Export.m_mbszclass.M_SY.StandardLibraryName;
             for (int i=0;i< m_OTSReport_Export.LibraryName.Count;i++)
             {

+ 35 - 6
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -145,12 +145,41 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             }
             return DT;
         }
-
-        /// <summary>
-        /// 获取element含量
-        /// </summary>
-        /// <returns></returns>
-        public DataTable GetElementForArea(string fieldAndPartic)
+		/// <summary>
+		/// 获取ParticleList
+		/// </summary>
+		/// <param name="model">Feature</param>
+		/// <returns></returns>
+		public DataTable GetParticleListForParticlSizeID(string con, string fieldAndPartic)
+		{
+
+			string sqlp = @"select TypeId,TypeName,TypeColor,count(1) as con,avg(" + con
+				+ ") as av,max(" + con
+				+ ") as max ,GroupName ,GroupId";
+			sqlp = sqlp + " from IncAData where typeid !=-1 and typeid !=4";
+			if (fieldAndPartic != "")
+			{
+				sqlp = sqlp + " and '" + fieldAndPartic + "' like ('%,'||fieldid||'-'||particleid||',%')";
+			}
+
+			sqlp = sqlp + " group by TypeId ";
+
+			DataTable DT = dbHelper.ExecuteDataTable(sqlp, null);
+
+			if (con == "area")
+			{
+				for (int i = 0; i < DT.Rows.Count; i++)
+				{
+					DT.Rows[i]["max"] = Math.Sqrt((double)DT.Rows[i]["max"] / Math.PI) * 2;
+				}
+			}
+			return DT;
+		}
+		/// <summary>
+		/// 获取element含量
+		/// </summary>
+		/// <returns></returns>
+		public DataTable GetElementForArea(string fieldAndPartic)
         {
 
             string sqlp = @"select e.name,sum(e.percentage*p.area) as earea from ElementChemistry e 

+ 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 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 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[6];
+            var paras = new SQLiteParameter[7];
             paras[0] = new SQLiteParameter("TypeId");
             paras[0].Value = particleData[0];
             paras[1] = new SQLiteParameter("TypeName");
@@ -694,11 +694,13 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             paras[2].Value = particleData[2];
             paras[3] = new SQLiteParameter("GroupName");
             paras[3].Value = particleData[3];
+			paras[4] = new SQLiteParameter("GroupId");
+			paras[4].Value = particleData[4];
 
-            paras[4] = new SQLiteParameter("XrayId");
-            paras[4].Value = particleID[1];
-            paras[5] = new SQLiteParameter("FieldId");
-            paras[5].Value = particleID[0];
+			paras[5] = new SQLiteParameter("XrayId");
+            paras[5].Value = particleID[1];
+            paras[6] = new SQLiteParameter("FieldId");
+            paras[6].Value = particleID[0];
 
             return new KeyValuePair<string, SQLiteParameter[]>(sSQLCommand, paras);
         }

+ 1 - 0
OTSIncAReportApp/OTSIncAReportApp.csproj

@@ -1672,6 +1672,7 @@
     <EmbeddedResource Include="Help.resx">
       <DependentUpon>Help.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>PublicResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>