Process.cs 5.0 KB

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