Process.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Windows.Forms;
  5. using UAS_KanBan.CustomControl;
  6. namespace UAS_KanBan
  7. {
  8. public partial class Process : BaseForm
  9. {
  10. AutoSizeFormClass asc = new AutoSizeFormClass();
  11. DataHelper dh = new DataHelper();
  12. public Process(string LineCode, string WcCode)
  13. {
  14. InitializeComponent();
  15. Line.Text = LineCode;
  16. wccode.Text = WcCode;
  17. int WorkHeight = Screen.PrimaryScreen.Bounds.Width;
  18. if (WorkHeight <= 1024)
  19. {
  20. for (int i = 0; i < this.Controls.Count; i++)
  21. {
  22. if (Controls[i] is Label || Controls[i] is ValueLabel)
  23. {
  24. if (Controls[i].Tag != null && Controls[i].Tag.ToString() == "AutoFont")
  25. Controls[i].Font = new Font("宋体", Controls[i].Font.Size - 15, FontStyle.Bold);
  26. else
  27. Controls[i].Font = new Font("宋体", Controls[i].Font.Size - 8, FontStyle.Bold);
  28. }
  29. }
  30. }
  31. }
  32. private void Process_Load(object sender, EventArgs e)
  33. {
  34. asc.controllInitializeSize(this);
  35. Refresh_Tick(sender, e);
  36. RefreshData.Tick += Refresh_Tick;
  37. RefreshData.Interval = Setting.RefreshRate * 1000;
  38. RefreshData.Start();
  39. WindowState = FormWindowState.Maximized;
  40. }
  41. private void Refresh_Tick(object sender, EventArgs e)
  42. {
  43. try
  44. {
  45. DataTable dt = (DataTable)dh.ExecuteSql("select KBI_LINE_ZTL('" + Line.Text + "','" + wccode.Text + "') from dual", "select");
  46. string Data = dt.Rows[0][0].ToString();
  47. string[] Item = Data.Split(':');
  48. string[] ItemName = new string[Item.Length];
  49. string[] ItemData = new string[Item.Length];
  50. for (int i = 0; i < Item.Length; i++)
  51. {
  52. ItemName[i] = Item[i].Split('|')[0];
  53. ItemData[i] = Item[i].Split('|')[1];
  54. }
  55. for (int i = 0; i < Item.Length; i++)
  56. {
  57. for (int j = 0; j < Controls.Count; j++)
  58. {
  59. if (Controls[j].Name == ItemName[i])
  60. {
  61. Controls[j].Text = ItemData[i];
  62. }
  63. }
  64. }
  65. }
  66. catch (Exception) { }
  67. }
  68. private void Process_SizeChanged(object sender, EventArgs e)
  69. {
  70. asc.controlAutoSize(this);
  71. Line1.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  72. Line2.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  73. Line3.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  74. Title.Location = new Point(Line1.Location.X + (Line2.Location.X - Line1.Location.X - Title.Size.Width) / 2, TopLine.Location.Y + (BottomLine.Location.Y - TopLine.Location.Y - Title.Size.Height) / 2);
  75. Title2.Location = new Point(Title.Location.X, Title2.Location.Y);
  76. WorkShift_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - WorkShift_label.Size.Width) / 2, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2);
  77. LineCode_label.Location = new Point(Line2.Location.X + (Line3.Location.X - Line2.Location.X - LineCode_label.Size.Width) / 2, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2);
  78. Line.Location = new Point(Line.Location.X, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2);
  79. 班次.Location = new Point(班次.Location.X, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2);
  80. Logo.Size = new Size(Line1.Location.X - 20, BottomLine.Location.Y - TopLine.Location.Y - 20);
  81. 机型.Location = new Point(机型_label.Location.X + 机型_label.Width + 15, 机型_label.Location.Y);
  82. 投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 15, 投入_label.Location.Y);
  83. Dash.Location = new Point(投入.Location.X + 投入.Size.Width, 投入_label.Location.Y);
  84. 产出.Location = new Point(Dash.Location.X + Dash.Size.Width, 投入_label.Location.Y);
  85. 一次通过.Location = new Point(产出_label.Location.X + 机型_label.Width + 15, 产出_label.Location.Y);
  86. 直通率.Location = new Point(直通率_label.Location.X + 直通率_label.Width + 5, 直通率_label.Location.Y);
  87. 收益率.Location = new Point(收益率_label.Location.X + 收益率_label.Width + 5, 收益率_label.Location.Y);
  88. 故障数.Location = new Point(故障数_label.Location.X + 故障数_label.Width + 5, 故障数_label.Location.Y);
  89. 机型.MaximumSize = new Size(直通率_label.Location.X - 机型_label.Location.X - 机型_label.Width - 15, 0);
  90. }
  91. private void Process_FormClosing(object sender, FormClosingEventArgs e)
  92. {
  93. RefreshData.Stop();
  94. }
  95. private void Process_KeyDown(object sender, KeyEventArgs e)
  96. {
  97. if (e.KeyCode == Keys.Escape)
  98. {
  99. Close();
  100. }
  101. }
  102. private void 投入_SizeChanged(object sender, EventArgs e)
  103. {
  104. 投入.Location = new Point(投入_label.Location.X + 机型_label.Width + 15, 投入_label.Location.Y);
  105. Dash.Location = new Point(投入.Location.X + 投入.Size.Width, 投入_label.Location.Y);
  106. 产出.Location = new Point(Dash.Location.X + Dash.Size.Width, 投入_label.Location.Y);
  107. }
  108. }
  109. }