SourceStepCountPre.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using UAS_MES_NEW.DataOperate;
  10. using UAS_MES_NEW.Entity;
  11. namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
  12. {
  13. public partial class SourceStepCountPre : UserControl
  14. {
  15. DataHelper dh;
  16. string Source1;
  17. public string Source
  18. {
  19. get
  20. {
  21. return Source1;
  22. }
  23. set
  24. {
  25. Source1 = value;
  26. }
  27. }
  28. string StepCode1;
  29. public string StepCode
  30. {
  31. get
  32. {
  33. return StepCode1;
  34. }
  35. set
  36. {
  37. StepCode1 = value;
  38. }
  39. }
  40. string LineCode1;
  41. public string LineCode
  42. {
  43. get
  44. {
  45. return LineCode1;
  46. }
  47. set
  48. {
  49. LineCode1 = value;
  50. }
  51. }
  52. internal DataHelper Dh
  53. {
  54. get
  55. {
  56. return dh;
  57. }
  58. set
  59. {
  60. dh = value;
  61. }
  62. }
  63. public string Tag1
  64. {
  65. get
  66. {
  67. return tag;
  68. }
  69. set
  70. {
  71. tag = value;
  72. }
  73. }
  74. string tag;
  75. public SourceStepCountPre()
  76. {
  77. InitializeComponent();
  78. }
  79. private void SourceStepCount_Load(object sender, EventArgs e)
  80. {
  81. //五分钟刷新一次
  82. CountRefresh.Interval = 60000;
  83. }
  84. public void Start()
  85. {
  86. string SQL = "select count(1) from commandlog where cl_caller='" + tag + "' and cl_date>trunc(sysdate) and cl_linecode='" + User.UserLineCode + "'";
  87. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  88. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  89. CountRefresh.Start();
  90. }
  91. public void Close()
  92. {
  93. CountRefresh.Stop();
  94. }
  95. private void CountRefresh_Tick(object sender, EventArgs e)
  96. {
  97. string SQL = "select count(1) from commandlog where cl_caller='" + tag + "' and cl_date>trunc(sysdate) and cl_linecode='" + User.UserLineCode + "'";
  98. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  99. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  100. }
  101. }
  102. }