SourceStepCount.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 SourceStepCount : 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 SourceStepCount()
  64. {
  65. InitializeComponent();
  66. try { UAS_MES_NEW.I18n.LanguageManager.Localize(this); } catch { }
  67. }
  68. private void SourceStepCount_Load(object sender, EventArgs e)
  69. {
  70. //五分钟刷新一次
  71. CountRefresh.Interval = 60000;
  72. }
  73. public void Start()
  74. {
  75. string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
  76. SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
  77. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  78. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  79. CountRefresh.Start();
  80. }
  81. public void Close()
  82. {
  83. CountRefresh.Stop();
  84. }
  85. private void CountRefresh_Tick(object sender, EventArgs e)
  86. {
  87. string SQL = "select count(distinct mp_sncode) from makeprocess where mp_indate>trunc(sysdate) and ";
  88. SQL += "mp_sourcecode='" + Source1 + "' and mp_linecode='" + LineCode1 + "' and mp_stepcode='" + StepCode1 + "' and mp_inman='" + User.UserCode + "' ";
  89. DataTable dt = (DataTable)Dh.ExecuteSql(SQL, "select");
  90. Count.Text = "计数:" + dt.Rows[0][0].ToString();
  91. }
  92. }
  93. }