Special_CancelImei.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 si_sn,si_imei1 from sninfo where si_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_imei1='" + Reason.Text + "' where ms_imei1='" + IMEI.Text + "'", "update");
  40. dh.ExecuteSql("update sninfo set ms_imei1='' where sn_imei1='" + IMEI.Text + "'", "update");
  41. LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, "");
  42. OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
  43. }
  44. }
  45. else
  46. {
  47. dt = (DataTable)dh.ExecuteSql("select si_sn,si_imei2 from sninfo where si_imei2 ='" + IMEI.Text + "'", "select");
  48. if (dt.Rows.Count > 0)
  49. {
  50. 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");
  51. if (dt.Rows.Count > 0)
  52. {
  53. string sn = dt.Rows[0]["ms_sncode"].ToString();
  54. string pr_detail = dt.Rows[0]["pr_detail"].ToString();
  55. dh.ExecuteSql("update makeserial set ms_imei2=='" + Reason.Text + "' where ms_imei2='" + IMEI.Text + "'", "update");
  56. dh.ExecuteSql("update sninfo set si_imei2='' where sn_imei2='" + IMEI.Text + "'", "update");
  57. LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, "");
  58. LogicHandler.DoCommandLog("CancelImei", User.UserCode, "", User.UserLineCode, User.UserSourceCode, Reason.Text, "取消成功", IMEI.Text, "");
  59. OperateResult.AppendText("SN:" + sn + ",IMEI:" + IMEI.Text + ",机型:" + pr_detail + "取消成功\n", System.Drawing.Color.Black);
  60. }
  61. }
  62. else
  63. {
  64. OperateResult.AppendText(IMEI.Text + "未录入系统\n", System.Drawing.Color.Black);
  65. }
  66. }
  67. }
  68. }
  69. }