Browse Source

颗粒列表添加硬度阶段提交1

CXS 3 years ago
parent
commit
896f6b4e52

BIN
Bin/x64/Debug/Config/SysData/IncSysLib/IncASTDData.db


+ 4 - 1
Bin/x64/Debug/Resources/XMLData/AppResource_EN.xml

@@ -1395,7 +1395,10 @@
 	  <Control name="str31" text="Expansion lengthμm" />
 	  <Control name="str32" text="Expanded aspect ratio" />
 	  <Control name="str33" text="Orientation angle °" />
-    </Controls>
+      <Control name="str34" text="Hardness" />
+	  <Control name="str35" text="Density" />
+	  <Control name="str36" text="Electrical_conductivity" />
+	</Controls>
  </Form>
   <Form>
     <Name>OTSSysSTDMgrClass</Name>

+ 3 - 0
Bin/x64/Debug/Resources/XMLData/AppResource_ZH.xml

@@ -1384,6 +1384,9 @@
 	  <Control name="str31" text="展开长度μm" />
 	  <Control name="str32" text="展开长宽比" />
 	  <Control name="str33" text="朝向角度°" />
+	  <Control name="str34" text="硬度" />
+	  <Control name="str35" text="密度" />
+	  <Control name="str36" text="导电性" />
     </Controls>
  </Form>
  <Form>

+ 97 - 4
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -80,7 +80,8 @@ namespace OTSIncAReportGrids
         FieldData fieldData;
 		DataTable particlesAll;
         ParticleData Particledata;
-
+        UserLibraryData userLibrary;
+        DataTable userLibraryData;
         NLog.Logger log= NLog.LogManager.GetCurrentClassLogger();
 
         #region 分页器相关
@@ -207,6 +208,16 @@ namespace OTSIncAReportGrids
                 //m_frm_userprogress = new Frm_UserProgress();
                 fieldData = new FieldData(result.FilePath);
                 Particledata = new ParticleData(result.FilePath);
+                string str_libraryName = ((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["MsrParams"])["STDName"].ToString();
+                userLibrary = new UserLibraryData(str_libraryName);
+                if(userLibrary!=null)
+                {
+                    userLibraryData = userLibrary.GetSubAttributeFromDatabase();
+                }
+                else
+                {
+                    userLibraryData = null;
+                }
                 //初始化底层操作类
                 m_OTSIncAReportGridsFun = new OTSReportGridsFun(m_ReportApp, this);
                 return true;
@@ -279,10 +290,41 @@ namespace OTSIncAReportGrids
                 dtUelect.Columns.Add("TypeColor");
                 dtUelect.Columns.Add("SubParticles");
                 dtUelect.Columns.Add("Element");
-                for(int i=0;i< selectParticles.Count;i++)
+                dtUelect.Columns.Add("Hardness");
+                dtUelect.Columns.Add("Density");
+                dtUelect.Columns.Add("Electrical_conductivity");
+                for (int i=0;i< selectParticles.Count;i++)
                 {
-                    dtUelect.Rows.Add(selectParticles[i].FieldId, selectParticles[i].ParticleId, selectParticles[i].AveGray, selectParticles[i].RectLeft, selectParticles[i].RectTop, selectParticles[i].RectWidth, selectParticles[i].RectHeight, selectParticles[i].Area, selectParticles[i].PosX, selectParticles[i].PosX, selectParticles[i].TypeId, /*selectParticles[i].ElementNum,*/ selectParticles[i].SegmentNum, selectParticles[i].SEMPosX, selectParticles[i].SEMPosY, selectParticles[i].ParticleId, selectParticles[i].DMAX, selectParticles[i].DMIN, selectParticles[i].DPERP, selectParticles[i].PERIMETER, selectParticles[i].ORIENTATION, selectParticles[i].DINSCR, selectParticles[i].DMEAN, selectParticles[i].DELONG, selectParticles[i].DFERET, selectParticles[i].TypeName, selectParticles[i].TypeColor, "", "");
+                    dtUelect.Rows.Add(selectParticles[i].FieldId, selectParticles[i].ParticleId, selectParticles[i].AveGray, selectParticles[i].RectLeft, selectParticles[i].RectTop, selectParticles[i].RectWidth, selectParticles[i].RectHeight, selectParticles[i].Area, selectParticles[i].PosX, selectParticles[i].PosX, selectParticles[i].TypeId, /*selectParticles[i].ElementNum,*/ selectParticles[i].SegmentNum, selectParticles[i].SEMPosX, selectParticles[i].SEMPosY, selectParticles[i].ParticleId, selectParticles[i].DMAX, selectParticles[i].DMIN, selectParticles[i].DPERP, selectParticles[i].PERIMETER, selectParticles[i].ORIENTATION, selectParticles[i].DINSCR, selectParticles[i].DMEAN, selectParticles[i].DELONG, selectParticles[i].DFERET, selectParticles[i].TypeName, selectParticles[i].TypeColor, "", "", "", "", "");
                  }
+                if (userLibraryData != null)
+                {
+                    for (int i = 0; i < dtUelect.Rows.Count; i++)
+                    {
+                        DataRow[] dr = userLibraryData.Select("STDId=" + dtUelect.Rows[i]["TypeId"].ToString());
+                        if (dr.Length > 0)
+                        {
+                            dtUelect.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
+                            dtUelect.Rows[i]["Density"] = dr[0]["Density"].ToString();
+                            dtUelect.Rows[i]["Electrical_conductivity"] = dr[0]["Electrical_conductivity"].ToString();
+                        }
+                        else
+                        {
+                            dtUelect.Rows[i]["Hardness"] = "";
+                            dtUelect.Rows[i]["Density"] = "";
+                            dtUelect.Rows[i]["Electrical_conductivity"] = "";
+                        }
+                    }
+                }
+                else
+                {
+                    for (int i = 0; i < dtUelect.Rows.Count; i++)
+                    {
+                        dtUelect.Rows[i]["Hardness"] = "";
+                        dtUelect.Rows[i]["Density"] = "";
+                        dtUelect.Rows[i]["Electrical_conductivity"] = "";
+                    }
+                }
                 particlesAll = new DataTable();
                 particlesAll = dtUelect.Copy();
                 btn_Sel.Enabled = false;
@@ -292,6 +334,37 @@ namespace OTSIncAReportGrids
                 //多次测试发现 读取数据库时间耗时长,但读取条数目对读取数据库时长影响不大,故此处直接读取所有数据库信息,以取代多次连接数据库方式,优化分页速度
                 particlesAll = new DataTable();
                 particlesAll = Particledata.GetInfoForPartucleDevidePage2(condition);
+                particlesAll.Columns.Add("Hardness");
+                particlesAll.Columns.Add("Density");
+                particlesAll.Columns.Add("Electrical_conductivity");
+                if(userLibraryData != null)
+                {
+                    for(int i=0;i< particlesAll.Rows.Count;i++)
+                    {
+                        DataRow[] dr = userLibraryData.Select("STDId=" + particlesAll.Rows[i]["TypeId"].ToString());
+                        if (dr.Length>0)
+                        {
+                            particlesAll.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
+                            particlesAll.Rows[i]["Density"] = dr[0]["Density"].ToString();
+                            particlesAll.Rows[i]["Electrical_conductivity"] = dr[0]["Electrical_conductivity"].ToString();
+                        }
+                        else
+                        {
+                            particlesAll.Rows[i]["Hardness"] = "";
+                            particlesAll.Rows[i]["Density"] = "";
+                            particlesAll.Rows[i]["Electrical_conductivity"] = "";
+                        }
+                    }
+                }
+                else
+                {
+                    for (int i = 0; i < particlesAll.Rows.Count; i++)
+                    {
+                        particlesAll.Rows[i]["Hardness"] = "";
+                        particlesAll.Rows[i]["Density"] = "";
+                        particlesAll.Rows[i]["Electrical_conductivity"] = "";
+                    }
+                }
                 btn_Sel.Enabled = true;
             }
             if(particlesAll==null)
@@ -568,6 +641,18 @@ namespace OTSIncAReportGrids
                 {
                     keyValues.Add("ORIENTATION", table["str33"].ToString());
                 }
+                if (strs[i] == "Hardness")
+                {
+                    keyValues.Add("Hardness", table["str34"].ToString());
+                }
+                if (strs[i] == "Density")
+                {
+                    keyValues.Add("Density", table["str35"].ToString());
+                }
+                if (strs[i] == "Electrical_conductivity")
+                {
+                    keyValues.Add("Electrical_conductivity", table["str36"].ToString());
+                }
 
             }
             keyValues.Add("Element", "Element");
@@ -1754,7 +1839,15 @@ namespace OTSIncAReportGrids
                         else
                         {
                             //非图像列
-                            cell.SetCellValue(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString());
+                            double dbl = 0;
+                            if(double.TryParse(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString(),out dbl))
+                            {
+                                cell.SetCellValue(dbl);
+                            }
+                            else
+                            {
+                                cell.SetCellValue(dgV_ParticlesDevidePage[i_cell, i_row].Value.ToString());
+                            }
                         }
 
                     }

+ 50 - 8
OTSIncAReportApp/1-UI/OTSMgrInfo/frmReportSysConfig.Designer.cs

@@ -60,6 +60,9 @@ namespace OTSIncAReprotCharts
             this.label22 = new System.Windows.Forms.Label();
             this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.cB_Electrical_conductivity = new System.Windows.Forms.CheckBox();
+            this.cB_Density = new System.Windows.Forms.CheckBox();
+            this.cB_Hardness = new System.Windows.Forms.CheckBox();
             this.cb_ELONG = new System.Windows.Forms.CheckBox();
             this.cb_PERI = new System.Windows.Forms.CheckBox();
             this.cb_EquivalentCircleDiameter = new System.Windows.Forms.CheckBox();
@@ -257,7 +260,7 @@ namespace OTSIncAReprotCharts
             // 
             // btn_ybcsqx
             // 
-            this.btn_ybcsqx.Location = new System.Drawing.Point(592, 399);
+            this.btn_ybcsqx.Location = new System.Drawing.Point(593, 422);
             this.btn_ybcsqx.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_ybcsqx.Name = "btn_ybcsqx";
             this.btn_ybcsqx.Size = new System.Drawing.Size(89, 28);
@@ -268,7 +271,7 @@ namespace OTSIncAReprotCharts
             // 
             // btn_ybcsbc
             // 
-            this.btn_ybcsbc.Location = new System.Drawing.Point(468, 399);
+            this.btn_ybcsbc.Location = new System.Drawing.Point(484, 422);
             this.btn_ybcsbc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_ybcsbc.Name = "btn_ybcsbc";
             this.btn_ybcsbc.Size = new System.Drawing.Size(89, 28);
@@ -347,6 +350,9 @@ namespace OTSIncAReprotCharts
             // 
             // groupBox2
             // 
+            this.groupBox2.Controls.Add(this.cB_Electrical_conductivity);
+            this.groupBox2.Controls.Add(this.cB_Density);
+            this.groupBox2.Controls.Add(this.cB_Hardness);
             this.groupBox2.Controls.Add(this.cb_ELONG);
             this.groupBox2.Controls.Add(this.cb_PERI);
             this.groupBox2.Controls.Add(this.cb_EquivalentCircleDiameter);
@@ -370,11 +376,44 @@ namespace OTSIncAReprotCharts
             this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.groupBox2.Size = new System.Drawing.Size(671, 238);
+            this.groupBox2.Size = new System.Drawing.Size(671, 260);
             this.groupBox2.TabIndex = 85;
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "显示信息设置";
             // 
+            // cB_Electrical_conductivity
+            // 
+            this.cB_Electrical_conductivity.AutoSize = true;
+            this.cB_Electrical_conductivity.Location = new System.Drawing.Point(166, 241);
+            this.cB_Electrical_conductivity.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cB_Electrical_conductivity.Name = "cB_Electrical_conductivity";
+            this.cB_Electrical_conductivity.Size = new System.Drawing.Size(74, 19);
+            this.cB_Electrical_conductivity.TabIndex = 106;
+            this.cB_Electrical_conductivity.Text = "导电性";
+            this.cB_Electrical_conductivity.UseVisualStyleBackColor = true;
+            // 
+            // cB_Density
+            // 
+            this.cB_Density.AutoSize = true;
+            this.cB_Density.Location = new System.Drawing.Point(489, 210);
+            this.cB_Density.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cB_Density.Name = "cB_Density";
+            this.cB_Density.Size = new System.Drawing.Size(59, 19);
+            this.cB_Density.TabIndex = 105;
+            this.cB_Density.Text = "密度";
+            this.cB_Density.UseVisualStyleBackColor = true;
+            // 
+            // cB_Hardness
+            // 
+            this.cB_Hardness.AutoSize = true;
+            this.cB_Hardness.Location = new System.Drawing.Point(335, 210);
+            this.cB_Hardness.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.cB_Hardness.Name = "cB_Hardness";
+            this.cB_Hardness.Size = new System.Drawing.Size(59, 19);
+            this.cB_Hardness.TabIndex = 104;
+            this.cB_Hardness.Text = "硬度";
+            this.cB_Hardness.UseVisualStyleBackColor = true;
+            // 
             // cb_ELONG
             // 
             this.cb_ELONG.AutoSize = true;
@@ -400,7 +439,7 @@ namespace OTSIncAReprotCharts
             // cb_EquivalentCircleDiameter
             // 
             this.cb_EquivalentCircleDiameter.AutoSize = true;
-            this.cb_EquivalentCircleDiameter.Location = new System.Drawing.Point(166, 176);
+            this.cb_EquivalentCircleDiameter.Location = new System.Drawing.Point(166, 177);
             this.cb_EquivalentCircleDiameter.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cb_EquivalentCircleDiameter.Name = "cb_EquivalentCircleDiameter";
             this.cb_EquivalentCircleDiameter.Size = new System.Drawing.Size(120, 19);
@@ -411,7 +450,7 @@ namespace OTSIncAReprotCharts
             // cb_ASPECT_ELONG
             // 
             this.cb_ASPECT_ELONG.AutoSize = true;
-            this.cb_ASPECT_ELONG.Location = new System.Drawing.Point(489, 176);
+            this.cb_ASPECT_ELONG.Location = new System.Drawing.Point(489, 177);
             this.cb_ASPECT_ELONG.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cb_ASPECT_ELONG.Name = "cb_ASPECT_ELONG";
             this.cb_ASPECT_ELONG.Size = new System.Drawing.Size(104, 19);
@@ -422,7 +461,7 @@ namespace OTSIncAReprotCharts
             // cb_Orientation
             // 
             this.cb_Orientation.AutoSize = true;
-            this.cb_Orientation.Location = new System.Drawing.Point(335, 176);
+            this.cb_Orientation.Location = new System.Drawing.Point(335, 175);
             this.cb_Orientation.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cb_Orientation.Name = "cb_Orientation";
             this.cb_Orientation.Size = new System.Drawing.Size(104, 19);
@@ -433,7 +472,7 @@ namespace OTSIncAReprotCharts
             // cb_MEAN
             // 
             this.cb_MEAN.AutoSize = true;
-            this.cb_MEAN.Location = new System.Drawing.Point(166, 207);
+            this.cb_MEAN.Location = new System.Drawing.Point(166, 210);
             this.cb_MEAN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cb_MEAN.Name = "cb_MEAN";
             this.cb_MEAN.Size = new System.Drawing.Size(134, 19);
@@ -559,7 +598,7 @@ namespace OTSIncAReprotCharts
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(695, 435);
+            this.ClientSize = new System.Drawing.Size(701, 456);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox6);
             this.Controls.Add(this.groupBox3);
@@ -631,5 +670,8 @@ namespace OTSIncAReprotCharts
         private Label label1;
         private Label label2;
         private Button btn_xsys;
+        private CheckBox cB_Electrical_conductivity;
+        private CheckBox cB_Density;
+        private CheckBox cB_Hardness;
     }
 }

+ 15 - 0
OTSIncAReportApp/1-UI/OTSMgrInfo/frmReportSysConfig.cs

@@ -599,6 +599,21 @@ namespace OTSIncAReprotCharts
                 str_ret = str_ret + "Orientation" + ",";
             }
 
+            if (cB_Electrical_conductivity.Checked == true)
+            {
+                str_ret = str_ret + "Electrical_conductivity" + ",";
+            }
+
+            if (cB_Density.Checked == true)
+            {
+                str_ret = str_ret + "Density" + ",";
+            }
+
+            if (cB_Hardness.Checked == true)
+            {
+                str_ret = str_ret + "Hardness" + ",";
+            }
+
             if (str_ret.Length > 0)
             {
                 str_ret = str_ret.Substring(0, str_ret.Length - 1);

+ 29 - 0
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -449,6 +449,7 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             DT = dbHelper.ExecuteQuery(sqliteString);
             return DT;
         }
+
         public DataTable GetElementChemistry()
         {
             string sqliteString = "select * from ElementChemistry";
@@ -617,4 +618,32 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
 
         #endregion
     }
+
+    public class UserLibraryData
+    {
+        private SqlHelper dbHelper;
+
+        public UserLibraryData(string libraryName)
+        {
+            NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
+            string fullPath = System.IO.Directory.GetCurrentDirectory() + "\\Config\\SysData\\" + libraryName + ".db";
+            if (System.IO.File.Exists(fullPath))
+            {
+                dbHelper = new SqlHelper("data source='" + fullPath + "'");
+            }
+            else
+            {
+                dbHelper = null;
+                log.Error("Failed to load user-defined library!");
+            }
+        }
+        
+        public DataTable GetSubAttributeFromDatabase()
+        {
+            string sqliteString = "select STDId,Hardness,Density,Electrical_conductivity from ClassifySTD";
+            DataTable DT = new DataTable();
+            DT = dbHelper.ExecuteQuery(sqliteString);
+            return DT;
+        }
+    }
 }

+ 6 - 0
OTSIncAReportApp/3-ServiceCenter/DataOperation/Model/Particle.cs

@@ -122,6 +122,12 @@ namespace OTSIncAReportApp.DataOperation.Model
             set;
         }
 
+        public string Hardness { set; get; }
+
+        public string Density { set; get; }
+
+        public string Electrical_conductivity { set; get; }
+
         #region baseobject中的属性
         public bool IsMouseMove { set; get; }
         public OTSIncAReportGraph.PaintState Operator { set; get; }