diff --git a/C-Windows-1/Config.Designer.cs b/C-Windows-1/Config.Designer.cs index 7bb365a..3a186b6 100644 --- a/C-Windows-1/Config.Designer.cs +++ b/C-Windows-1/Config.Designer.cs @@ -37,6 +37,8 @@ this.CodeLength = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.codelengthcheck = new System.Windows.Forms.CheckBox(); + this.textPreSn = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // // label4 @@ -63,7 +65,7 @@ // // Use_Set // - this.Use_Set.Location = new System.Drawing.Point(152, 206); + this.Use_Set.Location = new System.Drawing.Point(152, 269); this.Use_Set.Name = "Use_Set"; this.Use_Set.Size = new System.Drawing.Size(103, 43); this.Use_Set.TabIndex = 160; @@ -97,7 +99,7 @@ this.label8.Location = new System.Drawing.Point(127, 82); this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(103, 16); + this.label8.Size = new System.Drawing.Size(104, 16); this.label8.TabIndex = 157; this.label8.Text = "modbus从站号"; // @@ -115,7 +117,7 @@ this.label19.Location = new System.Drawing.Point(127, 137); this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label19.Name = "label19"; - this.label19.Size = new System.Drawing.Size(87, 16); + this.label19.Size = new System.Drawing.Size(88, 16); this.label19.TabIndex = 159; this.label19.Text = "条形码长度"; // @@ -124,17 +126,35 @@ this.codelengthcheck.AutoSize = true; this.codelengthcheck.Location = new System.Drawing.Point(294, 159); this.codelengthcheck.Name = "codelengthcheck"; - this.codelengthcheck.Size = new System.Drawing.Size(90, 20); + this.codelengthcheck.Size = new System.Drawing.Size(91, 20); this.codelengthcheck.TabIndex = 163; this.codelengthcheck.Text = "长度检测"; this.codelengthcheck.UseVisualStyleBackColor = true; this.codelengthcheck.Visible = false; // + // textPreSn + // + this.textPreSn.Location = new System.Drawing.Point(130, 225); + this.textPreSn.Name = "textPreSn"; + this.textPreSn.Size = new System.Drawing.Size(157, 26); + this.textPreSn.TabIndex = 164; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(127, 203); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(72, 16); + this.label2.TabIndex = 165; + this.label2.Text = "条码前缀"; + // // Config // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(415, 264); + this.ClientSize = new System.Drawing.Size(415, 324); + this.Controls.Add(this.label2); + this.Controls.Add(this.textPreSn); this.Controls.Add(this.codelengthcheck); this.Controls.Add(this.label4); this.Controls.Add(this.label1); @@ -163,5 +183,7 @@ private System.Windows.Forms.TextBox CodeLength; private System.Windows.Forms.Label label19; public System.Windows.Forms.CheckBox codelengthcheck; + public System.Windows.Forms.TextBox textPreSn; + private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/C-Windows-1/Config.cs b/C-Windows-1/Config.cs index 4491c60..72cf8a6 100644 --- a/C-Windows-1/Config.cs +++ b/C-Windows-1/Config.cs @@ -23,8 +23,10 @@ namespace C_Windows_1 // Form1.f1.Code_Head.Text = Code_Head.Text; Form1.f1.codecheck.Text = CodeLength.Text; Form1.f1.CodeLength.Text = CodeLength.Text; + Form1.f1.textPreSn.Text = textPreSn.Text; + + - this.Close(); } @@ -46,9 +48,7 @@ namespace C_Windows_1 // regName.SetValue("codehead", Code_Head.Text); regName.SetValue("codelength", CodeLength.Text); regName.SetValue("codelengthcheck", codelengthcheck.Checked); - - - + regName.SetValue("codePreSn", textPreSn.Text); regName.Close(); } diff --git a/C-Windows-1/Form1.Designer.cs b/C-Windows-1/Form1.Designer.cs index 19e8225..a500931 100644 --- a/C-Windows-1/Form1.Designer.cs +++ b/C-Windows-1/Form1.Designer.cs @@ -134,6 +134,9 @@ this.textBox1 = new System.Windows.Forms.TextBox(); this.timerCH1 = new System.Windows.Forms.Timer(this.components); this.checkCodeRepeat = new System.Windows.Forms.CheckBox(); + this.checkPreSn = new System.Windows.Forms.CheckBox(); + this.label41 = new System.Windows.Forms.Label(); + this.textPreSn = new System.Windows.Forms.TextBox(); this.myGroupBox4 = new C_Windows_1.MyGroupBox(this.components); this.PUnit = new System.Windows.Forms.ComboBox(); this.label47 = new System.Windows.Forms.Label(); @@ -755,10 +758,10 @@ // codecheck // this.codecheck.Enabled = false; - this.codecheck.Location = new System.Drawing.Point(865, 77); + this.codecheck.Location = new System.Drawing.Point(924, 72); this.codecheck.Name = "codecheck"; this.codecheck.ReadOnly = true; - this.codecheck.Size = new System.Drawing.Size(100, 21); + this.codecheck.Size = new System.Drawing.Size(90, 21); this.codecheck.TabIndex = 142; this.codecheck.TextChanged += new System.EventHandler(this.codecheck_TextChanged); // @@ -766,7 +769,7 @@ // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(872, 50); + this.label9.Location = new System.Drawing.Point(921, 49); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(88, 16); this.label9.TabIndex = 143; @@ -889,7 +892,7 @@ // checkBox2 // this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(870, 172); + this.checkBox2.Location = new System.Drawing.Point(870, 208); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(90, 16); this.checkBox2.TabIndex = 173; @@ -1064,7 +1067,7 @@ // this.label50.AutoSize = true; this.label50.Font = new System.Drawing.Font("宋体", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label50.Location = new System.Drawing.Point(866, 201); + this.label50.Location = new System.Drawing.Point(866, 237); this.label50.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label50.Name = "label50"; this.label50.Size = new System.Drawing.Size(87, 22); @@ -1074,7 +1077,7 @@ // textBox3 // this.textBox3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox3.Location = new System.Drawing.Point(865, 233); + this.textBox3.Location = new System.Drawing.Point(865, 269); this.textBox3.Multiline = true; this.textBox3.Name = "textBox3"; this.textBox3.Size = new System.Drawing.Size(148, 101); @@ -1102,6 +1105,36 @@ this.checkCodeRepeat.UseVisualStyleBackColor = true; this.checkCodeRepeat.CheckedChanged += new System.EventHandler(this.checkCodeRepeat_CheckedChanged); // + // checkPreSn + // + this.checkPreSn.AutoSize = true; + this.checkPreSn.Location = new System.Drawing.Point(869, 157); + this.checkPreSn.Name = "checkPreSn"; + this.checkPreSn.Size = new System.Drawing.Size(96, 16); + this.checkPreSn.TabIndex = 188; + this.checkPreSn.Text = "条码前缀检测"; + this.checkPreSn.UseVisualStyleBackColor = true; + this.checkPreSn.CheckedChanged += new System.EventHandler(this.checkPreCheck_CheckedChanged); + // + // label41 + // + this.label41.AutoSize = true; + this.label41.Font = new System.Drawing.Font("宋体", 12F); + this.label41.Location = new System.Drawing.Point(827, 49); + this.label41.Name = "label41"; + this.label41.Size = new System.Drawing.Size(72, 16); + this.label41.TabIndex = 189; + this.label41.Text = "条码前缀"; + // + // textPreSn + // + this.textPreSn.Enabled = false; + this.textPreSn.Location = new System.Drawing.Point(824, 72); + this.textPreSn.Name = "textPreSn"; + this.textPreSn.ReadOnly = true; + this.textPreSn.Size = new System.Drawing.Size(96, 21); + this.textPreSn.TabIndex = 190; + // // myGroupBox4 // this.myGroupBox4.Controls.Add(this.PUnit); @@ -1753,6 +1786,9 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1021, 675); + this.Controls.Add(this.textPreSn); + this.Controls.Add(this.label41); + this.Controls.Add(this.checkPreSn); this.Controls.Add(this.checkCodeRepeat); this.Controls.Add(this.textBox1); this.Controls.Add(this.label50); @@ -1810,7 +1846,7 @@ this.Controls.Add(this.groupBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; - this.Text = "LL18-25070103"; + this.Text = "LL18-25070202"; this.Activated += new System.EventHandler(this.Form1_Activated); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.Load += new System.EventHandler(this.Form1_Load); @@ -2004,5 +2040,8 @@ private System.Windows.Forms.Timer timerCH1; private System.Windows.Forms.CheckBox checkCodeRepeat; private System.Windows.Forms.ToolStripMenuItem mESSetToolStripMenuItem; + private System.Windows.Forms.CheckBox checkPreSn; + private System.Windows.Forms.Label label41; + public System.Windows.Forms.TextBox textPreSn; } } \ No newline at end of file diff --git a/C-Windows-1/Form1.cs b/C-Windows-1/Form1.cs index 17d9d63..e8b2cd7 100644 --- a/C-Windows-1/Form1.cs +++ b/C-Windows-1/Form1.cs @@ -77,6 +77,8 @@ namespace C_Windows_1 public string tester = ""; //测试员 public string machineNumber = ""; //测试设备编号 public string stationName = ""; //上工站名称 + + private string preSn = ""; //条码前缀 public Form1() { f1 = this; @@ -2376,6 +2378,7 @@ namespace C_Windows_1 private void 基本设置ToolStripMenuItem_Click(object sender, EventArgs e) { Config c1 = new Config(); + c1.textPreSn.Text = textPreSn.Text; OpenForm(c1); } @@ -2603,6 +2606,10 @@ namespace C_Windows_1 { checkCodeRepeat.Checked = Convert.ToBoolean(regName.GetValue("codeRepeatCheck")); } + if (regName.GetValue("codePreSn") != null) + { + textPreSn.Text = regName.GetValue("codePreSn").ToString(); + } if (regName.GetValue("codeTestCheck") is null) { @@ -2612,7 +2619,16 @@ namespace C_Windows_1 { checkBox2.Checked = Convert.ToBoolean(regName.GetValue("codeTestCheck")); } - + + if (regName.GetValue("codePreSnCheck") is null) + { + checkPreSn.Checked = true; + } + else + { + checkPreSn.Checked = Convert.ToBoolean(regName.GetValue("codePreSnCheck")); + } + if (regName.GetValue("Baudrate") is null) { @@ -2986,7 +3002,7 @@ namespace C_Windows_1 private void label32_Click(object sender, EventArgs e) { - AddDatebase(); + //AddDatebase(); } private void button1_Click_1(object sender, EventArgs e) @@ -3080,6 +3096,16 @@ namespace C_Windows_1 BarcodeInfo.InsertBarcodeData(time, Code.Text, "", "", "", "", "", ""); } } + //条码前缀检测 + if (checkPreSn.Checked) + { + if (!Code.Text.StartsWith(textPreSn.Text)) + { + MessageBox.Show(string.Format("条形码前缀错误!当前条码:{0},设置前缀为:{1}", this.Code.Text, this.textPreSn.Text)); + this.Code.ResetText(); + this.Code.Focus(); + } + } } public async Task InMes(int CH) @@ -3288,6 +3314,16 @@ namespace C_Windows_1 } } + private void checkPreCheck_CheckedChanged(object sender, EventArgs e) + { + RegistryKey regName; + + regName = openRegedit(); + + regName.SetValue("codePreSnCheck", checkPreSn.Checked); + regName.Close(); + } + //过站检测 private bool MesCheck(string sCode) { @@ -3308,12 +3344,12 @@ namespace C_Windows_1 } else if (nRet == 0) { - textBox3.Text = "上工序漏做"; //未过站 - MessageBox.Show("上工序漏做"); + textBox3.Text = "上工站漏做"; //未过站 + MessageBox.Show("上工站漏做"); } else { - textBox3.Text = "已过站:" + nRet.ToString(); + textBox3.Text = "非法值:" + nRet.ToString(); MessageBox.Show(textBox3.Text); } } diff --git a/C-Windows-1/bin/Debug/LL18-Control.exe b/C-Windows-1/bin/Debug/LL18-Control.exe index a829534..6f7b6c8 100644 Binary files a/C-Windows-1/bin/Debug/LL18-Control.exe and b/C-Windows-1/bin/Debug/LL18-Control.exe differ diff --git a/C-Windows-1/obj/Debug/LL18-Control.exe b/C-Windows-1/obj/Debug/LL18-Control.exe index a829534..6f7b6c8 100644 Binary files a/C-Windows-1/obj/Debug/LL18-Control.exe and b/C-Windows-1/obj/Debug/LL18-Control.exe differ