Special_CancelImei.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. if (Reason.Text == "")
  27. {
  28. MessageBox.Show("必须填写原因");
  29. return;
  30. }
  31. DataTable dt = (DataTable)dh.ExecuteSql("select ms_sncode,ms_imei1 from makeserial where ms_imei1 ='" + IMEI.Text + "'", "select");
  32. if (dt.Rows.Count > 0)
  33. {
  34. dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei1='" + IMEI.Text + "'", "select");
  35. if (dt.Rows.Count > 0)
  36. {
  37. string sn = dt.Rows[0]["ms_sncode"].ToString();
  38. string pr_detail = dt.Rows[0]["pr_detail"].ToString();
  39. dh.ExecuteSql("update makeserial set ms_imei='" + Reason.Text + "',ms_imei1='' where ms_imei1='" + IMEI.Text + "'", "update");
  40. dh.ExecuteSql("update sninfo set si_imei1='' where si_imei1='" + IMEI.Text + "'", "update");
  41. LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, sn + " " + Reason.Text, "取消成功", IMEI.Text, "");
  42. OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
  43. }
  44. else
  45. {
  46. OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
  47. }
  48. }
  49. else
  50. {
  51. dt = (DataTable)dh.ExecuteSql("select ms_sncode,ms_imei1 from makeserial where ms_imei2 ='" + IMEI.Text + "'", "select");
  52. if (dt.Rows.Count > 0)
  53. {
  54. dt = (DataTable)dh.ExecuteSql("select ms_sncode,substr(pr_detail,0,15)pr_detail from makeserial left join product on pr_code=ms_prodcode where ms_imei2='" + IMEI.Text + "'", "select");
  55. if (dt.Rows.Count > 0)
  56. {
  57. string sn = dt.Rows[0]["ms_sncode"].ToString();
  58. string pr_detail = dt.Rows[0]["pr_detail"].ToString();
  59. dh.ExecuteSql("update makeserial set ms_imei='" + Reason.Text + "',ms_imei2='' where ms_imei2='" + IMEI.Text + "'", "update");
  60. dh.ExecuteSql("update sninfo set si_imei2='' where si_imei2='" + IMEI.Text + "'", "update");
  61. LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, sn + " " + Reason.Text, "取消成功", IMEI.Text, "");
  62. OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
  63. }
  64. else
  65. {
  66. OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
  67. }
  68. }
  69. else
  70. {
  71. OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
  72. }
  73. }
  74. }
  75. }
  76. }