SourceStepCount.cs 2.5 KB

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