Process.cs 4.8 KB

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