using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Forms; using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.BLL.Log; using MESClassLibrary.BLL.ZPPlan; namespace InjectionPC { public partial class FrmBuDa : Form { public FrmBuDa() { InitializeComponent(); } public event Action OkBtnClick; private void button1_Click(object sender, EventArgs e) { this.Close(); } private void textBox1_KeyDown(object sender, KeyEventArgs e) { try { string barCode = ""; ZPRecordBLL bll = new ZPRecordBLL(); if (e.KeyCode == Keys.Enter) { if (textBox1.Text.Trim() == "") { MessageBox.Show("请输入条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } DataTable dt = bll.SearchBarCode(textBox1.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { barCode = dt.Rows[0]["OneBarCode1"].ToString(); } else { MessageBox.Show("请输入条码不存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } DataTable dt2 = bll.SearchInfo(textBox1.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { barCode = textBox1.Text.Trim(); } else { MessageBox.Show("请输入条码不存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); return; } if (OkBtnClick != null) { OkBtnClick(barCode); this.Close(); } } } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); } } } }