Make_LabelCheck.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. using UAS_MES_NEW.PublicMethod;
  12. namespace UAS_MES_NEW.Make
  13. {
  14. public partial class Make_LabelCheck : Form
  15. {
  16. AutoSizeFormClass asc = new AutoSizeFormClass();
  17. DataHelper dh;
  18. LogStringBuilder sql;
  19. DataTable dt;
  20. DataTable info;
  21. DataTable checkItemInfo;//存储需要核对的所有信息列表
  22. string needCheckedInfo = "";
  23. bool isCheckItem = false;
  24. string oErrorMessage = "";
  25. string TSN = "";//存TSN
  26. string omakeCode = "";
  27. string oMsid = "";
  28. int checkIndex = 0;//记录核对的当前位置,从0开始
  29. public Make_LabelCheck()
  30. {
  31. InitializeComponent();
  32. }
  33. private void Make_LabelCheck_Load(object sender, EventArgs e)
  34. {
  35. asc.controllInitializeSize(this);
  36. //聚焦sncode.Text号
  37. sncode.Focus();
  38. //打开界面提示用户:请输入sncode.Text
  39. OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
  40. sql = new LogStringBuilder();
  41. dh = SystemInf.dh;
  42. StepCount.StepCode = User.CurrentStepCode;
  43. StepCount.Source = User.UserSourceCode;
  44. StepCount.LineCode = User.UserLineCode;
  45. StepCount.Dh = dh;
  46. StepCount.Start();
  47. }
  48. private void Make_LabelCheck_SizeChanged(object sender, EventArgs e)
  49. {
  50. asc.controlAutoSize(this);
  51. }
  52. private void sncode_KeyDown(object sender, KeyEventArgs e)
  53. {
  54. //判断是enter事件
  55. if (e.KeyCode == Keys.Enter)
  56. {
  57. if (sncode.Text == "")
  58. {
  59. OperateResult.AppendText("<<输入不能为空\n", Color.Red);
  60. return;
  61. }
  62. //输入的是sncode.Text
  63. //说明输入的核对信息对比一致
  64. //判断工序属性attribute
  65. if (LogicHandler.CheckStepAttribute(Tag.ToString(), User.UserSourceCode, out oErrorMessage))
  66. {
  67. //判断序列号下一工序(CHECKSTEPSNANDMACODE)
  68. if (LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, sncode.Text, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
  69. {
  70. //if (!LogicHandler.CheckSeeWoSN(sncode.Text, out oErrorMessage))
  71. //{
  72. // OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
  73. // return;
  74. //}
  75. //调用 SETSTEPRESULT ,获取返回的工单号,
  76. if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, sncode.Text, "标签核对", "OK", User.UserCode, out oErrorMessage))
  77. {
  78. //提示正确返回时传递的信息
  79. if (oErrorMessage.Contains("AFTERSUCCESS"))
  80. OperateResult.AppendText(">>" + oErrorMessage + "\n");
  81. //根据工单号查询makecraftdetail 表中的 mcd_okqty 计数,剩余数为ma_qty - nvl(mcd_inqty,0),刷新页面中工单信息的显示
  82. sql.Clear();
  83. sql.Append("select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,");
  84. sql.Append("ma_qty - nvl(mcd_okqty, 0) remain_qty from make left join makecraftdetail on ");
  85. sql.Append("mcd_maid=ma_id left join product on pr_code=ma_prodcode where ma_code='" + omakeCode + "' and mcd_stepcode='" + User.CurrentStepCode + "'");
  86. dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
  87. BaseUtil.SetFormValue(Controls, dt);
  88. //将sncode.Text,时间,结果记录在页面
  89. //记录日志
  90. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "标签核对", "标签核对成功", sncode.Text, "");
  91. //IMEI核对成功
  92. //>> 请输入sncode.Text
  93. OperateResult.AppendText("<<核对成功\n", Color.Green, sncode);
  94. }
  95. else
  96. {
  97. //setstepresult不通过
  98. OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
  99. }
  100. }
  101. else
  102. {
  103. //判定序列号下一工序不通过
  104. OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
  105. }
  106. }
  107. else
  108. {
  109. //判定工序属性不通过
  110. OperateResult.AppendText(">>" + oErrorMessage + "\n", Color.Red, sncode);
  111. }
  112. OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
  113. checkIndex = 0;
  114. isCheckItem = false;
  115. }
  116. }
  117. private void clear()
  118. {
  119. //清空变量的值
  120. omakeCode = "";
  121. oMsid = "";
  122. sncode.Text = "";
  123. needCheckedInfo = "";
  124. }
  125. private void cancel_Click(object sender, EventArgs e)
  126. {
  127. OperateResult.AppendText(">>请采集sncode.Text\n", Color.Black);
  128. checkIndex = 0;
  129. isCheckItem = false;
  130. sncode.Text = "";
  131. }
  132. }
  133. }