From 3a9d6c5e7e571a49df72790660a1056841558293 Mon Sep 17 00:00:00 2001 From: 820689062 <820689062@qq.com> Date: Tue, 23 Jul 2024 00:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E6=8F=92=E5=85=A5=EF=BC=8C?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E5=9B=BE=E5=83=8F=E9=81=AE=E6=8C=A1=E6=97=8B?= =?UTF-8?q?=E9=92=AE=EF=BC=8Cpost=E8=AF=B7=E6=B1=82=E5=BD=93=E5=A4=A9?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HisenceYoloDetection/CheckDiffSciHelper.cs | 46 +- HisenceYoloDetection/MainForm.Designer.cs | 617 ++++++++++++--------- HisenceYoloDetection/MainForm.cs | 287 ++-------- 3 files changed, 446 insertions(+), 504 deletions(-) diff --git a/HisenceYoloDetection/CheckDiffSciHelper.cs b/HisenceYoloDetection/CheckDiffSciHelper.cs index 3f1e6f9..e4f0827 100644 --- a/HisenceYoloDetection/CheckDiffSciHelper.cs +++ b/HisenceYoloDetection/CheckDiffSciHelper.cs @@ -20,6 +20,49 @@ namespace HisenceYoloDetection { public static class CheckDiffSciHelper { + public static Mat ProcessImage(Mat image, Rect fillRect) + { + // 获取图像尺寸 + int width = image.Width; + int height = image.Height; + + // 定义左下角 30x30 矩形框 + int rectSize = 30; + int rectX = 0; + int rectY = height - rectSize; // 确保是左下角 + + // 防止越界 + if (rectY < 0 || rectX < 0 || rectSize > width || rectSize > height) + { + Console.WriteLine("图像尺寸不足以获取指定区域"); + return image; + } + + Rect roi = new Rect(rectX, rectY, rectSize, rectSize); + Mat roiMat = new Mat(image, roi); + + // 计算平均颜色值 + Scalar meanColor = Cv2.Mean(roiMat); + Vec3b fillColor = new Vec3b((byte)meanColor.Val0, (byte)meanColor.Val1, (byte)meanColor.Val2); + + // 防止越界 + if (fillRect.X < 0 || fillRect.Y < 0 || fillRect.X + fillRect.Width > width || fillRect.Y + fillRect.Height > height) + { + Console.WriteLine("填充区域超出图像范围"); + return image; + } + + // 填充指定区域 + for (int y = fillRect.Y; y < fillRect.Y + fillRect.Height; y++) + { + for (int x = fillRect.X; x < fillRect.X + fillRect.Width; x++) + { + image.Set(y, x, fillColor); + } + } + + return image; + } /// /// /// @@ -37,6 +80,7 @@ namespace HisenceYoloDetection return false; } // Cv2.Resize(img1, img1, new Size(550, 270)); + img1 = ProcessImage(img1, sqlrect); Mat gimg1 = new Mat(); Cv2.CvtColor(img1, gimg1, ColorConversionCodes.BGR2GRAY); Mat thr1 = new Mat(); @@ -61,7 +105,7 @@ namespace HisenceYoloDetection return false; } // Cv2.Resize(img2, img2, new Size(550, 270)); - + img2 = ProcessImage(img2, detrect); Rect bottomleftRect= new Rect(0,img1.Height-30,30,30); Scalar avgColor1 = Cv2.Mean(new Mat(img1,bottomleftRect)); Mat gimg2 = new Mat(); diff --git a/HisenceYoloDetection/MainForm.Designer.cs b/HisenceYoloDetection/MainForm.Designer.cs index 915c796..3bb5e5b 100644 --- a/HisenceYoloDetection/MainForm.Designer.cs +++ b/HisenceYoloDetection/MainForm.Designer.cs @@ -122,6 +122,9 @@ tabPage5 = new TabPage(); panel4 = new Panel(); panel5 = new Panel(); + groupBox9 = new GroupBox(); + DevNameCombo = new ComboBox(); + ScanDevList = new Button(); groupBox2 = new GroupBox(); canvas3 = new XKRS.UI.Canvas(); canvas2 = new XKRS.UI.Canvas(); @@ -129,24 +132,27 @@ originMatShow = new PictureBox(); ResultMatShow = new PictureBox(); panel8 = new Panel(); - label24 = new Label(); - ScannerBox = new TextBox(); - textBox2 = new TextBox(); - label36 = new Label(); - textBox1 = new TextBox(); - label35 = new Label(); - 实时显示 = new Label(); + groupBox8 = new GroupBox(); + label26 = new Label(); + label18 = new Label(); + AllDSum = new TextBox(); + label19 = new Label(); + NGDNum = new TextBox(); OKOrNGShow = new PictureBox(); OKDNum = new TextBox(); label20 = new Label(); - NGDNum = new TextBox(); - label19 = new Label(); - AllDSum = new TextBox(); - label18 = new Label(); - StartDecBtn = new Button(); - ScanDevList = new Button(); - DevNameCombo = new ComboBox(); + textBox1 = new TextBox(); + label35 = new Label(); + groupBox7 = new GroupBox(); InitMachine = new Button(); + StartDecBtn = new Button(); + CloseDecBtn = new Button(); + groupBox6 = new GroupBox(); + textBox3 = new TextBox(); + label25 = new Label(); + label24 = new Label(); + ScannerBox = new TextBox(); + linkLabel1 = new LinkLabel(); tabPage3 = new TabPage(); panel2 = new Panel(); button1 = new Button(); @@ -184,7 +190,6 @@ timer6 = new System.Windows.Forms.Timer(components); richTextBox1 = new RichTextBox(); backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); - CloseDecBtn = new Button(); tabPage2.SuspendLayout(); panel1.SuspendLayout(); groupBox5.SuspendLayout(); @@ -197,11 +202,15 @@ tabPage5.SuspendLayout(); panel4.SuspendLayout(); panel5.SuspendLayout(); + groupBox9.SuspendLayout(); groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)originMatShow).BeginInit(); ((System.ComponentModel.ISupportInitialize)ResultMatShow).BeginInit(); panel8.SuspendLayout(); + groupBox8.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)OKOrNGShow).BeginInit(); + groupBox7.SuspendLayout(); + groupBox6.SuspendLayout(); tabPage3.SuspendLayout(); panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)InsertDataDgv).BeginInit(); @@ -210,11 +219,11 @@ // tabPage2 // tabPage2.Controls.Add(panel1); - tabPage2.Location = new Point(4, 26); + tabPage2.Location = new Point(4, 33); tabPage2.Margin = new Padding(4, 2, 4, 2); tabPage2.Name = "tabPage2"; tabPage2.Padding = new Padding(4, 2, 4, 2); - tabPage2.Size = new Size(1276, 719); + tabPage2.Size = new Size(1306, 816); tabPage2.TabIndex = 1; tabPage2.Text = "PLC"; tabPage2.UseVisualStyleBackColor = true; @@ -262,7 +271,7 @@ DistanceShow.Margin = new Padding(4, 2, 4, 2); DistanceShow.Name = "DistanceShow"; DistanceShow.ReadOnly = true; - DistanceShow.Size = new Size(127, 23); + DistanceShow.Size = new Size(127, 31); DistanceShow.TabIndex = 10; // // label21 @@ -271,7 +280,7 @@ label21.Location = new Point(36, 31); label21.Margin = new Padding(4, 0, 4, 0); label21.Name = "label21"; - label21.Size = new Size(36, 17); + label21.Size = new Size(54, 25); label21.TabIndex = 0; label21.Text = "测距"; // @@ -280,7 +289,7 @@ txtSetValue.Location = new Point(738, 73); txtSetValue.Margin = new Padding(4, 2, 4, 2); txtSetValue.Name = "txtSetValue"; - txtSetValue.Size = new Size(251, 23); + txtSetValue.Size = new Size(251, 31); txtSetValue.TabIndex = 14; // // groupBox4 @@ -349,7 +358,7 @@ SetlnEditmiZOP.Location = new Point(526, 296); SetlnEditmiZOP.Margin = new Padding(4, 2, 4, 2); SetlnEditmiZOP.Name = "SetlnEditmiZOP"; - SetlnEditmiZOP.Size = new Size(127, 23); + SetlnEditmiZOP.Size = new Size(127, 31); SetlnEditmiZOP.TabIndex = 27; // // SetlnEditmiYOP @@ -357,7 +366,7 @@ SetlnEditmiYOP.Location = new Point(329, 296); SetlnEditmiYOP.Margin = new Padding(4, 2, 4, 2); SetlnEditmiYOP.Name = "SetlnEditmiYOP"; - SetlnEditmiYOP.Size = new Size(127, 23); + SetlnEditmiYOP.Size = new Size(127, 31); SetlnEditmiYOP.TabIndex = 26; // // SetlnEditmiXOP @@ -365,7 +374,7 @@ SetlnEditmiXOP.Location = new Point(138, 296); SetlnEditmiXOP.Margin = new Padding(4, 2, 4, 2); SetlnEditmiXOP.Name = "SetlnEditmiXOP"; - SetlnEditmiXOP.Size = new Size(127, 23); + SetlnEditmiXOP.Size = new Size(127, 31); SetlnEditmiXOP.TabIndex = 25; // // SetlnEditmiZH @@ -373,7 +382,7 @@ SetlnEditmiZH.Location = new Point(526, 242); SetlnEditmiZH.Margin = new Padding(4, 2, 4, 2); SetlnEditmiZH.Name = "SetlnEditmiZH"; - SetlnEditmiZH.Size = new Size(127, 23); + SetlnEditmiZH.Size = new Size(127, 31); SetlnEditmiZH.TabIndex = 23; // // SetlnEditmiYH @@ -381,7 +390,7 @@ SetlnEditmiYH.Location = new Point(329, 242); SetlnEditmiYH.Margin = new Padding(4, 2, 4, 2); SetlnEditmiYH.Name = "SetlnEditmiYH"; - SetlnEditmiYH.Size = new Size(127, 23); + SetlnEditmiYH.Size = new Size(127, 31); SetlnEditmiYH.TabIndex = 22; // // SetlnEditmiXH @@ -389,7 +398,7 @@ SetlnEditmiXH.Location = new Point(138, 242); SetlnEditmiXH.Margin = new Padding(4, 2, 4, 2); SetlnEditmiXH.Name = "SetlnEditmiXH"; - SetlnEditmiXH.Size = new Size(127, 23); + SetlnEditmiXH.Size = new Size(127, 31); SetlnEditmiXH.TabIndex = 21; // // lnEditmiZOP @@ -397,7 +406,7 @@ lnEditmiZOP.Location = new Point(526, 189); lnEditmiZOP.Margin = new Padding(4, 2, 4, 2); lnEditmiZOP.Name = "lnEditmiZOP"; - lnEditmiZOP.Size = new Size(127, 23); + lnEditmiZOP.Size = new Size(127, 31); lnEditmiZOP.TabIndex = 19; // // lnEditmiYOP @@ -405,7 +414,7 @@ lnEditmiYOP.Location = new Point(329, 189); lnEditmiYOP.Margin = new Padding(4, 2, 4, 2); lnEditmiYOP.Name = "lnEditmiYOP"; - lnEditmiYOP.Size = new Size(127, 23); + lnEditmiYOP.Size = new Size(127, 31); lnEditmiYOP.TabIndex = 18; // // lnEditmiXOP @@ -413,7 +422,7 @@ lnEditmiXOP.Location = new Point(138, 189); lnEditmiXOP.Margin = new Padding(4, 2, 4, 2); lnEditmiXOP.Name = "lnEditmiXOP"; - lnEditmiXOP.Size = new Size(127, 23); + lnEditmiXOP.Size = new Size(127, 31); lnEditmiXOP.TabIndex = 17; // // label17 @@ -422,7 +431,7 @@ label17.Location = new Point(41, 191); label17.Margin = new Padding(4, 0, 4, 0); label17.Name = "label17"; - label17.Size = new Size(64, 17); + label17.Size = new Size(96, 25); label17.TabIndex = 16; label17.Text = "定位位置"; // @@ -432,7 +441,7 @@ lnEditmiZS.Margin = new Padding(4, 2, 4, 2); lnEditmiZS.Name = "lnEditmiZS"; lnEditmiZS.ReadOnly = true; - lnEditmiZS.Size = new Size(127, 23); + lnEditmiZS.Size = new Size(127, 31); lnEditmiZS.TabIndex = 15; // // lnEditmiYS @@ -441,7 +450,7 @@ lnEditmiYS.Margin = new Padding(4, 2, 4, 2); lnEditmiYS.Name = "lnEditmiYS"; lnEditmiYS.ReadOnly = true; - lnEditmiYS.Size = new Size(127, 23); + lnEditmiYS.Size = new Size(127, 31); lnEditmiYS.TabIndex = 14; // // lnEditmiXS @@ -450,7 +459,7 @@ lnEditmiXS.Margin = new Padding(4, 2, 4, 2); lnEditmiXS.Name = "lnEditmiXS"; lnEditmiXS.ReadOnly = true; - lnEditmiXS.Size = new Size(127, 23); + lnEditmiXS.Size = new Size(127, 31); lnEditmiXS.TabIndex = 13; // // label16 @@ -459,7 +468,7 @@ label16.Location = new Point(10, 138); label16.Margin = new Padding(4, 0, 4, 0); label16.Name = "label16"; - label16.Size = new Size(92, 17); + label16.Size = new Size(138, 25); label16.TabIndex = 12; label16.Text = "当前定位速度"; // @@ -469,7 +478,7 @@ lnEditmiZHS.Margin = new Padding(4, 2, 4, 2); lnEditmiZHS.Name = "lnEditmiZHS"; lnEditmiZHS.ReadOnly = true; - lnEditmiZHS.Size = new Size(127, 23); + lnEditmiZHS.Size = new Size(127, 31); lnEditmiZHS.TabIndex = 11; // // lnEditmiYHS @@ -478,7 +487,7 @@ lnEditmiYHS.Margin = new Padding(4, 2, 4, 2); lnEditmiYHS.Name = "lnEditmiYHS"; lnEditmiYHS.ReadOnly = true; - lnEditmiYHS.Size = new Size(127, 23); + lnEditmiYHS.Size = new Size(127, 31); lnEditmiYHS.TabIndex = 10; // // lnEditmiXHS @@ -487,7 +496,7 @@ lnEditmiXHS.Margin = new Padding(4, 2, 4, 2); lnEditmiXHS.Name = "lnEditmiXHS"; lnEditmiXHS.ReadOnly = true; - lnEditmiXHS.Size = new Size(127, 23); + lnEditmiXHS.Size = new Size(127, 31); lnEditmiXHS.TabIndex = 9; // // label15 @@ -496,7 +505,7 @@ label15.Location = new Point(10, 85); label15.Margin = new Padding(4, 0, 4, 0); label15.Name = "label15"; - label15.Size = new Size(92, 17); + label15.Size = new Size(138, 25); label15.TabIndex = 8; label15.Text = "当前手动速度"; // @@ -506,7 +515,7 @@ ZPostion.Location = new Point(580, 42); ZPostion.Margin = new Padding(4, 0, 4, 0); ZPostion.Name = "ZPostion"; - ZPostion.Size = new Size(16, 17); + ZPostion.Size = new Size(24, 25); ZPostion.TabIndex = 7; ZPostion.Text = "0"; // @@ -516,7 +525,7 @@ YPostion.Location = new Point(386, 42); YPostion.Margin = new Padding(4, 0, 4, 0); YPostion.Name = "YPostion"; - YPostion.Size = new Size(16, 17); + YPostion.Size = new Size(24, 25); YPostion.TabIndex = 6; YPostion.Text = "0"; // @@ -526,7 +535,7 @@ XPostion.Location = new Point(185, 42); XPostion.Margin = new Padding(4, 0, 4, 0); XPostion.Name = "XPostion"; - XPostion.Size = new Size(16, 17); + XPostion.Size = new Size(24, 25); XPostion.TabIndex = 5; XPostion.Text = "0"; // @@ -536,7 +545,7 @@ XCurrentPostion.Location = new Point(170, 42); XCurrentPostion.Margin = new Padding(4, 0, 4, 0); XCurrentPostion.Name = "XCurrentPostion"; - XCurrentPostion.Size = new Size(0, 17); + XCurrentPostion.Size = new Size(0, 25); XCurrentPostion.TabIndex = 4; // // label14 @@ -545,7 +554,7 @@ label14.Location = new Point(580, 21); label14.Margin = new Padding(4, 0, 4, 0); label14.Name = "label14"; - label14.Size = new Size(17, 17); + label14.Size = new Size(25, 25); label14.TabIndex = 3; label14.Text = "Z"; // @@ -555,7 +564,7 @@ label13.Location = new Point(386, 18); label13.Margin = new Padding(4, 0, 4, 0); label13.Name = "label13"; - label13.Size = new Size(17, 17); + label13.Size = new Size(27, 25); label13.TabIndex = 2; label13.Text = "Y"; // @@ -565,7 +574,7 @@ label12.Location = new Point(184, 18); label12.Margin = new Padding(4, 0, 4, 0); label12.Name = "label12"; - label12.Size = new Size(17, 17); + label12.Size = new Size(26, 25); label12.TabIndex = 1; label12.Text = "X"; // @@ -575,7 +584,7 @@ label11.Location = new Point(41, 42); label11.Margin = new Padding(4, 0, 4, 0); label11.Name = "label11"; - label11.Size = new Size(64, 17); + label11.Size = new Size(96, 25); label11.TabIndex = 0; label11.Text = "当前位置"; // @@ -781,7 +790,7 @@ writePLCValue.Location = new Point(861, 9); writePLCValue.Margin = new Padding(4, 2, 4, 2); writePLCValue.Name = "writePLCValue"; - writePLCValue.Size = new Size(127, 23); + writePLCValue.Size = new Size(127, 31); writePLCValue.TabIndex = 11; // // label9 @@ -790,7 +799,7 @@ label9.Location = new Point(514, 49); label9.Margin = new Padding(4, 0, 4, 0); label9.Name = "label9"; - label9.Size = new Size(22, 17); + label9.Size = new Size(33, 25); label9.TabIndex = 10; label9.Text = "值"; // @@ -800,7 +809,7 @@ label10.Location = new Point(514, 15); label10.Margin = new Padding(4, 0, 4, 0); label10.Name = "label10"; - label10.Size = new Size(36, 17); + label10.Size = new Size(54, 25); label10.TabIndex = 9; label10.Text = "地址"; // @@ -820,7 +829,7 @@ PLCValue.Location = new Point(577, 43); PLCValue.Margin = new Padding(4, 2, 4, 2); PLCValue.Name = "PLCValue"; - PLCValue.Size = new Size(127, 23); + PLCValue.Size = new Size(127, 31); PLCValue.TabIndex = 8; // // WriteAdress @@ -828,7 +837,7 @@ WriteAdress.Location = new Point(577, 13); WriteAdress.Margin = new Padding(4, 2, 4, 2); WriteAdress.Name = "WriteAdress"; - WriteAdress.Size = new Size(127, 23); + WriteAdress.Size = new Size(127, 31); WriteAdress.TabIndex = 6; // // label6 @@ -837,7 +846,7 @@ label6.Location = new Point(162, 51); label6.Margin = new Padding(4, 0, 4, 0); label6.Name = "label6"; - label6.Size = new Size(22, 17); + label6.Size = new Size(33, 25); label6.TabIndex = 5; label6.Text = "值"; // @@ -847,7 +856,7 @@ label3.Location = new Point(162, 18); label3.Margin = new Padding(4, 0, 4, 0); label3.Name = "label3"; - label3.Size = new Size(36, 17); + label3.Size = new Size(54, 25); label3.TabIndex = 4; label3.Text = "地址"; // @@ -878,7 +887,7 @@ showPLC.Location = new Point(225, 46); showPLC.Margin = new Padding(4, 2, 4, 2); showPLC.Name = "showPLC"; - showPLC.Size = new Size(127, 23); + showPLC.Size = new Size(127, 31); showPLC.TabIndex = 3; // // readPLc @@ -886,18 +895,18 @@ readPLc.Location = new Point(225, 15); readPLc.Margin = new Padding(4, 2, 4, 2); readPLc.Name = "readPLc"; - readPLc.Size = new Size(127, 23); + readPLc.Size = new Size(127, 31); readPLc.TabIndex = 1; // // tabPage1 // tabPage1.Controls.Add(groupBox3); tabPage1.Controls.Add(groupBox1); - tabPage1.Location = new Point(4, 26); + tabPage1.Location = new Point(4, 34); tabPage1.Margin = new Padding(4, 2, 4, 2); tabPage1.Name = "tabPage1"; tabPage1.Padding = new Padding(4, 2, 4, 2); - tabPage1.Size = new Size(1276, 719); + tabPage1.Size = new Size(1306, 815); tabPage1.TabIndex = 0; tabPage1.Text = "相机"; tabPage1.UseVisualStyleBackColor = true; @@ -961,7 +970,7 @@ label5.Location = new Point(257, 18); label5.Margin = new Padding(4, 0, 4, 0); label5.Name = "label5"; - label5.Size = new Size(64, 17); + label5.Size = new Size(96, 25); label5.TabIndex = 2; label5.Text = "链接相机"; // @@ -992,7 +1001,7 @@ tbGain2.Location = new Point(93, 54); tbGain2.Margin = new Padding(4, 2, 4, 2); tbGain2.Name = "tbGain2"; - tbGain2.Size = new Size(127, 23); + tbGain2.Size = new Size(127, 31); tbGain2.TabIndex = 4; // // tbExposure2 @@ -1000,7 +1009,7 @@ tbExposure2.Location = new Point(93, 22); tbExposure2.Margin = new Padding(4, 2, 4, 2); tbExposure2.Name = "tbExposure2"; - tbExposure2.Size = new Size(127, 23); + tbExposure2.Size = new Size(127, 31); tbExposure2.TabIndex = 3; // // label7 @@ -1009,7 +1018,7 @@ label7.Location = new Point(15, 56); label7.Margin = new Padding(4, 0, 4, 0); label7.Name = "label7"; - label7.Size = new Size(36, 17); + label7.Size = new Size(54, 25); label7.TabIndex = 1; label7.Text = "增益"; // @@ -1019,7 +1028,7 @@ label8.Location = new Point(15, 24); label8.Margin = new Padding(4, 0, 4, 0); label8.Name = "label8"; - label8.Size = new Size(36, 17); + label8.Size = new Size(54, 25); label8.TabIndex = 0; label8.Text = "曝光"; // @@ -1084,7 +1093,7 @@ label1.Location = new Point(257, 18); label1.Margin = new Padding(4, 0, 4, 0); label1.Name = "label1"; - label1.Size = new Size(64, 17); + label1.Size = new Size(96, 25); label1.TabIndex = 2; label1.Text = "链接相机"; // @@ -1115,7 +1124,7 @@ tbGain.Location = new Point(93, 54); tbGain.Margin = new Padding(4, 2, 4, 2); tbGain.Name = "tbGain"; - tbGain.Size = new Size(127, 23); + tbGain.Size = new Size(127, 31); tbGain.TabIndex = 4; // // tbExposure @@ -1123,7 +1132,7 @@ tbExposure.Location = new Point(93, 22); tbExposure.Margin = new Padding(4, 2, 4, 2); tbExposure.Name = "tbExposure"; - tbExposure.Size = new Size(127, 23); + tbExposure.Size = new Size(127, 31); tbExposure.TabIndex = 3; // // label2 @@ -1132,7 +1141,7 @@ label2.Location = new Point(15, 56); label2.Margin = new Padding(4, 0, 4, 0); label2.Name = "label2"; - label2.Size = new Size(36, 17); + label2.Size = new Size(54, 25); label2.TabIndex = 1; label2.Text = "增益"; // @@ -1142,7 +1151,7 @@ label4.Location = new Point(15, 24); label4.Margin = new Padding(4, 0, 4, 0); label4.Name = "label4"; - label4.Size = new Size(36, 17); + label4.Size = new Size(54, 25); label4.TabIndex = 0; label4.Text = "曝光"; // @@ -1157,16 +1166,17 @@ tabControl1.Margin = new Padding(4, 2, 4, 2); tabControl1.Name = "tabControl1"; tabControl1.SelectedIndex = 0; - tabControl1.Size = new Size(1284, 749); + tabControl1.Size = new Size(1314, 853); tabControl1.TabIndex = 0; + tabControl1.SelectedIndexChanged += tabControl1_SelectedIndexChanged; // // tabPage5 // tabPage5.Controls.Add(panel4); - tabPage5.Location = new Point(4, 26); + tabPage5.Location = new Point(4, 34); tabPage5.Margin = new Padding(4, 2, 4, 2); tabPage5.Name = "tabPage5"; - tabPage5.Size = new Size(1276, 719); + tabPage5.Size = new Size(1306, 815); tabPage5.TabIndex = 3; tabPage5.Text = "流程"; tabPage5.UseVisualStyleBackColor = true; @@ -1178,20 +1188,52 @@ panel4.Location = new Point(0, 0); panel4.Margin = new Padding(4, 2, 4, 2); panel4.Name = "panel4"; - panel4.Size = new Size(1276, 719); + panel4.Size = new Size(1306, 815); panel4.TabIndex = 0; // // panel5 // + panel5.Controls.Add(groupBox9); panel5.Controls.Add(groupBox2); panel5.Controls.Add(panel8); panel5.Dock = DockStyle.Top; panel5.Location = new Point(0, 0); panel5.Margin = new Padding(4, 2, 4, 2); panel5.Name = "panel5"; - panel5.Size = new Size(1276, 718); + panel5.Size = new Size(1306, 813); panel5.TabIndex = 0; // + // groupBox9 + // + groupBox9.Controls.Add(DevNameCombo); + groupBox9.Controls.Add(ScanDevList); + groupBox9.Location = new Point(8, 16); + groupBox9.Name = "groupBox9"; + groupBox9.Size = new Size(658, 78); + groupBox9.TabIndex = 25; + groupBox9.TabStop = false; + groupBox9.Text = "设备状态"; + // + // DevNameCombo + // + DevNameCombo.FormattingEnabled = true; + DevNameCombo.Location = new Point(7, 33); + DevNameCombo.Margin = new Padding(4, 2, 4, 2); + DevNameCombo.Name = "DevNameCombo"; + DevNameCombo.Size = new Size(386, 33); + DevNameCombo.TabIndex = 1; + // + // ScanDevList + // + ScanDevList.Location = new Point(424, 32); + ScanDevList.Margin = new Padding(4, 2, 4, 2); + ScanDevList.Name = "ScanDevList"; + ScanDevList.Size = new Size(94, 35); + ScanDevList.TabIndex = 2; + ScanDevList.Text = "Scan"; + ScanDevList.UseVisualStyleBackColor = true; + ScanDevList.Click += ScanDevList_Click; + // // groupBox2 // groupBox2.AutoSize = true; @@ -1200,14 +1242,14 @@ groupBox2.Controls.Add(canvas1); groupBox2.Controls.Add(originMatShow); groupBox2.Controls.Add(ResultMatShow); - groupBox2.Location = new Point(0, 0); + groupBox2.Location = new Point(8, 120); groupBox2.Margin = new Padding(4, 2, 4, 2); groupBox2.Name = "groupBox2"; groupBox2.Padding = new Padding(4, 2, 4, 2); - groupBox2.Size = new Size(738, 736); + groupBox2.Size = new Size(669, 686); groupBox2.TabIndex = 0; groupBox2.TabStop = false; - groupBox2.Text = "图片"; + groupBox2.Text = "结果展示"; groupBox2.Enter += groupBox2_Enter; // // canvas3 @@ -1218,12 +1260,13 @@ mat1.IsEnabledDispose = true; canvas3.ImaMAt = mat1; canvas3.ImgData = null; - canvas3.Location = new Point(8, 467); + canvas3.Location = new Point(8, 454); + canvas3.Margin = new Padding(5, 4, 5, 4); canvas3.MoveStep = 5F; canvas3.Name = "canvas3"; canvas3.Route = 0D; canvas3.Scale = 1D; - canvas3.Size = new Size(351, 223); + canvas3.Size = new Size(280, 202); canvas3.TabIndex = 6; canvas3.WholeScale = 0F; canvas3.XMove = 0F; @@ -1239,18 +1282,20 @@ mat2.IsEnabledDispose = true; canvas2.ImaMAt = mat2; canvas2.ImgData = null; - canvas2.Location = new Point(367, 240); + canvas2.Location = new Point(367, 251); + canvas2.Margin = new Padding(5, 4, 5, 4); canvas2.MoveStep = 5F; canvas2.Name = "canvas2"; canvas2.Route = 0D; canvas2.Scale = 1D; - canvas2.Size = new Size(363, 205); + canvas2.Size = new Size(288, 195); canvas2.TabIndex = 5; canvas2.WholeScale = 0F; canvas2.XMove = 0F; canvas2.XScale = 0F; canvas2.YMove = 0F; canvas2.YScale = 0F; + canvas2.Load += canvas2_Load; // // canvas1 // @@ -1260,12 +1305,13 @@ mat3.IsEnabledDispose = true; canvas1.ImaMAt = mat3; canvas1.ImgData = null; - canvas1.Location = new Point(8, 237); + canvas1.Location = new Point(8, 248); + canvas1.Margin = new Padding(5, 4, 5, 4); canvas1.MoveStep = 5F; canvas1.Name = "canvas1"; canvas1.Route = 0D; canvas1.Scale = 1D; - canvas1.Size = new Size(351, 208); + canvas1.Size = new Size(280, 198); canvas1.TabIndex = 4; canvas1.WholeScale = 0F; canvas1.XMove = 0F; @@ -1276,233 +1322,266 @@ // // originMatShow // - originMatShow.Location = new Point(8, 21); + originMatShow.Location = new Point(7, 31); originMatShow.Margin = new Padding(4, 2, 4, 2); originMatShow.Name = "originMatShow"; - originMatShow.Size = new Size(351, 200); + originMatShow.Size = new Size(280, 200); originMatShow.SizeMode = PictureBoxSizeMode.StretchImage; originMatShow.TabIndex = 3; originMatShow.TabStop = false; // // ResultMatShow // - ResultMatShow.Location = new Point(367, 21); + ResultMatShow.Location = new Point(367, 31); ResultMatShow.Margin = new Padding(4, 2, 4, 2); ResultMatShow.Name = "ResultMatShow"; - ResultMatShow.Size = new Size(363, 200); + ResultMatShow.Size = new Size(288, 200); ResultMatShow.SizeMode = PictureBoxSizeMode.StretchImage; ResultMatShow.TabIndex = 2; ResultMatShow.TabStop = false; // // panel8 // - panel8.Controls.Add(CloseDecBtn); - panel8.Controls.Add(label24); - panel8.Controls.Add(ScannerBox); - panel8.Controls.Add(textBox2); - panel8.Controls.Add(label36); - panel8.Controls.Add(textBox1); - panel8.Controls.Add(label35); - panel8.Controls.Add(实时显示); - panel8.Controls.Add(OKOrNGShow); - panel8.Controls.Add(OKDNum); - panel8.Controls.Add(label20); - panel8.Controls.Add(NGDNum); - panel8.Controls.Add(label19); - panel8.Controls.Add(AllDSum); - panel8.Controls.Add(label18); - panel8.Controls.Add(StartDecBtn); - panel8.Controls.Add(ScanDevList); - panel8.Controls.Add(DevNameCombo); - panel8.Controls.Add(InitMachine); - panel8.Location = new Point(738, 0); + panel8.Controls.Add(groupBox8); + panel8.Controls.Add(groupBox7); + panel8.Controls.Add(groupBox6); + panel8.Controls.Add(linkLabel1); + panel8.Location = new Point(673, 0); panel8.Margin = new Padding(4, 2, 4, 2); panel8.Name = "panel8"; - panel8.Size = new Size(905, 718); + panel8.Size = new Size(633, 806); panel8.TabIndex = 2; panel8.Paint += panel8_Paint; // - // label24 + // groupBox8 // - label24.AutoSize = true; - label24.Location = new Point(33, 287); - label24.Margin = new Padding(4, 0, 4, 0); - label24.Name = "label24"; - label24.Size = new Size(50, 17); - label24.TabIndex = 19; - label24.Text = "扫码器"; + groupBox8.Controls.Add(label26); + groupBox8.Controls.Add(label18); + groupBox8.Controls.Add(AllDSum); + groupBox8.Controls.Add(label19); + groupBox8.Controls.Add(NGDNum); + groupBox8.Controls.Add(OKOrNGShow); + groupBox8.Controls.Add(OKDNum); + groupBox8.Controls.Add(label20); + groupBox8.Controls.Add(textBox1); + groupBox8.Controls.Add(label35); + groupBox8.Location = new Point(11, 304); + groupBox8.Name = "groupBox8"; + groupBox8.Size = new Size(614, 484); + groupBox8.TabIndex = 24; + groupBox8.TabStop = false; + groupBox8.Text = "生产信息"; // - // ScannerBox + // label26 // - ScannerBox.Location = new Point(91, 284); - ScannerBox.Margin = new Padding(4, 2, 4, 2); - ScannerBox.Name = "ScannerBox"; - ScannerBox.ReadOnly = true; - ScannerBox.Size = new Size(255, 23); - ScannerBox.TabIndex = 18; + label26.AutoSize = true; + label26.Font = new Font("黑体", 22F, FontStyle.Regular, GraphicsUnit.Point); + label26.Location = new Point(42, 262); + label26.Margin = new Padding(4, 0, 4, 0); + label26.Name = "label26"; + label26.Size = new Size(195, 44); + label26.TabIndex = 16; + label26.Text = "检测结果"; // - // textBox2 + // label18 // - textBox2.Location = new Point(437, 287); - textBox2.Margin = new Padding(4, 2, 4, 2); - textBox2.Name = "textBox2"; - textBox2.ReadOnly = true; - textBox2.Size = new Size(82, 23); - textBox2.TabIndex = 17; + label18.AutoSize = true; + label18.Location = new Point(7, 67); + label18.Margin = new Padding(4, 0, 4, 0); + label18.Name = "label18"; + label18.Size = new Size(96, 25); + label18.TabIndex = 5; + label18.Text = "总产量数"; + label18.Click += label18_Click; // - // label36 + // AllDSum // - label36.AutoSize = true; - label36.Location = new Point(353, 290); - label36.Name = "label36"; - label36.Size = new Size(64, 17); - label36.TabIndex = 16; - label36.Text = "日误检率"; + AllDSum.Location = new Point(111, 64); + AllDSum.Margin = new Padding(4, 2, 4, 2); + AllDSum.Name = "AllDSum"; + AllDSum.ReadOnly = true; + AllDSum.Size = new Size(74, 31); + AllDSum.TabIndex = 6; // - // textBox1 + // label19 // - textBox1.Location = new Point(437, 237); - textBox1.Margin = new Padding(4, 2, 4, 2); - textBox1.Name = "textBox1"; - textBox1.ReadOnly = true; - textBox1.Size = new Size(82, 23); - textBox1.TabIndex = 15; + label19.AutoSize = true; + label19.Location = new Point(205, 96); + label19.Margin = new Padding(4, 0, 4, 0); + label19.Name = "label19"; + label19.Size = new Size(106, 25); + label19.TabIndex = 7; + label19.Text = "NG产品数"; // - // label35 + // NGDNum // - label35.AutoSize = true; - label35.Location = new Point(353, 240); - label35.Name = "label35"; - label35.Size = new Size(50, 17); - label35.TabIndex = 14; - label35.Text = "误检率"; - // - // 实时显示 - // - 实时显示.AutoSize = true; - 实时显示.Location = new Point(427, 24); - 实时显示.Margin = new Padding(4, 0, 4, 0); - 实时显示.Name = "实时显示"; - 实时显示.Size = new Size(64, 17); - 实时显示.TabIndex = 12; - 实时显示.Text = "实时显示"; + NGDNum.Location = new Point(331, 96); + NGDNum.Margin = new Padding(4, 2, 4, 2); + NGDNum.Name = "NGDNum"; + NGDNum.ReadOnly = true; + NGDNum.Size = new Size(76, 31); + NGDNum.TabIndex = 8; // // OKOrNGShow // - OKOrNGShow.Location = new Point(299, 53); + OKOrNGShow.Location = new Point(265, 180); OKOrNGShow.Margin = new Padding(4, 2, 4, 2); OKOrNGShow.Name = "OKOrNGShow"; - OKOrNGShow.Size = new Size(235, 168); + OKOrNGShow.Size = new Size(284, 220); OKOrNGShow.SizeMode = PictureBoxSizeMode.CenterImage; OKOrNGShow.TabIndex = 11; OKOrNGShow.TabStop = false; // // OKDNum // - OKDNum.Location = new Point(129, 249); + OKDNum.Location = new Point(331, 35); OKDNum.Margin = new Padding(4, 2, 4, 2); OKDNum.Name = "OKDNum"; OKDNum.ReadOnly = true; - OKDNum.Size = new Size(127, 23); + OKDNum.Size = new Size(76, 31); OKDNum.TabIndex = 10; // // label20 // label20.AutoSize = true; - label20.Location = new Point(31, 254); + label20.Location = new Point(206, 41); label20.Margin = new Padding(4, 0, 4, 0); label20.Name = "label20"; - label20.Size = new Size(56, 17); + label20.Size = new Size(105, 25); label20.TabIndex = 9; - label20.Text = "OK个数"; + label20.Text = "OK产品数"; // - // NGDNum + // textBox1 // - NGDNum.Location = new Point(129, 206); - NGDNum.Margin = new Padding(4, 2, 4, 2); - NGDNum.Name = "NGDNum"; - NGDNum.ReadOnly = true; - NGDNum.Size = new Size(127, 23); - NGDNum.TabIndex = 8; + textBox1.Location = new Point(529, 69); + textBox1.Margin = new Padding(4, 2, 4, 2); + textBox1.Name = "textBox1"; + textBox1.ReadOnly = true; + textBox1.Size = new Size(67, 31); + textBox1.TabIndex = 15; // - // label19 + // label35 // - label19.AutoSize = true; - label19.Location = new Point(31, 209); - label19.Margin = new Padding(4, 0, 4, 0); - label19.Name = "label19"; - label19.Size = new Size(57, 17); - label19.TabIndex = 7; - label19.Text = "NG个数"; + label35.AutoSize = true; + label35.Location = new Point(437, 75); + label35.Name = "label35"; + label35.Size = new Size(75, 25); + label35.TabIndex = 14; + label35.Text = "误检率"; // - // AllDSum + // groupBox7 // - AllDSum.Location = new Point(129, 164); - AllDSum.Margin = new Padding(4, 2, 4, 2); - AllDSum.Name = "AllDSum"; - AllDSum.ReadOnly = true; - AllDSum.Size = new Size(127, 23); - AllDSum.TabIndex = 6; - // - // label18 - // - label18.AutoSize = true; - label18.Location = new Point(31, 167); - label18.Margin = new Padding(4, 0, 4, 0); - label18.Name = "label18"; - label18.Size = new Size(50, 17); - label18.TabIndex = 5; - label18.Text = "总个数"; - // - // StartDecBtn - // - StartDecBtn.Location = new Point(168, 56); - StartDecBtn.Margin = new Padding(4, 2, 4, 2); - StartDecBtn.Name = "StartDecBtn"; - StartDecBtn.Size = new Size(121, 40); - StartDecBtn.TabIndex = 3; - StartDecBtn.Text = "开启检测"; - StartDecBtn.UseVisualStyleBackColor = true; - StartDecBtn.Click += StartDecBtn_Click; - // - // ScanDevList - // - ScanDevList.Location = new Point(296, 18); - ScanDevList.Margin = new Padding(4, 2, 4, 2); - ScanDevList.Name = "ScanDevList"; - ScanDevList.Size = new Size(96, 30); - ScanDevList.TabIndex = 2; - ScanDevList.Text = "Scan"; - ScanDevList.UseVisualStyleBackColor = true; - ScanDevList.Click += ScanDevList_Click; - // - // DevNameCombo - // - DevNameCombo.FormattingEnabled = true; - DevNameCombo.Location = new Point(32, 22); - DevNameCombo.Margin = new Padding(4, 2, 4, 2); - DevNameCombo.Name = "DevNameCombo"; - DevNameCombo.Size = new Size(256, 25); - DevNameCombo.TabIndex = 1; + groupBox7.Controls.Add(InitMachine); + groupBox7.Controls.Add(StartDecBtn); + groupBox7.Controls.Add(CloseDecBtn); + groupBox7.Location = new Point(11, 16); + groupBox7.Name = "groupBox7"; + groupBox7.Size = new Size(582, 94); + groupBox7.TabIndex = 23; + groupBox7.TabStop = false; + groupBox7.Text = "操作按钮"; // // InitMachine // - InitMachine.Location = new Point(31, 56); + InitMachine.Location = new Point(7, 29); InitMachine.Margin = new Padding(4, 2, 4, 2); InitMachine.Name = "InitMachine"; - InitMachine.Size = new Size(121, 40); + InitMachine.Size = new Size(159, 60); InitMachine.TabIndex = 0; InitMachine.Text = "初始化设备"; InitMachine.UseVisualStyleBackColor = true; InitMachine.Click += InitMachine_Click; // + // StartDecBtn + // + StartDecBtn.Location = new Point(206, 29); + StartDecBtn.Margin = new Padding(4, 2, 4, 2); + StartDecBtn.Name = "StartDecBtn"; + StartDecBtn.Size = new Size(137, 60); + StartDecBtn.TabIndex = 3; + StartDecBtn.Text = "开启检测"; + StartDecBtn.UseVisualStyleBackColor = true; + StartDecBtn.Click += StartDecBtn_Click; + // + // CloseDecBtn + // + CloseDecBtn.Location = new Point(392, 29); + CloseDecBtn.Margin = new Padding(4, 2, 4, 2); + CloseDecBtn.Name = "CloseDecBtn"; + CloseDecBtn.Size = new Size(140, 60); + CloseDecBtn.TabIndex = 20; + CloseDecBtn.Text = "关闭检测"; + CloseDecBtn.UseVisualStyleBackColor = true; + CloseDecBtn.Click += CloseDecBtn_Click; + // + // groupBox6 + // + groupBox6.Controls.Add(textBox3); + groupBox6.Controls.Add(label25); + groupBox6.Controls.Add(label24); + groupBox6.Controls.Add(ScannerBox); + groupBox6.Location = new Point(11, 120); + groupBox6.Name = "groupBox6"; + groupBox6.Size = new Size(582, 149); + groupBox6.TabIndex = 22; + groupBox6.TabStop = false; + groupBox6.Text = "基础信息"; + // + // textBox3 + // + textBox3.Location = new Point(128, 95); + textBox3.Margin = new Padding(4, 2, 4, 2); + textBox3.Name = "textBox3"; + textBox3.ReadOnly = true; + textBox3.Size = new Size(402, 31); + textBox3.TabIndex = 21; + // + // label25 + // + label25.AutoSize = true; + label25.Location = new Point(7, 95); + label25.Margin = new Padding(4, 0, 4, 0); + label25.Name = "label25"; + label25.Size = new Size(96, 25); + label25.TabIndex = 20; + label25.Text = "产品型号"; + label25.Click += label25_Click; + // + // label24 + // + label24.AutoSize = true; + label24.Location = new Point(7, 40); + label24.Margin = new Padding(4, 0, 4, 0); + label24.Name = "label24"; + label24.Size = new Size(96, 25); + label24.TabIndex = 19; + label24.Text = "产品条码"; + label24.Click += label24_Click; + // + // ScannerBox + // + ScannerBox.Location = new Point(128, 34); + ScannerBox.Margin = new Padding(4, 2, 4, 2); + ScannerBox.Name = "ScannerBox"; + ScannerBox.ReadOnly = true; + ScannerBox.Size = new Size(402, 31); + ScannerBox.TabIndex = 18; + // + // linkLabel1 + // + linkLabel1.AutoSize = true; + linkLabel1.Location = new Point(161, 387); + linkLabel1.Name = "linkLabel1"; + linkLabel1.Size = new Size(0, 25); + linkLabel1.TabIndex = 21; + // // tabPage3 // tabPage3.Controls.Add(panel2); - tabPage3.Location = new Point(4, 26); + tabPage3.Location = new Point(4, 33); tabPage3.Margin = new Padding(4, 2, 4, 2); tabPage3.Name = "tabPage3"; - tabPage3.Size = new Size(1276, 719); + tabPage3.Size = new Size(1306, 816); tabPage3.TabIndex = 4; tabPage3.Text = "录入新型号"; tabPage3.UseVisualStyleBackColor = true; @@ -1568,7 +1647,7 @@ WhiteBanCbx.Location = new Point(867, 146); WhiteBanCbx.Margin = new Padding(4, 2, 4, 2); WhiteBanCbx.Name = "WhiteBanCbx"; - WhiteBanCbx.Size = new Size(41, 21); + WhiteBanCbx.Size = new Size(59, 29); WhiteBanCbx.TabIndex = 40; WhiteBanCbx.Text = "是"; WhiteBanCbx.UseVisualStyleBackColor = true; @@ -1579,7 +1658,7 @@ label33.Location = new Point(596, 147); label33.Margin = new Padding(4, 0, 4, 0); label33.Name = "label33"; - label33.Size = new Size(162, 17); + label33.Size = new Size(243, 25); label33.TabIndex = 39; label33.Text = "面板第二块区域是白板吗"; // @@ -1589,7 +1668,7 @@ label28.Location = new Point(23, 187); label28.Margin = new Padding(4, 0, 4, 0); label28.Name = "label28"; - label28.Size = new Size(101, 17); + label28.Size = new Size(151, 25); label28.TabIndex = 14; label28.Text = "第一次拍照Z轴"; // @@ -1609,7 +1688,7 @@ modelChangeCbx.Location = new Point(750, 14); modelChangeCbx.Margin = new Padding(4, 2, 4, 2); modelChangeCbx.Name = "modelChangeCbx"; - modelChangeCbx.Size = new Size(241, 23); + modelChangeCbx.Size = new Size(241, 31); modelChangeCbx.TabIndex = 34; modelChangeCbx.Text = "D:\\Hisence\\config\\chinese.json"; // @@ -1619,7 +1698,7 @@ label34.Location = new Point(597, 14); label34.Margin = new Padding(4, 0, 4, 0); label34.Name = "label34"; - label34.Size = new Size(92, 17); + label34.Size = new Size(138, 25); label34.TabIndex = 33; label34.Text = "面板语言选择"; // @@ -1650,7 +1729,7 @@ Cam2MatCbx.Location = new Point(750, 111); Cam2MatCbx.Margin = new Padding(4, 2, 4, 2); Cam2MatCbx.Name = "Cam2MatCbx"; - Cam2MatCbx.Size = new Size(279, 23); + Cam2MatCbx.Size = new Size(279, 31); Cam2MatCbx.TabIndex = 29; Cam2MatCbx.Text = "D:\\Hisence\\类型\\Lp\\002jpg"; // @@ -1660,7 +1739,7 @@ label22.Location = new Point(596, 105); label22.Margin = new Padding(4, 0, 4, 0); label22.Name = "label22"; - label22.Size = new Size(92, 17); + label22.Size = new Size(138, 25); label22.TabIndex = 28; label22.Text = "面板第二张图"; // @@ -1669,7 +1748,7 @@ Cam1MatCbx.Location = new Point(750, 59); Cam1MatCbx.Margin = new Padding(4, 2, 4, 2); Cam1MatCbx.Name = "Cam1MatCbx"; - Cam1MatCbx.Size = new Size(279, 23); + Cam1MatCbx.Size = new Size(279, 31); Cam1MatCbx.TabIndex = 27; Cam1MatCbx.Text = "D:\\Hisence\\类型\\Lp\\001.jpg"; // @@ -1679,7 +1758,7 @@ label23.Location = new Point(597, 62); label23.Margin = new Padding(4, 0, 4, 0); label23.Name = "label23"; - label23.Size = new Size(92, 17); + label23.Size = new Size(138, 25); label23.TabIndex = 26; label23.Text = "面板第一张图"; // @@ -1710,7 +1789,7 @@ moveZbox.Location = new Point(183, 184); moveZbox.Margin = new Padding(4, 2, 4, 2); moveZbox.Name = "moveZbox"; - moveZbox.Size = new Size(287, 23); + moveZbox.Size = new Size(287, 31); moveZbox.TabIndex = 15; moveZbox.Text = "0"; // @@ -1719,7 +1798,7 @@ moveYbox.Location = new Point(183, 141); moveYbox.Margin = new Padding(4, 2, 4, 2); moveYbox.Name = "moveYbox"; - moveYbox.Size = new Size(287, 23); + moveYbox.Size = new Size(287, 31); moveYbox.TabIndex = 13; moveYbox.Text = "0"; // @@ -1729,7 +1808,7 @@ label29.Location = new Point(22, 143); label29.Margin = new Padding(4, 0, 4, 0); label29.Name = "label29"; - label29.Size = new Size(101, 17); + label29.Size = new Size(153, 25); label29.TabIndex = 12; label29.Text = "第一次拍照Y轴"; // @@ -1738,7 +1817,7 @@ moveXbox.Location = new Point(182, 101); moveXbox.Margin = new Padding(4, 2, 4, 2); moveXbox.Name = "moveXbox"; - moveXbox.Size = new Size(287, 23); + moveXbox.Size = new Size(287, 31); moveXbox.TabIndex = 11; moveXbox.Text = "8974"; // @@ -1748,7 +1827,7 @@ label30.Location = new Point(22, 104); label30.Margin = new Padding(4, 0, 4, 0); label30.Name = "label30"; - label30.Size = new Size(101, 17); + label30.Size = new Size(152, 25); label30.TabIndex = 10; label30.Text = "第一次拍照X轴"; // @@ -1757,7 +1836,7 @@ OcrBarBox.Location = new Point(183, 56); OcrBarBox.Margin = new Padding(4, 2, 4, 2); OcrBarBox.Name = "OcrBarBox"; - OcrBarBox.Size = new Size(287, 23); + OcrBarBox.Size = new Size(287, 31); OcrBarBox.TabIndex = 5; OcrBarBox.Text = "1234567890"; // @@ -1767,7 +1846,7 @@ label31.Location = new Point(23, 59); label31.Margin = new Padding(4, 0, 4, 0); label31.Name = "label31"; - label31.Size = new Size(27, 17); + label31.Size = new Size(41, 25); label31.TabIndex = 4; label31.Text = "SN"; // @@ -1776,7 +1855,7 @@ TypeBox.Location = new Point(183, 14); TypeBox.Margin = new Padding(4, 2, 4, 2); TypeBox.Name = "TypeBox"; - TypeBox.Size = new Size(287, 23); + TypeBox.Size = new Size(287, 31); TypeBox.TabIndex = 3; TypeBox.Text = "1"; // @@ -1797,7 +1876,7 @@ label32.Location = new Point(18, 17); label32.Margin = new Padding(4, 0, 4, 0); label32.Name = "label32"; - label32.Size = new Size(36, 17); + label32.Size = new Size(54, 25); label32.TabIndex = 1; label32.Text = "类型"; // @@ -1815,30 +1894,19 @@ // richTextBox1 // richTextBox1.Dock = DockStyle.Bottom; - richTextBox1.Location = new Point(0, 754); + richTextBox1.Location = new Point(0, 844); richTextBox1.Margin = new Padding(4, 2, 4, 2); richTextBox1.Name = "richTextBox1"; - richTextBox1.Size = new Size(1284, 166); + richTextBox1.Size = new Size(1314, 109); richTextBox1.TabIndex = 1; richTextBox1.Text = ""; // - // CloseDecBtn - // - CloseDecBtn.Location = new Point(170, 109); - CloseDecBtn.Margin = new Padding(4, 2, 4, 2); - CloseDecBtn.Name = "CloseDecBtn"; - CloseDecBtn.Size = new Size(121, 40); - CloseDecBtn.TabIndex = 20; - CloseDecBtn.Text = "关闭检测"; - CloseDecBtn.UseVisualStyleBackColor = true; - CloseDecBtn.Click += CloseDecBtn_Click; - // // MainForm // - AutoScaleDimensions = new SizeF(8F, 17F); + AutoScaleDimensions = new SizeF(12F, 25F); AutoScaleMode = AutoScaleMode.Font; BackColor = SystemColors.ActiveCaption; - ClientSize = new Size(1284, 920); + ClientSize = new Size(1314, 953); Controls.Add(richTextBox1); Controls.Add(tabControl1); Font = new Font("Microsoft Sans Serif", 10.5F, FontStyle.Regular, GraphicsUnit.Point); @@ -1866,12 +1934,18 @@ panel4.ResumeLayout(false); panel5.ResumeLayout(false); panel5.PerformLayout(); + groupBox9.ResumeLayout(false); groupBox2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)originMatShow).EndInit(); ((System.ComponentModel.ISupportInitialize)ResultMatShow).EndInit(); panel8.ResumeLayout(false); panel8.PerformLayout(); + groupBox8.ResumeLayout(false); + groupBox8.PerformLayout(); ((System.ComponentModel.ISupportInitialize)OKOrNGShow).EndInit(); + groupBox7.ResumeLayout(false); + groupBox6.ResumeLayout(false); + groupBox6.PerformLayout(); tabPage3.ResumeLayout(false); panel2.ResumeLayout(false); panel2.PerformLayout(); @@ -1959,7 +2033,6 @@ private Label label19; private TextBox AllDSum; private Label label18; - private Label 实时显示; private PictureBox OKOrNGShow; private GroupBox groupBox3; private Button SnapshotCam2; @@ -2039,8 +2112,6 @@ //private XKRS.UI.Canvas canvas2; private TextBox textBox1; private Label label35; - private TextBox textBox2; - private Label label36; //private XKRS.UI.Canvas canvas5; //private XKRS.UI.Canvas canvas4; private XKRS.UI.Canvas canvas3; @@ -2051,5 +2122,13 @@ private Label label24; private TextBox ScannerBox; private Button CloseDecBtn; + private GroupBox groupBox6; + private LinkLabel linkLabel1; + private Label label25; + private TextBox textBox3; + private GroupBox groupBox7; + private GroupBox groupBox8; + private GroupBox groupBox9; + private Label label26; } } diff --git a/HisenceYoloDetection/MainForm.cs b/HisenceYoloDetection/MainForm.cs index 0ca3162..1d17cd9 100644 --- a/HisenceYoloDetection/MainForm.cs +++ b/HisenceYoloDetection/MainForm.cs @@ -54,7 +54,7 @@ namespace HisenceYoloDetection //OnDetectionDone += Defet_OnDetectionDone; }; } - MeachineState meachineState= MeachineState.machine_closing; + MeachineState meachineState = MeachineState.machine_closing; MGSCameraDriver Cam1 = new MGSCameraDriver(); MGSCameraDriver Cam2 = new MGSCameraDriver(); public static string RootPath = "D:\\Hisence\\SQLImages\\"; @@ -1211,200 +1211,8 @@ namespace HisenceYoloDetection // } //}); } - /// - /// ϴ»545Ƿ񴥷䴫 - /// - public void TrigerCamera1() - { - //һ̼߳PLCֵ - Task.Run(() => - { - int iNum1 = 0; - int iNum0 = 0; - while (true) - { - // myResetEvent.Set(); - PLC545 = true; - int m_iCureent545 = melsecPLCTCPDriver.ReadInt("545"); - ////int m_iCureent545 = CMPLC.SLMPReadD(545); - if (m_iCureent545 != 1) - { - iNum0++; - } - else - { - iNum0 = 0; - } - if (iNum0 >= 5) - { - while (true) - { - m_iCureent545 = melsecPLCTCPDriver.ReadInt("545"); - if (m_iCureent545 == 1) - { - iNum1++; - } - else - { - iNum1 = 0; - } - if (iNum1 >= 5) - { - //Console.WriteLine("ڶβɼͼ"); - //Cam1.Snapshot(); - //Cam2.Snapshot(); - //IfCam1Triger = false; - //IfCam2Triger = false; - - iNum0 = 0; - iNum1 = 0; - break; - - } - } - - } - Thread.Sleep(100); - - - } - }); - } - /// - /// ȡʿͺ - /// - public void OnGetBar() - { - Task.Run(() => - { - int iNum0 = 0; - int iNum1 = 0; - - // const char pCR[4] = { 0x4C, 0x4F, 0x4E, 0x0D }; - //const char pOFF[5] = { 0x4C, 0x4F, 0x46, 0x46, 0x0D };ر - Thread.CurrentThread.Priority = ThreadPriority.Highest; - while (true) - { - //545ʱΪ0 - // myResetEvent.Set(); - PLC545 = true; - int m_iCureent545 = melsecPLCTCPDriver.ReadInt("545"); - - if (m_iCureent545 != 1) - { - iNum0++; - } - else - { - iNum0 = 0; - } - if (iNum0 >= 1) - { - //ָ - while (true) - { - bTriger = false; - //544һֱ1s - m_iCureent545 = melsecPLCTCPDriver.ReadInt("545"); - if (m_iCureent545 == 1) - { - iNum1++; - } - else - { - iNum1 = 0; - } - if (iNum1 >= 2) - { - - if (bBar) - { - _runHandleBefore.WaitOne(); - //ijɺͺŵĶԽ -#if false - { - // Oldm_sKEYENCEBar= m_sKEYENCEBar; - //ȡ - //ַ - string url = "https://inner-apisix.hisense.com/mes-plus/api/Fcc/GetWorkOrderBOMlnfo?user_key=k7gzo1fsfcami7n5hmpxtybyluf9xeue"; - // string url = "https://echo.hoppscotch.io"; - string PostUrl = url; - DateTime dt = DateTime.Now; - - string starttime = string.Format("{0:yyyy_mm_dd}", dt); //17 17 2017 2017 - - string startTime = starttime; - string EndTime = starttime; - string lineBody = "ZZ-P";// - string MaterialDescripts = ""; - string MaterialDescripts2 = "չ"; - JObject patientinfo = new JObject(); - JArray ids = new JArray(); - ids.Add(MaterialDescripts); - ids.Add(MaterialDescripts2); - patientinfo["startTime"] = startTime; - patientinfo["EndTime"] = EndTime; - patientinfo["lineBody"] = lineBody; - patientinfo["MaterialDescripts"] = ids; - string sendData = JsonConvert.SerializeObject(patientinfo); - //eg: UrlҪĸʽsendData={"ids":[123],"Name":С} - string resultData = Post(sendData, PostUrl); - resultData = "{\r\n\t\"Result\": [],\r\n\t\"success\": false,\r\n\t\"ReturnMsg\": \"-starttime ȷ!\"\r\n}"; - JObject jo = (JObject)JsonConvert.DeserializeObject(resultData); - string sucessIf = jo["success"].ToString(); - if (sucessIf.ToLower() == "true") - { - string ProductType = jo["ProductType"].ToString(); - string FinalDefIo = jo["FinalDefIo"].ToString(); - //WEBAPIõ - xKNow = GetModeFromBar(ProductType);//ݿвѯֵ - //ֶ - } - } -#endif - // if(Oldm_sKEYENCEBar!= m_sKEYENCEBar) - - xKNow = GetModeFromBar("VWJ070541V0WW824F120223");//ݿвѯֵ - - - if (xKNow == null) - { - myLog("ݿûƥ" + m_sKEYENCEBar, DateTime.Now); - break; - } - //if(xKNow.OcrBar!= Old_xKNow.OcrBar) - //{ - - //} - if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$")) - { - // Old_xKNow = xKNow; - myLog("ͺƥɹ" + xKNow.OcrBar, DateTime.Now); - - //MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLCƵƶ - } - - break; - } - Thread.Sleep(2); - bBar = false; - - } - } - } - - - - - - } - Thread.Sleep(10); - - - }); - } #region ʾ /// /// ʾ @@ -1448,7 +1256,7 @@ namespace HisenceYoloDetection int iNum0 = 0; int iNum3 = 0; Thread.CurrentThread.Priority = ThreadPriority.Highest; - while (meachineState==MeachineState.machine_opening) + while (meachineState == MeachineState.machine_opening) { // myResetEvent.Set(); PLC548 = true; @@ -1494,19 +1302,21 @@ namespace HisenceYoloDetection //ijɺͺŵĶԽ string OcrBar = ""; string FinalDefIDToFind = m_sKEYENCEBar;// Ŀ FinalDefID + OcrBar = FormBarType(FinalDefIDToFind); this.Invoke(new Action(() => { ScannerBox.Text = FinalDefIDToFind; + textBox3.Text = OcrBar; })); myLog("ɨ" + m_sKEYENCEBar, DateTime.Now); -#if false + //#if false //ǷPosʱ䳬ʱ - OcrBar = FormBarType(FinalDefIDToFind); -#else - OcrBar = "OZ.ϴ».WF3G7014-NVW001CZA.WSG374A."; -#endif + + //#else + // OcrBar = "OZ.ϴ».WF3G7014-NVW001CZA.WSG374A."; + //#endif // if(Oldm_sKEYENCEBar!= m_sKEYENCEBar) @@ -1826,7 +1636,8 @@ namespace HisenceYoloDetection { myLog("δƥɹ" + xKNow.OcrBar, DateTime.Now); myLog("ʼģ", DateTime.Now); - //Insert_auto(); + Insert_auto(true, Cam1ImgOne, m_sKEYENCEBar, 8974, 0, 0); + break; } string IOcrBAr = xKNow.OcrBar; @@ -2713,12 +2524,23 @@ namespace HisenceYoloDetection string jsonData = @" { ""StartTime"": ""2024-07-1"", - ""EndTime"": ""2024-07-22"", + ""EndTime"": ""2024-07-20"", ""LineBody"": ""BZ-PC"" }"; + // ȡ + string currentDate = DateTime.Now.ToString("yyyy-MM-dd"); + + // JSONַΪJObject + JObject jsonObject = JObject.Parse(jsonData); + + // EndTimeֶ + jsonObject["EndTime"] = currentDate; + + // JObjectתJSONַ + string updatedJsonData = jsonObject.ToString(); - string postData = "inputvalue=" + Uri.EscapeDataString(jsonData); + string postData = "inputvalue=" + Uri.EscapeDataString(updatedJsonData); try { @@ -2747,8 +2569,6 @@ namespace HisenceYoloDetection } public void Insert_auto(bool ifwhiteBan, Mat img, string SNtext, int MoveX, int MoveY, int MoveZ) { - // PaddleOcrModel IpaddleOcrModel = new PaddleOcrModel(); - // IpaddleOcrModel.Load(ModelChangePath, "CPU"); string IOcrBAr = FormBarType(SNtext); @@ -2762,20 +2582,9 @@ namespace HisenceYoloDetection sw.Flush(); } - - //еĿü ʶַԱַ - - - - // - - - - - //ӵһȫͼΧĿȻOCRʶ MLRequest CamOneI = new MLRequest(); - CamOneI.currentMat = Cv2.ImRead(Cam1OnePath); + CamOneI.currentMat = img; CamOneI.ResizeWidth = 640; CamOneI.ResizeHeight = 640; CamOneI.Score = 0.3f; @@ -2803,19 +2612,11 @@ namespace HisenceYoloDetection InsertXKHisenceWordData(xkWord);//ؼֱвһ - //ı - //List bingji = strMatListOne.Union(strMatListTwo).ToList();//ȫ - //List Fuzzybingji = strMatFuzzyListOne.Union(strMatFuzzyListTwo).ToList();//ȫ + string OcrTextone = strMatListOne.Join("##"); string OcrTextTwo = strMatFuzzyListOne.Join("##"); - //string OcrTextinsert = ""; - //List bingji = strMatListListOne.Union(strMatListListTwo).ToList();//ȫ - //for (int j = 0; j < bingji.Count; j++) - //{ - // string jdetial = bingji[j]; - // OcrTextinsert += jdetial + "##"; - //} + string detstr = ""; //ҵʶ @@ -2841,14 +2642,7 @@ namespace HisenceYoloDetection DateTime dt2 = DateTime.Now; XKHisence xK = new XKHisence("1", IOcrBAr, MoveX, MoveY, MoveZ, detstr, OcrTextone, MoveX, MoveY, MoveZ, ModelChangePath, "", OcrTextTwo); - //string log="D:\\Hisence\\detImages\\" + dt2.Year.ToString() + dt2.Month.ToString() + dt2.Day.ToString() + dt2.Hour.ToString() + dt2.Minute.ToString() + dt2.Millisecond.ToString() + "2result.log"; - // using (StreamWriter sw=new StreamWriter(log, true)) - // { - // // sw.WriteLine(xK.OcrBar+"\n"); - // sw.WriteLine(xK.OcrText); - // sw.WriteLine(xK.FuzzyOcrText); - // } - //IpaddleOcrModel.FreeModel(); + string sql = "insert into XK_Hisence VALUES('" + xK.Type + "','" + xK.OcrBar + "'," + xK.MoveX + "," + xK.MoveY + "," + xK.MoveZ + ",'" + xK.Detect + "','" + xK.OcrText + "'," + xK.MoveTwoX + "," + xK.MoveTwoY + "," + xK.MoveTwoZ + ",'" + xK.OcrParm + "','" + xK.Language + "','" + xK.FuzzyOcrText + "')"; int i = SQLiteHelper.ExecuteSql(sql); @@ -3946,5 +3740,30 @@ namespace HisenceYoloDetection melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 0); melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 0); } + + private void label24_Click(object sender, EventArgs e) + { + + } + + private void label25_Click(object sender, EventArgs e) + { + + } + + private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void label18_Click(object sender, EventArgs e) + { + + } + + private void canvas2_Load(object sender, EventArgs e) + { + + } } }