Make_WirelessTest.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using DevExpress.Printing.Core.PdfExport.Metafile;
  2. using NPOI.SS.Formula.Eval;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Configuration.Assemblies;
  8. using System.Data;
  9. using System.Diagnostics;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using System.Xml;
  16. using UAS_MES_NEW.DataOperate;
  17. using UAS_MES_NEW.Entity;
  18. using UAS_MES_NEW.PublicMethod;
  19. namespace UAS_MES_NEW.Make
  20. {
  21. public partial class Make_WirelessTest : Form
  22. {
  23. StringBuilder sql = new StringBuilder();
  24. DataHelper dh = new DataHelper();
  25. DataTable dt = new DataTable();
  26. string SN,WO = "";
  27. public Make_WirelessTest()
  28. {
  29. InitializeComponent();
  30. try { UAS_MES_NEW.I18n.LanguageManager.Localize(this); } catch { }
  31. }
  32. private void Make_WirelessTest_Load(object sender, EventArgs e)
  33. {
  34. }
  35. private void GetSNCode_KeyDown(object sender, KeyEventArgs e)
  36. {
  37. if (e.KeyCode == Keys.Enter)
  38. {
  39. if (GetSNCode.Text == "")
  40. {
  41. ShowMsg(0, "序列号不允许为空");
  42. ClearSnDetail();
  43. return;
  44. }
  45. string oStatus, ErrorMessage = "";
  46. if (LogicHandler.GetMakeInfo(GetSNCode.Text.Trim(), out WO, out oStatus, out ErrorMessage))
  47. {
  48. sql.Clear();
  49. sql.Append($@"SELECT ms_sncode,ma_code,ms_prodcode,pr_detail
  50. FROM makeserial,make,product WHERE ms_sncode = '{GetSNCode.Text.Trim()}'
  51. AND ms_makecode = ma_code AND ma_prodcode = pr_code");
  52. dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
  53. if (dt.Rows.Count > 0)
  54. {
  55. SetSnDetail(dt);
  56. }
  57. }
  58. else
  59. {
  60. ShowMsg(0, "序列号不存在");
  61. ClearSnDetail();
  62. return;
  63. }
  64. SN = GetSNCode.Text.Trim();
  65. GetSNCode.Focus();
  66. GetSNCode.SelectAll();
  67. }
  68. }
  69. private void Clean_Click(object sender, EventArgs e)
  70. {
  71. OperatResult.Clear();
  72. }
  73. private void SetSnDetail(DataTable dt)
  74. {
  75. snVal.Text = dt.Rows[0]["ms_sncode"].ToString();
  76. woVal.Text = dt.Rows[0]["ma_code"].ToString();
  77. prodVal.Text = dt.Rows[0]["ms_prodcode"].ToString();
  78. prodNameVal.Text = dt.Rows[0]["pr_detail"].ToString();
  79. }
  80. private void ClearSnDetail()
  81. {
  82. snVal.Text = "";
  83. woVal.Text = "";
  84. prodVal.Text = "";
  85. prodNameVal.Text = "";
  86. }
  87. private void OK_Click(object sender, EventArgs e)
  88. {
  89. PassStation("OK");
  90. }
  91. private void NG_Click(object sender, EventArgs e)
  92. {
  93. PassStation("NG");
  94. }
  95. private void PassStation(string testResult)
  96. {
  97. if (GetSNCode.Text.Trim() == "" || string.IsNullOrEmpty(SN))
  98. {
  99. ShowMsg(0, "序列号不允许为空,请Enter");
  100. ClearSnDetail();
  101. return;
  102. }
  103. string omakeCode, oMsid, oErrorMessage;
  104. if (LogicHandler.CheckStepSNAndMacode(WO, User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
  105. {
  106. if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, SN, "无线吞吐量测试", testResult, User.UserCode, out oErrorMessage))
  107. {
  108. LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, WO, User.UserLineCode, User.UserSourceCode, "无线吞吐量测试", "", SN, "");
  109. sql.Clear();
  110. sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,
  111. std_rescode,std_date,std_indate,std_class,std_value1,std_stepcode) VALUES
  112. (steptestdetail_seq.NEXTVAL,'{SN}','{WO}',
  113. '{User.UserSourceCode}',sysdate,sysdate,'无线吞吐量测试','{testResult}', '{User.CurrentStepCode}' )");
  114. dh.ExecuteSql(sql.ToString(), "insert");
  115. ShowMsg(1, $"{SN}: 过站记录成功,结果为{testResult}");
  116. GetSNCode.Text = "";
  117. ClearSnDetail();
  118. }
  119. else
  120. {
  121. ShowMsg(0, $"过站处理记录NG: {oErrorMessage}");
  122. }
  123. }
  124. else
  125. {
  126. ShowMsg(0, $"过站核对NG: {oErrorMessage}");
  127. }
  128. }
  129. private void ShowMsg(int type, string msg)
  130. {
  131. string fullDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  132. if (type == 0)
  133. {
  134. OperatResult.AppendText($"{fullDateTime}: {msg}\n", Color.Red);
  135. }
  136. else if (type == 1)
  137. {
  138. OperatResult.AppendText($"{fullDateTime}: {msg}\n", Color.Black);
  139. }
  140. }
  141. }
  142. }