SourceStepCount.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. using System.Data;
  3. using System.Windows.Forms;
  4. using UAS_MES_NEW.DataOperate;
  5. using UAS_MES_NEW.Entity;
  6. namespace UAS_MES_NEW.CustomControl.TextBoxWithIcon
  7. {
  8. public partial class SourceStepCount : UserControl
  9. {
  10. DataHelper dh;
  11. string Source1;
  12. public string Source
  13. {
  14. get
  15. {
  16. return Source1;
  17. }
  18. set
  19. {
  20. Source1 = value;
  21. }
  22. }
  23. string StepCode1;
  24. public string StepCode
  25. {
  26. get
  27. {
  28. return StepCode1;
  29. }
  30. set
  31. {
  32. StepCode1 = value;
  33. }
  34. }
  35. string LineCode1;
  36. public string LineCode
  37. {
  38. get
  39. {
  40. return LineCode1;
  41. }
  42. set
  43. {
  44. LineCode1 = value;
  45. }
  46. }
  47. internal DataHelper Dh
  48. {
  49. get
  50. {
  51. return dh;
  52. }
  53. set
  54. {
  55. dh = value;
  56. }
  57. }
  58. public SourceStepCount()
  59. {
  60. InitializeComponent();
  61. }
  62. private void SourceStepCount_Load(object sender, EventArgs e)
  63. {
  64. //20s刷新一次
  65. CountRefresh.Interval = 20000;
  66. }
  67. public void Start()
  68. {
  69. string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
  70. SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
  71. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  72. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  73. CountRefresh.Start();
  74. }
  75. public void Close()
  76. {
  77. CountRefresh.Stop();
  78. }
  79. private void CountRefresh_Tick(object sender, EventArgs e)
  80. {
  81. string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
  82. SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
  83. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  84. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  85. }
  86. }
  87. }