Special_CancelImei.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Data;
  3. using System.Windows.Forms;
  4. using UAS_MES_NEW.DataOperate;
  5. using UAS_MES_NEW.Entity;
  6. using UAS_MES_NEW.PublicMethod;
  7. namespace UAS_MES_NEW.Special
  8. {
  9. public partial class Special_CancelImei : Form
  10. {
  11. DataHelper dh;
  12. LogStringBuilder sql = new LogStringBuilder();
  13. public Special_CancelImei()
  14. {
  15. InitializeComponent();
  16. }
  17. private void Special_BoxSplit_Load(object sender, EventArgs e)
  18. {
  19. dh = SystemInf.dh;
  20. }
  21. private void Split_Click(object sender, EventArgs e)
  22. {
  23. }
  24. private void SaveRepairInf_Click(object sender, EventArgs e)
  25. {
  26. barcode_KeyDown(sender, new KeyEventArgs(Keys.Enter));
  27. }
  28. private void barcode_KeyDown(object sender, KeyEventArgs e)
  29. {
  30. if (e.KeyCode == Keys.Enter)
  31. {
  32. if (Reason.Text == "")
  33. {
  34. MessageBox.Show("必须填写原因");
  35. return;
  36. }
  37. DataTable dt = (DataTable)dh.ExecuteSql("select pa_id,nvl(pa_downstatus,0)pa_downstatus from package where pa_outboxcode='" + barcode.Text + "'", "select");
  38. if (dt.Rows.Count > 0)
  39. {
  40. if (Down.Checked)
  41. {
  42. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  43. if (pa_downstatus == "-1")
  44. {
  45. OperateResult.AppendText(barcode.Text + "已被冻结", System.Drawing.Color.Red);
  46. return;
  47. }
  48. dh.ExecuteSql("update package set pa_downstatus=-1 where pa_outboxcode='" + barcode.Text + "'", "update");
  49. LogicHandler.DoCommandLog("DownPackage", User.UserName, "", User.UserLineCode, User.UserSourceCode, "箱号冻结", "冻结成功" + Reason.Text, barcode.Text, "");
  50. OperateResult.AppendText(barcode.Text + "冻结成功", System.Drawing.Color.Green);
  51. }
  52. if (Up.Checked)
  53. {
  54. string pa_downstatus = dt.Rows[0]["pa_downstatus"].ToString();
  55. if (pa_downstatus != "-1")
  56. {
  57. OperateResult.AppendText(barcode.Text + "未被冻结", System.Drawing.Color.Red);
  58. return;
  59. }
  60. dh.ExecuteSql("update package set pa_downstatus=0 where pa_outboxcode='" + barcode.Text + "'", "update");
  61. LogicHandler.DoCommandLog("DownPackage", User.UserName, "", User.UserLineCode, User.UserSourceCode, "箱号冻结", "取消冻结成功" + Reason.Text, barcode.Text, "");
  62. OperateResult.AppendText(barcode.Text + "取消冻结成功", System.Drawing.Color.Green);
  63. }
  64. }
  65. else
  66. {
  67. OperateResult.AppendText(barcode.Text + "不存在", System.Drawing.Color.Red);
  68. }
  69. }
  70. }
  71. }
  72. }