Special_CancelMaterial.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using UAS_MES_NEW.DataOperate;
  7. using UAS_MES_NEW.Entity;
  8. using UAS_MES_NEW.PublicMethod;
  9. namespace UAS_MES_NEW.Special
  10. {
  11. public partial class Special_CancelMaterial : Form
  12. {
  13. DataHelper dh = SystemInf.dh;
  14. LogStringBuilder sql = new LogStringBuilder();
  15. public Special_CancelMaterial()
  16. {
  17. InitializeComponent();
  18. }
  19. private void Confirm_Click(object sender, EventArgs e)
  20. {
  21. //获取序列号的途程
  22. DataTable dt = (DataTable)dh.ExecuteSql("select ms_firstsn,ms_id,ms_nextstepcode,ms_currentstepcode,ms_makecode,ms_status,ms_checkno,ms_craftcode,ms_prodcode,ms_stepcode from makeserial where ms_sncode='" + sn_code.Text + "' and ms_makecode='" + ms_makecode.Text + "' order by ms_id desc", "select");
  23. if (dt.Rows.Count > 0)
  24. {
  25. string pr_code = dt.Rows[0]["ms_prodcode"].ToString();
  26. string cr_code = dt.Rows[0]["ms_craftcode"].ToString();
  27. string ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
  28. string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
  29. string ms_checkno = dt.Rows[0]["ms_checkno"].ToString();
  30. string ms_status = dt.Rows[0]["ms_status"].ToString();
  31. string ms_currentstepcode = dt.Rows[0]["ms_currentstepcode"].ToString();
  32. string ms_id = dt.Rows[0]["ms_id"].ToString();
  33. string ms_firstsn = dt.Rows[0]["ms_firstsn"].ToString();
  34. if (ms_status != "3")
  35. {
  36. OperateResult.AppendText(">>序列号" + sn_code.Text + "不处于维修状态,不允许拆解" + ms_makecode.Text + "\n", Color.Red, sn_code);
  37. return;
  38. }
  39. dh.ExecuteSql("update craftmaterial set cm_status=-1 where cm_firstsn='" + ms_firstsn + "' and cm_makecode='" + ms_makecode.Text + "'", "update");
  40. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "解绑物料", "解绑物料成功", sn_code.Text, "");
  41. OperateResult.AppendText(">>序列号" + sn_code.Text + "成功解除绑定\n", Color.Green, sn_code);
  42. }
  43. else OperateResult.AppendText(">>序列号" + sn_code.Text + "不存在于工单" + ms_makecode.Text + "\n", Color.Red, sn_code);
  44. }
  45. private void Clean_Click(object sender, EventArgs e)
  46. {
  47. OperateResult.Clear();
  48. }
  49. private void Special_CancelCollection_Load(object sender, EventArgs e)
  50. {
  51. }
  52. }
  53. }