Form1.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Runtime.InteropServices;
  7. using System.Security.Cryptography.X509Certificates;
  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. public Form1()
  21. {
  22. InitializeComponent();
  23. }
  24. [DllImport("kernel32.dll")]
  25. public static extern bool d(int freq, int duration);
  26. private void button3_Click(object sender, EventArgs e)
  27. {
  28. d(800, 600);
  29. }
  30. private void Form1_Load(object sender, EventArgs e)
  31. {
  32. DataGridViewCheckBoxColumn checkboxCol = new DataGridViewCheckBoxColumn();
  33. checkboxCol.Name = "全选";
  34. //创建复选框列头单元格
  35. DataGridViewCheckBoxHeaderCell ch = new DataGridViewCheckBoxHeaderCell(TestDGV, checkboxCol);
  36. //设置复选框那列的单元格为复选框
  37. checkboxCol.HeaderCell = ch;
  38. this.TestDGV.Columns.Add(checkboxCol);
  39. blurSearch1.TableName = "Make";
  40. blurSearch1.Field = "ma_code";
  41. DataHelper dh = new DataHelper();
  42. 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");
  43. }
  44. private void ViewChart(DataTable _dt, string _title)
  45. {
  46. List<string> xData = new List<string>();
  47. List<int> yData = new List<int>();
  48. for (int i = 0; i < _dt.Rows.Count; i++)
  49. {
  50. xData.Add(_dt.Rows[i]["ms_nextstepcode"].ToString());
  51. yData.Add(int.Parse(_dt.Rows[i]["count(*)"].ToString()));
  52. }
  53. ct_coll.Series[0]["PieLineColor"] = "Red";//绘制黑色的连线。
  54. this.ct_coll.Series[0].ToolTip = "#VAL{D}件";//鼠标移动到上面显示的文字
  55. this.ct_coll.Series[0].BackSecondaryColor = Color.DarkCyan;
  56. this.ct_coll.Series[0].BorderColor = Color.DarkOliveGreen;
  57. this.ct_coll.Series[0].LabelBackColor = Color.Transparent;
  58. ct_coll.ChartAreas[0].Area3DStyle.Enable3D = true;
  59. ct_coll.Series[0].Points.DataBindXY(xData, yData);
  60. }
  61. private void normalButton2_Click(object sender, EventArgs e)
  62. {
  63. //DataHelper dh = new DataHelper();
  64. //string[] TestData = new string[3] {"Test","1321","213" };
  65. //dh.CallProcedure("TestPro",ref TestData);
  66. //for (int i = 0; i < TestData.Length; i++)
  67. //{
  68. // Console.WriteLine(TestData[i]);
  69. //}
  70. enterTextBox2.Text = "13132";
  71. }
  72. private void normalButton3_Click(object sender, EventArgs e)
  73. {
  74. DataHelper dh = new DataHelper();
  75. DataTable dt=(DataTable) dh.ExecuteSql("select sn_id,sn_caller from cs$sysnavation","select");
  76. string[] dd = new string[dt.Rows.Count];
  77. string[] dd1 = new string[dd.Length];
  78. for (int i = 0; i < dd.Length; i++)
  79. {
  80. string data = dt.Rows[i]["sn_caller"].ToString();
  81. string module = data.Split('!')[0];
  82. dd[i] = module+"."+ data.Replace("!","_");
  83. dd1[i] = dt.Rows[i]["sn_id"].ToString();
  84. }
  85. dh.BatchInsert("update cs$sysnavation set sn_classname=:dd where sn_id=:dd1",new string[] { "dd", "dd1"},dd,dd1);
  86. }
  87. }
  88. }