Form1.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using UMES.DLLService;
  11. namespace TestProject
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. private void Form1_Load(object sender, EventArgs e)
  20. {
  21. DataHelper dh = new DataHelper();
  22. MESHelper mes = new MESHelper();
  23. string Err = "";
  24. string Json = "";
  25. mes.GetMobileAllInfo("FG09P1M1C840000014", out Json, out Err);
  26. mes.GetMobileAllInfo("FG01P1M2C7R0000132", out Json, out Err);
  27. mes.GetMobileAllInfo("FG01P1M2C7R0000160", out Json, out Err);
  28. mes.GetMobileAllInfo("FG01P1M2C7R0000182", out Json, out Err);
  29. mes.GetMobileAllInfo("FG01P1M2C7R0000198", out Json, out Err);
  30. //if (mes.CheckRoutePassed("92101BD6QD60099823B4", "ZZ_A_MT1", out Err))
  31. //{
  32. // if (mes.SetStepFinish("PING-2021080001", "ZZ_A_MT1", "92101BD6QD60099823B4", "OK", "NG", "ZZ_A_MT1", "1000", out Err))
  33. // {
  34. // }
  35. // else
  36. // {
  37. // Console.WriteLine(Err);
  38. // }
  39. //}
  40. //else {
  41. // Console.WriteLine(Err);
  42. //}
  43. //string Err = "";
  44. //string json = "";
  45. ////exec(@"C:\Windows\System32\cmd.exe", " wmic os get SerialNumber /value");
  46. //List<string> add = new List<string>();
  47. //DataTable dt = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_makecode='MSQ21070033' and ms_mac is null", "select");
  48. //for (int i = 0; i < dt.Rows.Count; i++)
  49. //{
  50. // string mac = "";
  51. // string bt = "";
  52. // string code1 = "";
  53. // string code2 = "";
  54. // string code3 = "";
  55. // if (mes.GetAddressRangeByMO(dt.Rows[i]["ms_sncode"].ToString(), out mac,out bt,out code1,out code2,out code3, out Err))
  56. // {
  57. // Console.WriteLine(mac);
  58. // Console.WriteLine(bt);
  59. // Console.WriteLine(code1);
  60. // Console.WriteLine(code2);
  61. // Console.WriteLine(code3);
  62. // }
  63. // else
  64. // {
  65. // Console.WriteLine(Err);
  66. // }
  67. //}
  68. }
  69. public void exec(string exePath, string parameters)
  70. {
  71. Process process = new Process();
  72. process.StartInfo.FileName = "cmd.exe";
  73. process.StartInfo.UseShellExecute = false;
  74. process.StartInfo.RedirectStandardInput = true;
  75. process.StartInfo.RedirectStandardOutput = true;
  76. process.StartInfo.CreateNoWindow = true;
  77. process.StartInfo.RedirectStandardError = true;//重定向标准错误输出
  78. process.Start();
  79. process.StandardInput.WriteLine(" wmic os get SerialNumber /value"); //打开到rtt目录
  80. process.StandardInput.WriteLine(" wmic bios get SMBIOSBIOSVersion / value"); //打开到rtt目录
  81. process.StandardInput.Close(); //运行完毕关闭控制台输入
  82. string add = process.StandardOutput.ReadToEnd(); //读取输出的信息
  83. Console.WriteLine(add);
  84. process.Close();
  85. }
  86. }
  87. }