123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- 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.PublicMethod;
- namespace UAS_MES_NEW.Make
- {
- public partial class Make_LabelCheck : Form
- {
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataHelper dh;
- LogStringBuilder sql;
- DataTable dt;
- DataTable info;
- DataTable checkItemInfo;//存储需要核对的所有信息列表
- string needCheckedInfo = "";
- bool isCheckItem = false;
- string oErrorMessage = "";
- string TSN = "";//存TSN
- string omakeCode = "";
- string oMsid = "";
- int checkIndex = 0;//记录核对的当前位置,从0开始
- public Make_LabelCheck()
- {
- InitializeComponent();
- }
- private void Make_LabelCheck_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- //聚焦sncode.Text号
- sncode.Focus();
- //打开界面提示用户:请输入sncode.Text
- OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
- sql = new LogStringBuilder();
- dh = SystemInf.dh;
- StepCount.StepCode = User.CurrentStepCode;
- StepCount.Source = User.UserSourceCode;
- StepCount.LineCode = User.UserLineCode;
- StepCount.Dh = dh;
- StepCount.Start();
- }
- private void Make_LabelCheck_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void sncode_KeyDown(object sender, KeyEventArgs e)
- {
- //判断是enter事件
- if (e.KeyCode == Keys.Enter)
- {
- if (sncode.Text == "")
- {
- OperateResult.AppendText("<<输入不能为空\n", Color.Red);
- return;
- }
- //输入的是sncode.Text
- //说明输入的核对信息对比一致
- //判断工序属性attribute
- if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out oErrorMessage))
- {
- //判断序列号下一工序(CHECKSTEPSNANDMACODE)
- if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sncode.Text, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
- {
- //if (!LogicHandler.CheckSeeWoSN(sncode.Text, out oErrorMessage))
- //{
- // OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- // return;
- //}
- //调用 SETSTEPRESULT ,获取返回的工单号,
- if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, sncode.Text, "标签核对", "OK", User.UserCode, out oErrorMessage))
- {
- //提示正确返回时传递的信息
- if (oErrorMessage.Contains("AFTERSUCCESS"))
- OperateResult.AppendText(">>" + oErrorMessage + "\n");
- //根据工单号查询makecraftdetail 表中的 mcd_okqty 计数,剩余数为ma_qty - nvl(mcd_inqty,0),刷新页面中工单信息的显示
- sql.Clear();
- sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,");
- sql.Append("ma_qty - nvl(mcd_okqty, 0) remain_qty from make left join makecraftdetail on ");
- sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
- dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.SetFormValue(Controls, dt);
- //将sncode.Text,时间,结果记录在页面
- //记录日志
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "标签核对", "标签核对成功", sncode.Text, "");
- //IMEI核对成功
- //>> 请输入sncode.Text
- OperateResult.AppendText("<<核对成功\n", Color.Green, sncode);
- }
- else
- {
- //setstepresult不通过
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- }
- else
- {
- //判定序列号下一工序不通过
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- }
- else
- {
- //判定工序属性不通过
- OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
- }
- OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
- checkIndex = 0;
- isCheckItem = false;
- }
- }
-
- private void clear()
- {
- //清空变量的值
- omakeCode = "";
- oMsid = "";
- sncode.Text = "";
- needCheckedInfo = "";
- }
-
- private void cancel_Click(object sender, EventArgs e)
- {
- OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
- checkIndex = 0;
- isCheckItem = false;
- sncode.Text = "";
- }
- }
- }
|