Form1.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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. ViewChart((DataTable)dh.ExecuteSql("select nvl(ms_nextstepcode ,'已完工')ms_nextstepcode ,count(*) from makeserial left join makecraftdetail on ms_makecode=mcd_macode and ms_nextstepcode =mcd_nextstepcode where ms_makecode='MB17050022' group by ms_nextstepcode", "select"), "TExt");
  54. dt = (DataTable)dh.ExecuteSql("select ma_salecode,MA_STATUS from make where MA_SALECODE = 'TB17040014'", "select");
  55. Step = new Dictionary<int, string>();
  56. for (int i = 0; i < dt.Rows.Count + 2; i++)
  57. {
  58. if (i == 0)
  59. {
  60. Step.Add(i, "开始");
  61. }
  62. else if (i == dt.Rows.Count + 1)
  63. {
  64. Step.Add(i, "结束");
  65. }
  66. else {
  67. Step.Add(i, dt.Rows[i - 1]["MA_STATUS"].ToString());
  68. }
  69. }
  70. }
  71. private void ViewChart(DataTable _dt, string _title)
  72. {
  73. List<string> xData = new List<string>();
  74. List<int> yData = new List<int>();
  75. for (int i = 0; i < _dt.Rows.Count; i++)
  76. {
  77. xData.Add(_dt.Rows[i]["ms_nextstepcode"].ToString());
  78. yData.Add(int.Parse(_dt.Rows[i]["count(*)"].ToString()));
  79. }
  80. ct_coll.Series[0]["PieLineColor"] = "Red";//绘制黑色的连线。
  81. this.ct_coll.Series[0].ToolTip = "#VAL{D}件";//鼠标移动到上面显示的文字
  82. this.ct_coll.Series[0].BackSecondaryColor = Color.DarkCyan;
  83. this.ct_coll.Series[0].BorderColor = Color.DarkOliveGreen;
  84. this.ct_coll.Series[0].LabelBackColor = Color.Transparent;
  85. ct_coll.ChartAreas[0].Area3DStyle.Enable3D = true;
  86. ct_coll.Series[0].Points.DataBindXY(xData, yData);
  87. }
  88. private void normalButton2_Click(object sender, EventArgs e)
  89. {
  90. DataHelper dh = new DataHelper();
  91. string ErrorMessage = "";
  92. string makecode = "";
  93. string IMEI1 = "";
  94. string IMEI2 = "";
  95. string IMEI3 = "";
  96. string IMEID = "";
  97. string NetCode = "";
  98. string PSN = "";
  99. string MAC = "";
  100. string BT = "";
  101. string Code1 = "";
  102. string Code2 = "";
  103. string Code3 = "";
  104. string ID1 = "";
  105. string ID2 = "";
  106. string ID3 = "";
  107. 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);
  108. Console.WriteLine(IMEI1);
  109. Console.WriteLine(IMEI2);
  110. Console.WriteLine(IMEI3);
  111. Console.WriteLine(IMEID);
  112. Console.WriteLine(NetCode);
  113. Console.WriteLine(PSN);
  114. Console.WriteLine(MAC);
  115. Console.WriteLine(BT);
  116. Console.WriteLine(Code1);
  117. Console.WriteLine(Code2);
  118. Console.WriteLine(Code3);
  119. Console.WriteLine(ID1);
  120. Console.WriteLine(ID2);
  121. Console.WriteLine(ID3);
  122. Console.WriteLine(ErrorMessage);
  123. }
  124. private void normalButton3_Click(object sender, EventArgs e)
  125. {
  126. DataHelper dh = new DataHelper();
  127. string ErrorMessage = "";
  128. string makecode = "";
  129. string IMEI1 = "";
  130. string IMEI2 = "";
  131. string IMEI3 = "";
  132. string IMEID = "";
  133. string NetCode = "";
  134. string PSN = "";
  135. string MAC = "";
  136. string BT = "";
  137. string ID1 = "";
  138. string ID2 = "";
  139. string ID3 = "";
  140. 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);
  141. Console.WriteLine(IMEI1);
  142. Console.WriteLine(IMEI2);
  143. Console.WriteLine(IMEI3);
  144. Console.WriteLine(IMEID);
  145. Console.WriteLine(NetCode);
  146. Console.WriteLine(PSN);
  147. Console.WriteLine(MAC);
  148. Console.WriteLine(BT);
  149. Console.WriteLine(ID1);
  150. Console.WriteLine(ID2);
  151. Console.WriteLine(ID3);
  152. Console.WriteLine(ErrorMessage);
  153. }
  154. private void normalButton2_Click_1(object sender, EventArgs e)
  155. {
  156. DataHelper dh = new DataHelper();
  157. string ErrorMessage = "";
  158. string makecode = "";
  159. string MAC = "";
  160. string BT = "";
  161. string Code1 = "";
  162. string Code2 = "";
  163. string Code3 = "";
  164. LogicHandler.GetAddressRangeByMakeCode("123133", "MAKED800", out MAC,out BT, out Code1, out Code2, out Code3, out ErrorMessage);
  165. Console.WriteLine(MAC);
  166. Console.WriteLine(BT);
  167. Console.WriteLine(Code1);
  168. Console.WriteLine(Code2);
  169. Console.WriteLine(Code3);
  170. Console.WriteLine(ErrorMessage);
  171. }
  172. private void panel1_Paint(object sender, PaintEventArgs e)
  173. {
  174. int rowspaint = 5;
  175. //画板工具
  176. Graphics g = e.Graphics;
  177. //矩形
  178. Rectangle r = new Rectangle(0,0,40,40);
  179. r.Width = paintpanel.Width / 10;
  180. r.Height = paintpanel.Height / 8;
  181. int x = 40;
  182. int y = paintpanel.Height / 8;
  183. Pen p = new Pen(Color.Green, 15);
  184. p.StartCap = LineCap.Triangle;
  185. p.EndCap = LineCap.ArrowAnchor;
  186. for (int i = 0; i < 2; i++) {
  187. r.Location = new Point(x, y);
  188. g.FillRectangle(Brushes.Green, r);
  189. x += r.Width*2;
  190. }
  191. g.DrawLine(p, x + 10, y+r.Height/2 , x + this.Width / 5, y + r.Height / 2 );
  192. }
  193. private void enterTextBox2_KeyDown(object sender, KeyEventArgs e)
  194. {
  195. if (e.KeyCode == Keys.Enter)
  196. {
  197. valueLabel1.Text = enterTextBox2.Text.ToString();
  198. }
  199. }
  200. private void valueLabel1_TextChanged(object sender, EventArgs e)
  201. {
  202. }
  203. }
  204. }