Form_Other.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using MathNet.Numerics.RootFinding;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. using static MainForm.ClassFile.XiaomiAPI_MES.XiaomiMESHttp_StationOutbound;
  14. namespace MainForm.FaForm
  15. {
  16. public partial class Form_Other : Form
  17. {
  18. public Form_Other()
  19. {
  20. InitializeComponent();
  21. }
  22. private void button7_Click(object sender, EventArgs e)
  23. {
  24. ProcessData processData = new ProcessData
  25. {
  26. Workorder_code = GlobalContext.WorkOrderCode,
  27. //Batch_number = GlobalContext.BatchNumber,
  28. Equipment_code = GlobalContext.LineCode + "-S15",
  29. Test_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
  30. };
  31. textBox1.Text = SQLHelper.ExecuteNonQuery(processData.ToStringInsert(0,0));
  32. }
  33. private void button8_Click(object sender, EventArgs e)
  34. {
  35. OneCheckData oneCheckData = new OneCheckData();
  36. string sql = oneCheckData.ToStringInsert(0);
  37. textBox1.Text = SQLHelper.ExecuteNonQuery(sql);
  38. }
  39. private void button5_Click(object sender, EventArgs e)
  40. {
  41. string url = @"http://10.1.19.33:9090/api/ProductionLine/GetWorkOrderInfo";
  42. string ret = string.Empty;
  43. WorkOrderInfo responseData = HttpUitls.GetWOData(textBox1.Text.Trim());
  44. textBox1.Text = JsonConvert.SerializeObject(responseData);
  45. }
  46. private void button4_Click(object sender, EventArgs e)
  47. {
  48. List<TestItem> items = new List<TestItem>();
  49. items.Add(new TestItem { Parameter_name = "1", Parameter_unit = "1", Parameter_value = "1" });
  50. items.Add(new TestItem { Parameter_name = "2", Parameter_unit = "2", Parameter_value = "2" });
  51. List<ProcessData> data = new List<ProcessData>();
  52. ProcessData processData = new ProcessData()
  53. {
  54. Equipment_code = "Equipment_code",
  55. Workorder_code = GlobalContext.WorkOrderCode,
  56. //Batch_number = GlobalContext.BatchNumber,
  57. Sn = "",
  58. Testitem = "Testitem",
  59. Parameter_values = items,
  60. Write_user = GlobalContext.CurrentUser,
  61. Test_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")
  62. };
  63. //上传mes
  64. data.Add(processData);
  65. string jsonstr = JsonConvert.SerializeObject(data);
  66. if (GlobalContext.IsSendProcessData)
  67. {
  68. string url = @"HTTP://" + GlobalContext.ServerHost + @"/api/ProductionLine/ProcessData";
  69. string mesRet = HttpUitls.SubmitDataToMES(url, jsonstr); // HttpUitls.Post(url, jsonstr);
  70. }
  71. //本地数据
  72. string ret = SQLHelper.ExecuteNonQuery(processData.ToStringInsert(0, 0));
  73. }
  74. private void button6_Click(object sender, EventArgs e)
  75. {
  76. textBox1.Text = string.Empty;
  77. }
  78. private void button1_Click(object sender, EventArgs e)
  79. {
  80. WorkingData workingData = new WorkingData()
  81. {
  82. Equipment_code = GlobalContext.LineCode + "-Test",
  83. Update_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  84. };
  85. string date = DateTime.Now.ToString("yyyy-MM-dd");
  86. textBox1.Text = SQLHelper.ExecuteNonQuery(workingData.ToStringInsert(date));
  87. }
  88. private void button3_Click(object sender, EventArgs e)
  89. {
  90. LineWorkingData_ThisTime lineWorkingData = new LineWorkingData_ThisTime()
  91. {
  92. LineName = GlobalContext.LineCode + "-Test",
  93. CreateTime = DateTime.Now
  94. };
  95. textBox1.Text = SQLHelper.ExecuteNonQuery(lineWorkingData.ToStringInsert());
  96. }
  97. private void button9_Click(object sender, EventArgs e)
  98. {
  99. WorkingData workingData = new WorkingData()
  100. {
  101. Equipment_code = GlobalContext.LineCode + "-Test",
  102. Update_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  103. };
  104. string date = DateTime.Now.ToString("yyyy-MM-dd");
  105. textBox1.Text = SQLHelper.ExecuteNonQuery(workingData.ToStringUpdate(date));
  106. }
  107. private void button10_Click(object sender, EventArgs e)
  108. {
  109. //LineWorkingData_ThisTime lineWorkingData = new LineWorkingData_ThisTime()
  110. //{
  111. // LineName = GlobalContext.LineCode + "-Test",
  112. // CreateTime = DateTime.Now
  113. //};
  114. //string guid = DateTime.Now.ToString("yyyy-MM-dd");
  115. //textBox1.Text = SQLHelper.ExecuteNonQuery(lineWorkingData.ToStringUpdate(guid));
  116. }
  117. private void button11_Click(object sender, EventArgs e)
  118. {
  119. WorkingData workingData = new WorkingData()
  120. {
  121. Equipment_code = GlobalContext.LineCode + "-Test",
  122. Update_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  123. };
  124. string date = DateTime.Now.ToString("yyyy-MM-dd");
  125. textBox1.Text = SQLHelper.GetDataTable(workingData.ToStringQuery(date)).ToString();
  126. }
  127. private void button12_Click(object sender, EventArgs e)
  128. {
  129. LineWorkingData_ThisTime lineWorkingData = new LineWorkingData_ThisTime()
  130. {
  131. LineName = GlobalContext.LineCode + "-Test",
  132. CreateTime = DateTime.Now
  133. };
  134. string date = DateTime.Now.ToString("yyyy-MM-dd");
  135. textBox1.Text = SQLHelper.GetDataTable(lineWorkingData.ToStringQuery()).ToString();
  136. }
  137. private void button2_Click(object sender, EventArgs e)
  138. {
  139. AlarmData alarmData = new AlarmData()
  140. {
  141. LineName = GlobalContext.LineCode + "-Test",
  142. StartTime = DateTime.Now
  143. };
  144. //string sql = alarmData.ToStringInsert(0);
  145. //textBox1.Text = SQLHelper.ExecuteNonQuery(alarmData.ToStringInsert(0)).ToString();
  146. string sql = alarmData.ToStringInsert();
  147. textBox1.Text = SQLHelper.ExecuteNonQuery(alarmData.ToStringInsert()).ToString();
  148. }
  149. private void button13_Click(object sender, EventArgs e)
  150. {
  151. XmMES_StationOutRequest_Body outRequest_Body = new XmMES_StationOutRequest_Body();
  152. Form_Home home = new Form_Home();
  153. string path=GlobalContext.MESLaserLPath;
  154. outRequest_Body.unitData.processData.Add(
  155. new XmMES_StationOutRequest_Body.XmStationOut_ProcessData()
  156. {
  157. dataName = "fMesHeightInfos",
  158. dataValue = home.GetLastLineCompensation(path)
  159. });
  160. }
  161. }
  162. }