Process.cs 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. AutoSizeFormClass asc = new AutoSizeFormClass();
  15. DataHelper dh = new DataHelper();
  16. string Linecode;
  17. string Wccode;
  18. public Process(string LineCode, string WcCode)
  19. {
  20. InitializeComponent();
  21. Linecode = LineCode;
  22. Wccode = WcCode;
  23. Line.Text = LineCode;
  24. 班制.Text = WcCode;
  25. }
  26. private void Process_Load(object sender, EventArgs e)
  27. {
  28. asc.controllInitializeSize(this);
  29. Refresh_Tick(sender, e);
  30. Refresh.Tick += Refresh_Tick;
  31. Refresh.Interval = Setting.RefreshRate * 1000;
  32. Refresh.Start();
  33. WindowState = FormWindowState.Maximized;
  34. }
  35. private void Refresh_Tick(object sender, EventArgs e)
  36. {
  37. DataTable dt = (DataTable)dh.ExecuteSql("select KBI_LINE_ZTL('" + Linecode + "','" + Wccode + "') from dual", "select");
  38. string Data = dt.Rows[0][0].ToString();
  39. string[] Item = Data.Split(':');
  40. string[] ItemName = new string[Item.Length];
  41. string[] ItemData = new string[Item.Length];
  42. for (int i = 0; i < Item.Length; i++)
  43. {
  44. ItemName[i] = Item[i].Split('|')[0];
  45. ItemData[i] = Item[i].Split('|')[1];
  46. }
  47. for (int i = 0; i < Item.Length; i++)
  48. {
  49. for (int j = 0; j < Controls.Count; j++)
  50. {
  51. if (Controls[j].Name == ItemName[i])
  52. {
  53. Controls[j].Text = ItemData[i];
  54. }
  55. }
  56. }
  57. }
  58. private void Process_SizeChanged(object sender, EventArgs e)
  59. {
  60. asc.controlAutoSize(this);
  61. Line1.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  62. Line2.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  63. Line3.Size = new Size(2, BottomLine.Location.Y - TopLine.Location.Y);
  64. 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);
  65. Title2.Location = new Point(Title.Location.X, Title2.Location.Y);
  66. Logo.Size = new Size(Line1.Location.X - 20, BottomLine.Location.Y - TopLine.Location.Y - 20);
  67. 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);
  68. 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);
  69. Line.Location = new Point(Line.Location.X, TopLine.Location.Y + (MidLine.Location.Y - TopLine.Location.Y - LineCode_label.Size.Height) / 2);
  70. 班制.Location = new Point(班制.Location.X, MidLine.Location.Y + (BottomLine.Location.Y - MidLine.Location.Y - WorkShift_label.Size.Height) / 2);
  71. }
  72. private void Process_FormClosing(object sender, FormClosingEventArgs e)
  73. {
  74. Refresh.Stop();
  75. }
  76. private void Process_KeyDown(object sender, KeyEventArgs e)
  77. {
  78. if (e.KeyCode == Keys.Escape)
  79. {
  80. Hide();
  81. Setting set = new Setting();
  82. set.ShowDialog();
  83. Close();
  84. }
  85. }
  86. }
  87. }