Browse Source

报告摸板新增LOG图标选择浏览功能,修改导出BUG

zhangjiaxin 1 year ago
parent
commit
b02e310a16

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

@@ -2358,7 +2358,16 @@ namespace OTSIncAReportGrids
                             {
                                 DataRow dr = dt.NewRow();
                                 dr["fieldid"] = " fieldid = " + str_fieldid;
-                                dr["cunt"] = dataTable.Select(" fieldid = " + str_fieldid).Count();
+                                int drcunt = 0;
+                                for (int ia=0;ia< dataTable.Rows.Count;ia++)
+                                {
+                                    if (dataTable.Rows[ia]["fieldid"].ToString()== str_fieldid.ToString())
+                                    {
+                                        drcunt++;
+                                    }
+                                }
+                                dr["cunt"] = drcunt;
+                                //dr["cunt"] = dataTable.Select(" fieldid = " + str_fieldid).Count();
                                 dr["fieldName"] = nextifile.Name;
                                 dr["fieldFullName"] = nextifile.FullName;
                                 dr["id"] = str_fieldid;
@@ -2373,8 +2382,13 @@ namespace OTSIncAReportGrids
 
                 for (int i = 0; i < dt_FIeld.Rows.Count; i++)
                 {
-                    if (dataTable.Select(dt_FIeld.Rows[i]["fieldid"].ToString()).Count() > 0)
-                    {
+                    int drCount = 0;
+                    for (int ia = 0; ia < dataTable.Rows.Count; ia++)
+                        if (Convert.ToInt32(dt_FIeld.Rows[i]["id"]) == Convert.ToInt32(dataTable.Rows[ia]["fieldid"]))
+                            drCount++;
+                    //if (dataTable.Select(dt_FIeld.Rows[i]["fieldid"].ToString()).Count() > 0)
+                        if (drCount > 0)
+                        {
                         vs.Add(dt_FIeld.Rows[i]["id"].ToString());
 
                         Image img = Image.FromFile(dt_FIeld.Rows[i]["fieldFullName"].ToString());
@@ -2424,7 +2438,7 @@ namespace OTSIncAReportGrids
 
                             g.DrawString(dt_FIeld.Rows[i]["id"].ToString() + "" + str_particleid.ToString(),
                                 new Font("黑体", 8), new SolidBrush(Color.Aqua), new PointF(ls_offsetx, offset_rect.Y));
-                            var bitmap = DrawRuler(ls_fieldbp, (int)RulerPixels, 2, gauge.ToString()+ "microns");
+                            var bitmap = DrawRuler(ls_fieldbp, (int)(RulerPixels/2), 2, (gauge/2).ToString()+ "μm");
                             dt_FIeld.Rows[i]["Field_pic"] = bitmap;
                             //bitmap.Save("D:\\图片\\asd.bmp");
 

+ 2 - 2
OTSIncAReportApp/1-UI/OTSTemplateDesigner/Export_ReportTemplate.cs

@@ -363,7 +363,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             dt_Partick.Columns.Add("TypeName");
             dt_Partick.Columns.Add("TypeColor");
             dt_Partick.Columns.Add("con");
-            dt_Partick.Columns.Add("av");
+            dt_Partick.Columns.Add("ar");
             dt_Partick.Columns.Add("max");
             dt_Partick.Columns.Add("Area",typeof(double));
             dt_Partick.Columns.Add("GroupName");
@@ -394,7 +394,7 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
                 dr["TypeName"] = dt.Rows[0]["TypeName"].ToString();
                 dr["TypeColor"] = dt.Rows[0]["TypeColor"].ToString();
                 dr["con"] = dt.Rows.Count;
-                dr["av"] = dt.Compute("min(Area)", "");
+                dr["ar"] = dt.Compute("min(Area)", "");
                 dr["max"] = dt.Compute("Max(Area)", "");
                 dr["Area"] = dt.Compute("SUM(Area)", "");
                 dt_Partick.Rows.Add(dr);

+ 48 - 9
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_TemplateDesignerRM.Designer.cs

@@ -123,6 +123,9 @@
             this.groupBox9 = new System.Windows.Forms.GroupBox();
             this.label39 = new System.Windows.Forms.Label();
             this.cb_ParticleRange = new System.Windows.Forms.ComboBox();
+            this.button1217 = new System.Windows.Forms.Button();
+            this.label8312 = new System.Windows.Forms.Label();
+            this.pictureBox7 = new System.Windows.Forms.PictureBox();
             this.groupBox1.SuspendLayout();
             this.groupBox4.SuspendLayout();
             this.groupBox6.SuspendLayout();
@@ -143,6 +146,7 @@
             this.groupBox211.SuspendLayout();
             this.groupBZ.SuspendLayout();
             this.groupBox9.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
             this.SuspendLayout();
             // 
             // tb_FBT
@@ -321,7 +325,7 @@
             // 
             // tb_khh
             // 
-            this.tb_khh.Location = new System.Drawing.Point(8, 96);
+            this.tb_khh.Location = new System.Drawing.Point(7, 239);
             this.tb_khh.Margin = new System.Windows.Forms.Padding(2);
             this.tb_khh.Name = "tb_khh";
             this.tb_khh.Size = new System.Drawing.Size(250, 21);
@@ -331,7 +335,7 @@
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(6, 82);
+            this.label2.Location = new System.Drawing.Point(5, 225);
             this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(41, 12);
@@ -341,6 +345,9 @@
             // 
             // groupBox1
             // 
+            this.groupBox1.Controls.Add(this.pictureBox7);
+            this.groupBox1.Controls.Add(this.label8312);
+            this.groupBox1.Controls.Add(this.button1217);
             this.groupBox1.Controls.Add(this.ck_ym);
             this.groupBox1.Controls.Add(this.label9);
             this.groupBox1.Controls.Add(this.tb_yjwb);
@@ -351,7 +358,7 @@
             this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
-            this.groupBox1.Size = new System.Drawing.Size(263, 132);
+            this.groupBox1.Size = new System.Drawing.Size(263, 215);
             this.groupBox1.TabIndex = 0;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "页脚设置";
@@ -370,7 +377,7 @@
             this.groupBox4.Controls.Add(this.cb_klcc_jsfs);
             this.groupBox4.Controls.Add(this.label15);
             this.groupBox4.Controls.Add(this.label14);
-            this.groupBox4.Location = new System.Drawing.Point(3, 399);
+            this.groupBox4.Location = new System.Drawing.Point(3, 482);
             this.groupBox4.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox4.Name = "groupBox4";
             this.groupBox4.Padding = new System.Windows.Forms.Padding(2);
@@ -507,7 +514,7 @@
             this.groupBox6.Controls.Add(this.button4);
             this.groupBox6.Controls.Add(this.ck_ysfx_xsmk);
             this.groupBox6.Controls.Add(this.label25);
-            this.groupBox6.Location = new System.Drawing.Point(3, 622);
+            this.groupBox6.Location = new System.Drawing.Point(3, 705);
             this.groupBox6.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox6.Name = "groupBox6";
             this.groupBox6.Padding = new System.Windows.Forms.Padding(2);
@@ -586,7 +593,7 @@
             this.groupBox7.Controls.Add(this.label38);
             this.groupBox7.Controls.Add(this.label33);
             this.groupBox7.Controls.Add(this.label42);
-            this.groupBox7.Location = new System.Drawing.Point(3, 760);
+            this.groupBox7.Location = new System.Drawing.Point(3, 843);
             this.groupBox7.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox7.Name = "groupBox7";
             this.groupBox7.Padding = new System.Windows.Forms.Padding(2);
@@ -696,7 +703,7 @@
             this.groupBox8.Controls.Add(this.groupBox_px);
             this.groupBox8.Controls.Add(this.ck_kllb_xsmk);
             this.groupBox8.Controls.Add(this.label34);
-            this.groupBox8.Location = new System.Drawing.Point(3, 1191);
+            this.groupBox8.Location = new System.Drawing.Point(3, 1274);
             this.groupBox8.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox8.Name = "groupBox8";
             this.groupBox8.Padding = new System.Windows.Forms.Padding(2);
@@ -1058,7 +1065,7 @@
             this.groupBox211.Controls.Add(this.label1311);
             this.groupBox211.Controls.Add(this.label1211);
             this.groupBox211.Controls.Add(this.ck_jzwzb_surface);
-            this.groupBox211.Location = new System.Drawing.Point(3, 1725);
+            this.groupBox211.Location = new System.Drawing.Point(3, 1808);
             this.groupBox211.Name = "groupBox211";
             this.groupBox211.Size = new System.Drawing.Size(263, 81);
             this.groupBox211.TabIndex = 8;
@@ -1105,7 +1112,7 @@
             // groupBZ
             // 
             this.groupBZ.Controls.Add(this.textBox_strBZ);
-            this.groupBZ.Location = new System.Drawing.Point(3, 1812);
+            this.groupBZ.Location = new System.Drawing.Point(3, 1895);
             this.groupBZ.Name = "groupBZ";
             this.groupBZ.Size = new System.Drawing.Size(263, 139);
             this.groupBZ.TabIndex = 7;
@@ -1162,6 +1169,34 @@
             this.cb_ParticleRange.Size = new System.Drawing.Size(121, 20);
             this.cb_ParticleRange.TabIndex = 76;
             // 
+            // button1217
+            // 
+            this.button1217.Location = new System.Drawing.Point(182, 78);
+            this.button1217.Name = "button1217";
+            this.button1217.Size = new System.Drawing.Size(75, 23);
+            this.button1217.TabIndex = 53;
+            this.button1217.Text = "选择图片";
+            this.button1217.UseVisualStyleBackColor = true;
+            this.button1217.Click += new System.EventHandler(this.button1217_Click);
+            // 
+            // label8312
+            // 
+            this.label8312.AutoSize = true;
+            this.label8312.Location = new System.Drawing.Point(11, 83);
+            this.label8312.Name = "label8312";
+            this.label8312.Size = new System.Drawing.Size(47, 12);
+            this.label8312.TabIndex = 54;
+            this.label8312.Text = "LOG图标";
+            // 
+            // pictureBox7
+            // 
+            this.pictureBox7.Location = new System.Drawing.Point(8, 107);
+            this.pictureBox7.Name = "pictureBox7";
+            this.pictureBox7.Size = new System.Drawing.Size(249, 98);
+            this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureBox7.TabIndex = 55;
+            this.pictureBox7.TabStop = false;
+            // 
             // OTSReport_TemplateDesignerRM
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1213,6 +1248,7 @@
             this.groupBZ.PerformLayout();
             this.groupBox9.ResumeLayout(false);
             this.groupBox9.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -1313,5 +1349,8 @@
         private System.Windows.Forms.Label label1121ad;
         private System.Windows.Forms.CheckBox ck_klcc_xsddt;
         private System.Windows.Forms.Label label111231;
+        private System.Windows.Forms.PictureBox pictureBox7;
+        private System.Windows.Forms.Label label8312;
+        private System.Windows.Forms.Button button1217;
     }
 }

+ 55 - 1
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_TemplateDesignerRM.cs

@@ -4,6 +4,7 @@ using OTSPeriodicTable;
 using OTSRptPeriodicTable;
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Windows.Forms;
 
 namespace OTSIncAReportApp.OTSTemplateDesigner
@@ -834,8 +835,37 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
             ck_jzwzb_chart.Checked = m_OTSReport_Export.m_mbszclass.M_JZWZB.b_ck_chart;//夹杂物占比图
 
             numericMin.Text = m_OTSReport_Export.m_mbszclass.M_KLLBXX.list_int_kllb_number.ToString();
+            string str3 = System.IO.Directory.GetCurrentDirectory();
+            //Image bitmap = Image.FromFile(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
+
+            //Image bitmap = LoadImageFromFile(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
+            Bitmap decoupledImage = DecoupleImageFromFile(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
+            pictureBox7.Image = (Image)decoupledImage.Clone();
+
+            decoupledImage.Dispose();
         }
+        public static Bitmap DecoupleImageFromFile(string imagePath)
+        {
+            Bitmap decoupledImage = null;
+
+            try
+            {
+                // 从文件路径加载图片  
+                using (Image originalImage = Image.FromFile(imagePath))
+                {
+                    // 创建一个新的Bitmap对象作为副本  
+                    decoupledImage = new Bitmap(originalImage);
+                }
+            }
+            catch (Exception ex)
+            {
+                // 处理加载图片时可能出现的异常  
+                Console.WriteLine("Error loading image: " + ex.Message);
+            }
 
+            // 返回副本图片,此时原始图片文件已经被断开  
+            return decoupledImage;
+        }
         /// <summary>
         ///绑定下拉框,指定绑定的位置
         /// </summary>
@@ -962,8 +992,11 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
 
             SaveTemplateParameters();
 
+           
+            string str3 = System.IO.Directory.GetCurrentDirectory();
+        
+            pictureBox7.Image.Save(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
 
-            this.DialogResult = DialogResult.Yes;
 
             //保存到上次路径文件
             SaveFileToXml();
@@ -1042,5 +1075,26 @@ namespace OTSIncAReportApp.OTSTemplateDesigner
         {
             SetPeriodicTableControl(tb_RemoveElements, m_OTSReport_Export.m_mbszclass.M_KLLBXX.list_str_kllb_qcys);
         }
+
+        private void button1217_Click(object sender, EventArgs e)
+        {
+            // 打开文件对话框以选择图片文件  
+            using (OpenFileDialog openFileDialog = new OpenFileDialog())
+            {
+                openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif";
+                if (openFileDialog.ShowDialog() == DialogResult.OK)
+                {
+                    // 获取选中的文件路径  
+                    string filePath = openFileDialog.FileName;
+                    Bitmap bitmap = (Bitmap)Image.FromFile(filePath).Clone();
+                    //string str3 = System.IO.Directory.GetCurrentDirectory();
+                    //bitmap.Save(str3 + "\\Config\\ReportTemplate\\ReportIdentification.bmp");
+                    pictureBox7.Image.Dispose();
+                    pictureBox7.Image = (Image)bitmap.Clone();
+                    //bitmap.Dispose();
+                    
+                }
+            }
+        }
     }
 }