Make_Aging.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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_Aging : Form
  15. {
  16. DataHelper dh;
  17. AutoSizeFormClass asc = new AutoSizeFormClass();
  18. LogStringBuilder sql = new LogStringBuilder();
  19. DataTable dt;
  20. //当前序列号记录
  21. string sn_code;
  22. //制造单号
  23. string macode;
  24. //采集网标号
  25. float net_code;
  26. //网标查询条件ms_id
  27. string oMsID;
  28. //打印计数
  29. int printcount = 0;
  30. int ma_unlimitin;
  31. string ErrorMessage = "";
  32. string LastSncode;
  33. public Make_Aging()
  34. {
  35. InitializeComponent();
  36. }
  37. private void Make_CollectNetCode_Load(object sender, EventArgs e)
  38. {
  39. asc.controllInitializeSize(this);
  40. sncode.Focus();
  41. dh = SystemInf.dh;
  42. }
  43. private void sncode_KeyDown(object sender, KeyEventArgs e)
  44. {
  45. if (e.KeyCode == Keys.Enter)
  46. {
  47. //采集序列号
  48. if (sncode.Text == "")
  49. {
  50. OperateResult.AppendText(">>序列号不能为空\n", Color.Red);
  51. return;
  52. }
  53. DataTable dt = (DataTable)dh.ExecuteSql("select pa_makecode from package where pa_outboxcode='" + sncode.Text + "' and nvl(pa_status,0)=0 ", "select");
  54. if (dt.Rows.Count > 0)
  55. {
  56. string pa_makecode = dt.Rows[0]["pa_makecode"].ToString();
  57. {
  58. dh.UpdateByCondition("package", "pa_status=1,pa_totalqty=pa_currentqty,pa_packageqty=pa_currentqty", "pa_outboxcode='" + sncode.Text + "'");
  59. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode, User.UserLineCode, User.UserSourceCode, "老化上架", "箱号" + sncode.Text + "上架成功", sncode.Text, "");
  60. string ms_makecode = dh.getFieldDataByCondition("packagedetail", "pd_makecode", "pd_outboxcode = '" + sncode.Text + "'").ToString();
  61. if (LogicHandler.OutBoxStepPass(sncode.Text, ms_makecode, User.UserSourceCode, User.UserCode, "卡通箱:" + sncode.Text + "整箱过站", "卡通箱整箱过站", out ErrorMessage))
  62. {
  63. 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='" + sncode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + sncode.Text + "'");
  64. OperateResult.AppendText(">>箱号" + sncode.Text + "上架成功\n", Color.Green);
  65. }
  66. else
  67. {
  68. OperateResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);
  69. }
  70. //写入老化明细表
  71. dh.ExecuteSql("insert into AGEINGDETAIL(AGD_ID, AGD_AGCODE, AGD_MAKECODE, AGD_SNCODE, AGD_INDATE)" +
  72. "select AGEINGDETAIL_seq.nextval,'" + sncode.Text + "',pd_makecode,pd_barcode,sysdate from packagedetail " +
  73. "where pd_outboxcode='" + sncode.Text + "'", "insert");
  74. //显示老化数据
  75. dt = (DataTable)dh.ExecuteSql("select AGD_AGCODE,AGD_MAKECODE,AGD_SNCODE,to_char(AGD_INDATE,'yyyy-mm-dd hh24:mi:ss')AGD_INDATE " +
  76. "from AGEINGDETAIL where AGD_AGCODE='" + sncode.Text + "'", "select");
  77. BaseUtil.FillDgvWithDataTable(LabelDataGridView, dt);
  78. }
  79. }
  80. else OperateResult.AppendText(">>箱号" + sncode.Text + "已经上架\n", Color.Red);
  81. }
  82. }
  83. private void Make_CollectNetCode_SizeChanged(object sender, EventArgs e)
  84. {
  85. asc.controlAutoSize(this);
  86. }
  87. private void Make_CollectNetCode_Activated(object sender, EventArgs e)
  88. {
  89. sncode.Focus();
  90. }
  91. void fildgv()
  92. {
  93. }
  94. private void snCollectionBox1_KeyDown(object sender, KeyEventArgs e)
  95. {
  96. if (e.KeyCode == Keys.Enter)
  97. {
  98. fildgv();
  99. sncode.Focus();
  100. sncode.SelectAll();
  101. }
  102. }
  103. }
  104. }