Special_BoxSplit.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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.Special
  13. {
  14. public partial class Special_BoxSplit : Form
  15. {
  16. DataHelper dh;
  17. LogStringBuilder sql = new LogStringBuilder();
  18. public Special_BoxSplit()
  19. {
  20. InitializeComponent();
  21. }
  22. private void Special_BoxSplit_Load(object sender, EventArgs e)
  23. {
  24. dh = SystemInf.dh;
  25. }
  26. private void Split_Click(object sender, EventArgs e)
  27. {
  28. DataTable dt = (DataTable)dh.ExecuteSql("select mal_mac,mal_bt from makeaddresslist where mal_sncode='" + Pallate.Text + "'", "select");
  29. if (dt.Rows.Count > 0)
  30. {
  31. string mac = dt.Rows[0]["mal_mac"].ToString();
  32. dt = (DataTable)dh.ExecuteSql("select ms_firstsn from makeserial where ms_mac='" + mac + "'", "select");
  33. if (dt.Rows.Count > 0)
  34. {
  35. string firstsn = dt.Rows[0]["ms_firstsn"].ToString();
  36. if (firstsn != Pallate.Text)
  37. {
  38. dh.ExecuteSql("update makeaddresslist set mal_sncode='" + firstsn + "' where mal_sncode='" + Pallate.Text + "'", "update");
  39. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "重新分配MAC", "分配成功", Pallate.Text, "");
  40. }
  41. }
  42. }
  43. else
  44. {
  45. OperatResult.AppendText(Pallate.Text + "未分配MAC\n", Color.Red, Pallate);
  46. }
  47. }
  48. }
  49. }