using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicForm; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Make { public partial class Make_OutBoxSnCheckPa : Form { AutoSizeFormClass asc = new AutoSizeFormClass(); DataHelper dh; LogStringBuilder sql; DataTable dt; public Make_OutBoxSnCheckPa() { InitializeComponent(); } private void Make_LabelCheck_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); //聚焦SN号 pa_outboxcode.Focus(); //打开界面提示用户:请输入SN OperateResult.AppendText(">>请采集箱号\n", Color.Black); sql = new LogStringBuilder(); dh = SystemInf.dh; } private void Make_LabelCheck_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } int CheckCount = 0; private void sncode_KeyDown(object sender, KeyEventArgs e) { //判断是enter事件 if (e.KeyCode == Keys.Enter) { if (sncode.Text == "") { OperateResult.AppendText("<<输入不能为空\n", Color.Red); return; } bool FindSN = false; bool AllCheck = true; for (int i = 0; i < CheckSnDGV.Rows.Count; i++) { if (CheckSnDGV.Rows[i].Cells["pd_checksn"].Value != null && CheckSnDGV.Rows[i].Cells["pd_checksn"].Value.ToString() == sncode.Text) { OperateResult.AppendText("<<" + sncode.Text + "已校验\n", Color.Red); return; } if (CheckSnDGV.Rows[i].Cells["pd_barcode"].Value.ToString() == sncode.Text) { CheckSnDGV.Rows[i].Cells["pd_checksn"].Value = sncode.Text; FindSN = true; } if (CheckSnDGV.Rows[i].Cells["pd_checksn"].Value == null) { AllCheck = false; } } if (FindSN) { OperateResult.AppendText("< 0) { CheckLabel.Text = CheckCount + "/" + dt.Rows.Count; BaseUtil.FillDgvWithDataTable(CheckSnDGV, dt); sncode.Focus(); } else { OperateResult.AppendText("<<箱号" + pa_outboxcode.Text + "不存在\n", Color.Red); } CheckCount = 0; } } private void cancel_Click(object sender, EventArgs e) { CheckCount = 0; dt = (DataTable)dh.ExecuteSql("select pa_outboxcode from package where pa_mothercode='" + pa_outboxcode.Text + "'", "select"); if (dt.Rows.Count > 0) { CheckLabel.Text = CheckCount + "/" + dt.Rows.Count; BaseUtil.FillDgvWithDataTable(CheckSnDGV, dt); sncode.Focus(); } else { OperateResult.AppendText("<<箱号" + pa_outboxcode.Text + "不存在\n", Color.Red); } CheckCount = 0; } } }