Form1.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Runtime.InteropServices;
  8. using System.Text;
  9. using System.Text.RegularExpressions;
  10. using System.Windows.Forms;
  11. using System.Windows.Forms.DataVisualization.Charting;
  12. using UAS_MES.CustomControl.DataGrid_View;
  13. using UAS_MES.DataOperate;
  14. using UAS_MES.PublicForm;
  15. using UAS_MES.PublicMethod;
  16. namespace UAS_MES
  17. {
  18. public partial class Form1 : Form
  19. {
  20. DataHelper dh;
  21. DataTable dt;
  22. LogStringBuilder sql = new LogStringBuilder();
  23. //经过的步骤
  24. string PastStep = "";
  25. //拆分后的经过的步骤
  26. Dictionary<int, string> Step;
  27. //屏幕高度
  28. int ScreenWidth;
  29. //屏幕宽度
  30. int ScreenHeight;
  31. public Form1()
  32. {
  33. InitializeComponent();
  34. }
  35. [DllImport("kernel32.dll")]
  36. public static extern bool d(int freq, int duration);
  37. private void button3_Click(object sender, EventArgs e)
  38. {
  39. d(800, 600);
  40. }
  41. private void Form1_Load(object sender, EventArgs e)
  42. {
  43. DataGridViewCheckBoxColumn checkboxCol = new DataGridViewCheckBoxColumn();
  44. checkboxCol.Name = "全选";
  45. //创建复选框列头单元格
  46. DataGridViewCheckBoxHeaderCell ch = new DataGridViewCheckBoxHeaderCell(TestDGV, checkboxCol);
  47. //设置复选框那列的单元格为复选框
  48. checkboxCol.HeaderCell = ch;
  49. this.TestDGV.Columns.Add(checkboxCol);
  50. blurSearch1.TableName = "Make";
  51. blurSearch1.Field = "ma_code";
  52. DataHelper dh = new DataHelper();
  53. DataTable _dt = (DataTable)dh.ExecuteSql("select count(ms_code) as ms_code_sum,(to_char (ms_indate,'yyyy-mm-dd')) ms_date from MAKESERIAL GROUP BY (to_char (ms_indate,'yyyy-mm-dd')) order by (to_char (ms_indate,'yyyy-mm-dd')) asc", "select");
  54. BaseUtil.ViewChart(chart1, _dt,SeriesChartType.Line, "datetitle", "ms_date", "ms_code_sum","生产日期","生产数");
  55. dt = (DataTable)dh.ExecuteSql("select ma_salecode,MA_STATUS from make where MA_SALECODE = 'TB17040014'", "select");
  56. Step = new Dictionary<int, string>();
  57. for (int i = 0; i < dt.Rows.Count + 2; i++)
  58. {
  59. if (i == 0)
  60. {
  61. Step.Add(i, "开始");
  62. }
  63. else if (i == dt.Rows.Count + 1)
  64. {
  65. Step.Add(i, "结束");
  66. }
  67. else {
  68. Step.Add(i, dt.Rows[i - 1]["MA_STATUS"].ToString());
  69. }
  70. }
  71. }
  72. private void normalButton2_Click(object sender, EventArgs e)
  73. {
  74. DataHelper dh = new DataHelper();
  75. string ErrorMessage = "";
  76. string makecode = "";
  77. string IMEI1 = "";
  78. string IMEI2 = "";
  79. string IMEI3 = "";
  80. string IMEID = "";
  81. string NetCode = "";
  82. string PSN = "";
  83. string MAC = "";
  84. string BT = "";
  85. string Code1 = "";
  86. string Code2 = "";
  87. string Code3 = "";
  88. string ID1 = "";
  89. string ID2 = "";
  90. string ID3 = "";
  91. LogicHandler.GetSNAllInfo("123133",out IMEI1,out IMEI2,out IMEI3,out IMEID,out NetCode,out PSN,out MAC,out BT,out Code1,out Code2,out Code3,out ID1,out ID2,out ID3,out ErrorMessage);
  92. Console.WriteLine(IMEI1);
  93. Console.WriteLine(IMEI2);
  94. Console.WriteLine(IMEI3);
  95. Console.WriteLine(IMEID);
  96. Console.WriteLine(NetCode);
  97. Console.WriteLine(PSN);
  98. Console.WriteLine(MAC);
  99. Console.WriteLine(BT);
  100. Console.WriteLine(Code1);
  101. Console.WriteLine(Code2);
  102. Console.WriteLine(Code3);
  103. Console.WriteLine(ID1);
  104. Console.WriteLine(ID2);
  105. Console.WriteLine(ID3);
  106. Console.WriteLine(ErrorMessage);
  107. }
  108. private void normalButton3_Click(object sender, EventArgs e)
  109. {
  110. DataHelper dh = new DataHelper();
  111. string ErrorMessage = "";
  112. string makecode = "";
  113. string IMEI1 = "";
  114. string IMEI2 = "";
  115. string IMEI3 = "";
  116. string IMEID = "";
  117. string NetCode = "";
  118. string PSN = "";
  119. string MAC = "";
  120. string BT = "";
  121. string ID1 = "";
  122. string ID2 = "";
  123. string ID3 = "";
  124. LogicHandler.GetIMEIOrNetCodeRange("123133", "MAKED800", "IME1", "NETCODE", out IMEI1, out IMEI2, out IMEI3, out IMEID, out NetCode, out PSN, out ID1, out ID2, out ID3, out ErrorMessage);
  125. Console.WriteLine(IMEI1);
  126. Console.WriteLine(IMEI2);
  127. Console.WriteLine(IMEI3);
  128. Console.WriteLine(IMEID);
  129. Console.WriteLine(NetCode);
  130. Console.WriteLine(PSN);
  131. Console.WriteLine(MAC);
  132. Console.WriteLine(BT);
  133. Console.WriteLine(ID1);
  134. Console.WriteLine(ID2);
  135. Console.WriteLine(ID3);
  136. Console.WriteLine(ErrorMessage);
  137. }
  138. private void normalButton2_Click_1(object sender, EventArgs e)
  139. {
  140. DataHelper dh = new DataHelper();
  141. string ErrorMessage = "";
  142. string makecode = "";
  143. string MAC = "";
  144. string BT = "";
  145. string Code1 = "";
  146. string Code2 = "";
  147. string Code3 = "";
  148. LogicHandler.GetAddressRangeByMakeCode("123133", "MAKED800", out MAC,out BT, out Code1, out Code2, out Code3, out ErrorMessage);
  149. Console.WriteLine(MAC);
  150. Console.WriteLine(BT);
  151. Console.WriteLine(Code1);
  152. Console.WriteLine(Code2);
  153. Console.WriteLine(Code3);
  154. Console.WriteLine(ErrorMessage);
  155. }
  156. private void panel1_Paint(object sender, PaintEventArgs e)
  157. {
  158. int rowspaint = 5;
  159. //画板工具
  160. Graphics g = e.Graphics;
  161. //矩形
  162. Rectangle r = new Rectangle(0,0,40,40);
  163. r.Width = paintpanel.Width / 10;
  164. r.Height = paintpanel.Height / 8;
  165. int x = 40;
  166. int y = paintpanel.Height / 8;
  167. Pen p = new Pen(Color.Green, 15);
  168. p.StartCap = LineCap.Triangle;
  169. p.EndCap = LineCap.ArrowAnchor;
  170. for (int i = 0; i < 2; i++) {
  171. r.Location = new Point(x, y);
  172. g.FillRectangle(Brushes.Green, r);
  173. x += r.Width*2;
  174. }
  175. g.DrawLine(p, x + 10, y+r.Height/2 , x + this.Width / 5, y + r.Height / 2 );
  176. }
  177. private void enterTextBox2_KeyDown(object sender, KeyEventArgs e)
  178. {
  179. if (e.KeyCode == Keys.Enter)
  180. {
  181. valueLabel1.Text = enterTextBox2.Text.ToString();
  182. }
  183. }
  184. private void valueLabel1_TextChanged(object sender, EventArgs e)
  185. {
  186. }
  187. }
  188. }