patrick.xu
2021-06-02 58493dff9629a168168b63fa0c08f7b2a9cb1ad0
1. 添加高度OK图片保存开关和动作
5个文件已修改
314 ■■■■■ 已修改文件
ConfigForm.Designer.cs 286 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConfigForm.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HeightDetection.cs 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
OPCConfigStruct.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Properties/AssemblyInfo.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ConfigForm.Designer.cs
@@ -227,6 +227,16 @@
            this.btnXYStop = new System.Windows.Forms.Button();
            this.btnTableAction = new System.Windows.Forms.Button();
            this.tbSoft = new System.Windows.Forms.TabPage();
            this.groupBox31 = new System.Windows.Forms.GroupBox();
            this.nudCellMinWidth = new System.Windows.Forms.NumericUpDown();
            this.nudCellMinLength = new System.Windows.Forms.NumericUpDown();
            this.label149 = new System.Windows.Forms.Label();
            this.label150 = new System.Windows.Forms.Label();
            this.groupBox30 = new System.Windows.Forms.GroupBox();
            this.nudCellMaxWidth = new System.Windows.Forms.NumericUpDown();
            this.nudCellMaxLength = new System.Windows.Forms.NumericUpDown();
            this.label148 = new System.Windows.Forms.Label();
            this.label147 = new System.Windows.Forms.Label();
            this.chkSaveOKLWImage = new System.Windows.Forms.CheckBox();
            this.btnClearCheck = new System.Windows.Forms.Button();
            this.btnHandInit = new System.Windows.Forms.Button();
@@ -446,16 +456,7 @@
            this.groupBox27 = new System.Windows.Forms.GroupBox();
            this.groupBox28 = new System.Windows.Forms.GroupBox();
            this.groupBox29 = new System.Windows.Forms.GroupBox();
            this.groupBox30 = new System.Windows.Forms.GroupBox();
            this.label147 = new System.Windows.Forms.Label();
            this.label148 = new System.Windows.Forms.Label();
            this.nudCellMaxLength = new System.Windows.Forms.NumericUpDown();
            this.nudCellMaxWidth = new System.Windows.Forms.NumericUpDown();
            this.groupBox31 = new System.Windows.Forms.GroupBox();
            this.nudCellMinWidth = new System.Windows.Forms.NumericUpDown();
            this.nudCellMinLength = new System.Windows.Forms.NumericUpDown();
            this.label149 = new System.Windows.Forms.Label();
            this.label150 = new System.Windows.Forms.Label();
            this.chkSaveHeightOK = new System.Windows.Forms.CheckBox();
            this.tabControl1.SuspendLayout();
            this.tpSetConfig.SuspendLayout();
            this.groupBox4.SuspendLayout();
@@ -471,6 +472,12 @@
            this.groupBox7.SuspendLayout();
            this.tpPLC.SuspendLayout();
            this.tbSoft.SuspendLayout();
            this.groupBox31.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinWidth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinLength)).BeginInit();
            this.groupBox30.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxWidth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxLength)).BeginInit();
            this.groupBox14.SuspendLayout();
            this.groupBox5.SuspendLayout();
            this.groupBox9.SuspendLayout();
@@ -490,12 +497,6 @@
            this.groupBox27.SuspendLayout();
            this.groupBox28.SuspendLayout();
            this.groupBox29.SuspendLayout();
            this.groupBox30.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxLength)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxWidth)).BeginInit();
            this.groupBox31.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinWidth)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinLength)).BeginInit();
            this.SuspendLayout();
            // 
            // btnSaveConfig
@@ -2593,6 +2594,7 @@
            // 
            this.tbSoft.Controls.Add(this.groupBox31);
            this.tbSoft.Controls.Add(this.groupBox30);
            this.tbSoft.Controls.Add(this.chkSaveHeightOK);
            this.tbSoft.Controls.Add(this.chkSaveOKLWImage);
            this.tbSoft.Controls.Add(this.btnClearCheck);
            this.tbSoft.Location = new System.Drawing.Point(4, 22);
@@ -2603,6 +2605,120 @@
            this.tbSoft.TabIndex = 2;
            this.tbSoft.Text = "软件";
            this.tbSoft.UseVisualStyleBackColor = true;
            //
            // groupBox31
            //
            this.groupBox31.Controls.Add(this.nudCellMinWidth);
            this.groupBox31.Controls.Add(this.nudCellMinLength);
            this.groupBox31.Controls.Add(this.label149);
            this.groupBox31.Controls.Add(this.label150);
            this.groupBox31.Location = new System.Drawing.Point(236, 105);
            this.groupBox31.Name = "groupBox31";
            this.groupBox31.Size = new System.Drawing.Size(200, 100);
            this.groupBox31.TabIndex = 2;
            this.groupBox31.TabStop = false;
            this.groupBox31.Text = "电池长宽下限";
            //
            // nudCellMinWidth
            //
            this.nudCellMinWidth.DecimalPlaces = 2;
            this.nudCellMinWidth.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMinWidth.Location = new System.Drawing.Point(49, 60);
            this.nudCellMinWidth.Name = "nudCellMinWidth";
            this.nudCellMinWidth.Size = new System.Drawing.Size(120, 21);
            this.nudCellMinWidth.TabIndex = 1;
            //
            // nudCellMinLength
            //
            this.nudCellMinLength.DecimalPlaces = 2;
            this.nudCellMinLength.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMinLength.Location = new System.Drawing.Point(49, 29);
            this.nudCellMinLength.Name = "nudCellMinLength";
            this.nudCellMinLength.Size = new System.Drawing.Size(120, 21);
            this.nudCellMinLength.TabIndex = 1;
            //
            // label149
            //
            this.label149.AutoSize = true;
            this.label149.Location = new System.Drawing.Point(13, 65);
            this.label149.Name = "label149";
            this.label149.Size = new System.Drawing.Size(17, 12);
            this.label149.TabIndex = 0;
            this.label149.Text = "宽";
            //
            // label150
            //
            this.label150.AutoSize = true;
            this.label150.Location = new System.Drawing.Point(13, 31);
            this.label150.Name = "label150";
            this.label150.Size = new System.Drawing.Size(17, 12);
            this.label150.TabIndex = 0;
            this.label150.Text = "长";
            //
            // groupBox30
            //
            this.groupBox30.Controls.Add(this.nudCellMaxWidth);
            this.groupBox30.Controls.Add(this.nudCellMaxLength);
            this.groupBox30.Controls.Add(this.label148);
            this.groupBox30.Controls.Add(this.label147);
            this.groupBox30.Location = new System.Drawing.Point(15, 104);
            this.groupBox30.Name = "groupBox30";
            this.groupBox30.Size = new System.Drawing.Size(200, 100);
            this.groupBox30.TabIndex = 2;
            this.groupBox30.TabStop = false;
            this.groupBox30.Text = "电池长宽上限";
            //
            // nudCellMaxWidth
            //
            this.nudCellMaxWidth.DecimalPlaces = 2;
            this.nudCellMaxWidth.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMaxWidth.Location = new System.Drawing.Point(49, 60);
            this.nudCellMaxWidth.Name = "nudCellMaxWidth";
            this.nudCellMaxWidth.Size = new System.Drawing.Size(120, 21);
            this.nudCellMaxWidth.TabIndex = 1;
            //
            // nudCellMaxLength
            //
            this.nudCellMaxLength.DecimalPlaces = 2;
            this.nudCellMaxLength.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMaxLength.Location = new System.Drawing.Point(49, 29);
            this.nudCellMaxLength.Name = "nudCellMaxLength";
            this.nudCellMaxLength.Size = new System.Drawing.Size(120, 21);
            this.nudCellMaxLength.TabIndex = 1;
            //
            // label148
            //
            this.label148.AutoSize = true;
            this.label148.Location = new System.Drawing.Point(13, 65);
            this.label148.Name = "label148";
            this.label148.Size = new System.Drawing.Size(17, 12);
            this.label148.TabIndex = 0;
            this.label148.Text = "宽";
            //
            // label147
            //
            this.label147.AutoSize = true;
            this.label147.Location = new System.Drawing.Point(13, 31);
            this.label147.Name = "label147";
            this.label147.Size = new System.Drawing.Size(17, 12);
            this.label147.TabIndex = 0;
            this.label147.Text = "长";
            // 
            // chkSaveOKLWImage
            // 
@@ -4680,119 +4796,16 @@
            this.groupBox29.TabStop = false;
            this.groupBox29.Text = "FAI 10";
            // 
            // groupBox30
            // chkSaveHeightOK
            // 
            this.groupBox30.Controls.Add(this.nudCellMaxWidth);
            this.groupBox30.Controls.Add(this.nudCellMaxLength);
            this.groupBox30.Controls.Add(this.label148);
            this.groupBox30.Controls.Add(this.label147);
            this.groupBox30.Location = new System.Drawing.Point(15, 104);
            this.groupBox30.Name = "groupBox30";
            this.groupBox30.Size = new System.Drawing.Size(200, 100);
            this.groupBox30.TabIndex = 2;
            this.groupBox30.TabStop = false;
            this.groupBox30.Text = "电池长宽上限";
            //
            // label147
            //
            this.label147.AutoSize = true;
            this.label147.Location = new System.Drawing.Point(13, 31);
            this.label147.Name = "label147";
            this.label147.Size = new System.Drawing.Size(17, 12);
            this.label147.TabIndex = 0;
            this.label147.Text = "长";
            //
            // label148
            //
            this.label148.AutoSize = true;
            this.label148.Location = new System.Drawing.Point(13, 65);
            this.label148.Name = "label148";
            this.label148.Size = new System.Drawing.Size(17, 12);
            this.label148.TabIndex = 0;
            this.label148.Text = "宽";
            //
            // nudCellMaxLength
            //
            this.nudCellMaxLength.DecimalPlaces = 2;
            this.nudCellMaxLength.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMaxLength.Location = new System.Drawing.Point(49, 29);
            this.nudCellMaxLength.Name = "nudCellMaxLength";
            this.nudCellMaxLength.Size = new System.Drawing.Size(120, 21);
            this.nudCellMaxLength.TabIndex = 1;
            //
            // nudCellMaxWidth
            //
            this.nudCellMaxWidth.DecimalPlaces = 2;
            this.nudCellMaxWidth.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMaxWidth.Location = new System.Drawing.Point(49, 60);
            this.nudCellMaxWidth.Name = "nudCellMaxWidth";
            this.nudCellMaxWidth.Size = new System.Drawing.Size(120, 21);
            this.nudCellMaxWidth.TabIndex = 1;
            //
            // groupBox31
            //
            this.groupBox31.Controls.Add(this.nudCellMinWidth);
            this.groupBox31.Controls.Add(this.nudCellMinLength);
            this.groupBox31.Controls.Add(this.label149);
            this.groupBox31.Controls.Add(this.label150);
            this.groupBox31.Location = new System.Drawing.Point(236, 105);
            this.groupBox31.Name = "groupBox31";
            this.groupBox31.Size = new System.Drawing.Size(200, 100);
            this.groupBox31.TabIndex = 2;
            this.groupBox31.TabStop = false;
            this.groupBox31.Text = "电池长宽下限";
            //
            // nudCellMinWidth
            //
            this.nudCellMinWidth.DecimalPlaces = 2;
            this.nudCellMinWidth.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMinWidth.Location = new System.Drawing.Point(49, 60);
            this.nudCellMinWidth.Name = "nudCellMinWidth";
            this.nudCellMinWidth.Size = new System.Drawing.Size(120, 21);
            this.nudCellMinWidth.TabIndex = 1;
            //
            // nudCellMinLength
            //
            this.nudCellMinLength.DecimalPlaces = 2;
            this.nudCellMinLength.Increment = new decimal(new int[] {
            1,
            0,
            0,
            131072});
            this.nudCellMinLength.Location = new System.Drawing.Point(49, 29);
            this.nudCellMinLength.Name = "nudCellMinLength";
            this.nudCellMinLength.Size = new System.Drawing.Size(120, 21);
            this.nudCellMinLength.TabIndex = 1;
            //
            // label149
            //
            this.label149.AutoSize = true;
            this.label149.Location = new System.Drawing.Point(13, 65);
            this.label149.Name = "label149";
            this.label149.Size = new System.Drawing.Size(17, 12);
            this.label149.TabIndex = 0;
            this.label149.Text = "宽";
            //
            // label150
            //
            this.label150.AutoSize = true;
            this.label150.Location = new System.Drawing.Point(13, 31);
            this.label150.Name = "label150";
            this.label150.Size = new System.Drawing.Size(17, 12);
            this.label150.TabIndex = 0;
            this.label150.Text = "长";
            this.chkSaveHeightOK.AutoSize = true;
            this.chkSaveHeightOK.Location = new System.Drawing.Point(172, 65);
            this.chkSaveHeightOK.Name = "chkSaveHeightOK";
            this.chkSaveHeightOK.Size = new System.Drawing.Size(132, 16);
            this.chkSaveHeightOK.TabIndex = 1;
            this.chkSaveHeightOK.Text = "保存高度检测OK图片";
            this.chkSaveHeightOK.UseVisualStyleBackColor = true;
            this.chkSaveHeightOK.CheckedChanged += new System.EventHandler(this.chkSaveOKLWImage_CheckedChanged);
            // 
            // ConfigForm
            // 
@@ -4831,6 +4844,14 @@
            this.tpPLC.ResumeLayout(false);
            this.tbSoft.ResumeLayout(false);
            this.tbSoft.PerformLayout();
            this.groupBox31.ResumeLayout(false);
            this.groupBox31.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinWidth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinLength)).EndInit();
            this.groupBox30.ResumeLayout(false);
            this.groupBox30.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxWidth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxLength)).EndInit();
            this.groupBox14.ResumeLayout(false);
            this.groupBox5.ResumeLayout(false);
            this.groupBox5.PerformLayout();
@@ -4866,14 +4887,6 @@
            this.groupBox28.PerformLayout();
            this.groupBox29.ResumeLayout(false);
            this.groupBox29.PerformLayout();
            this.groupBox30.ResumeLayout(false);
            this.groupBox30.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxLength)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMaxWidth)).EndInit();
            this.groupBox31.ResumeLayout(false);
            this.groupBox31.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinWidth)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.nudCellMinLength)).EndInit();
            this.ResumeLayout(false);
        }
@@ -5308,5 +5321,6 @@
        private System.Windows.Forms.NumericUpDown nudCellMaxLength;
        private System.Windows.Forms.Label label148;
        private System.Windows.Forms.Label label147;
        private System.Windows.Forms.CheckBox chkSaveHeightOK;
    }
}
ConfigForm.cs
@@ -117,6 +117,7 @@
            LoadDeviceStatus();
            chkSaveOKLWImage.Checked = config.IsSaveSizeOKImage;
            chkSaveHeightOK.Checked = config.IsSaveHeightOKImage;
            nudCellMaxLength.Value = (decimal)config.MaxLength;
            nudCellMaxWidth.Value = (decimal)config.MaxWidth;
@@ -803,6 +804,7 @@
        private void chkSaveOKLWImage_CheckedChanged(object sender, EventArgs e)
        {
            config.IsSaveSizeOKImage = chkSaveOKLWImage.Checked;
            config.IsSaveHeightOKImage = chkSaveHeightOK.Checked;
        }
        #endregion
    }
HeightDetection.cs
@@ -125,7 +125,10 @@
                    CommonUtil.mainForm.Invoke(new Action(() => CommonUtil.mainForm.AppendDetectionData(productNo)));
                    int detectID = CommonUtil.StepControl.GetDetectHeightID();
                    string tempFileName = CommonUtil.mainForm.PlateID.ToString() + "_" + productNo.Trim().Replace("/", "").Replace("\"", "'") + "_" + DateTime.Now.ToString("HHmmssff") + "_" + detectID.ToString();
                    int slotNum = (CommonUtil.mainForm.PlateID + 1) % 5 + 1;
                    string tempFileName = slotNum.ToString() + "_" + productNo.Trim().Replace("/", "").Replace("\"", "'") + "_" + DateTime.Now.ToString("HHmmssff") + "_" + detectID.ToString();
                    if (productNo.Trim().Length == CommonUtil.ProductNoLength)
                    {
                        string productNoFileName = CommonUtil.ProductNoImageDir + @"\" + productNo + "_" + detectID.ToString();
@@ -165,7 +168,7 @@
                                double compv = 0.0;
                                Type t = opcConfig.compensationZ.GetType();
                                int slotNum = (CommonUtil.mainForm.PlateID + 1) % 5 + 1;
                                FieldInfo fi = t.GetField(string.Format("station{0}", slotNum));
                                compv = (double)fi.GetValue(opcConfig.compensationZ);
@@ -227,6 +230,20 @@
                        {
                            heightFileName = VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + $"_{heightResult.ToString()}\\{ tempFileName}");
                        }
                        else
                        {
                            if (opcConfig.IsSaveHeightOKImage)
                            {
                                //DateTime dt = DateTime.Now;
                                //if (dt.Second >= 10 && dt.Second <= 15)
                                {
                                    VisionDetect.SaveImageAs(hi, CommonUtil.ProductHeightImageDir + @"_OK\" + tempFileName);
                                }
                            }
                        }
                        CommonUtil.WriteLog(LogType.Inf, string.Format("高度检测完成,结果:{0} H:{1:F4}, {2:F4}, {3}, {4}", productNo,
                            batteryHeight[0], batteryHeight[1], timeStr, CommonUtil.StepControl.ToString()));
                    }
OPCConfigStruct.cs
@@ -207,6 +207,7 @@
        #region add by Patrick
        public bool IsSaveSizeOKImage;
        public bool IsSaveHeightOKImage;
        public float MaxLength;
        public float MaxWidth;
        public float MinLength;
Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.0")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyVersion("1.0.3.0")]
[assembly: AssemblyFileVersion("1.0.3.0")]