| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System;
- using System.Data;
- using System.Drawing;
- 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_OutBoxSnCheck : Form
- {
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataHelper dh;
- LogStringBuilder sql;
- DataTable dt;
- public Make_OutBoxSnCheck()
- {
- 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);
- }
- bool FindColorSN = false;
- int RowIndex = 0;
- string ms_makecode = "";
- private void sncode_KeyDown(object sender, KeyEventArgs e)
- {
- //判断是enter事件
- if (e.KeyCode == Keys.Enter)
- {
- string ErrorMessage = "";
- if (sncode.Text == "")
- {
- OperateResult.AppendText("<<输入不能为空\n", Color.Red);
- return;
- }
- bool AllCheck = true;
- for (int i = 0; i < CheckSnDGV.Rows.Count; i++)
- {
- object colorcode = CheckSnDGV.Rows[RowIndex].Cells["pr_colorcode"].Value;
- if ((colorcode != null ? colorcode.ToString() : "") + CheckSnDGV.Rows[i].Cells["pd_barcode"].Value.ToString() == sncode.Text)
- {
- CheckSnDGV.Rows[i].Cells["pd_checksn"].Value = sncode.Text;
- RowIndex = i;
- FindColorSN = true;
- }
- if (CheckSnDGV.Rows[i].Cells["pd_checksn"].Value == null)
- {
- AllCheck = false;
- }
- }
- if (FindColorSN)
- {
- OperateResult.AppendText("<<" + sncode.Text + "彩盒校验成功\n", Color.Green, sncode);
- }
- if (AllCheck)
- {
- SetCheck set = new SetCheck("OK", Color.Green);
- BaseUtil.SetFormCenter(set);
- set.ShowDialog();
- if (LogicHandler.OutBoxStepPass(pa_outboxcode.Text, ms_makecode, User.UserSourceCode, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
- {
- dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
- OperateResult.AppendText("<<" + pa_outboxcode.Text + "整箱校验通过\n", Color.Green, pa_outboxcode);
- }
- else
- {
- OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
- }
- pa_outboxcode.Focus();
- }
- }
- }
- private void pa_outboxcode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- dt = (DataTable)dh.ExecuteSql("select pd_barcode,PR_COLORCODE,pd_makecode from packagedetail left join product on pr_code=PD_PRODCODE where pd_outboxcode='" + pa_outboxcode.Text + "'", "select");
- if (dt.Rows.Count > 0)
- {
- ms_makecode = dt.Rows[0]["pd_makecode"].ToString();
- BaseUtil.FillDgvWithDataTable(CheckSnDGV, dt);
- sncode.Focus();
- }
- else
- {
- OperateResult.AppendText("<<箱号" + pa_outboxcode.Text + "不存在\n", Color.Red);
- }
- }
- }
- }
- }
|