F_P_000021.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_P_000021.cs
  5. * 2.功能描述:成型结算信息表-查询条件(成型工号)
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/01/11 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Client.Controls;
  13. namespace Dongke.IBOSS.PRD.Client.Public
  14. {
  15. /// <summary>
  16. /// 成型结算信息表-查询条件(成型工号)
  17. /// </summary>
  18. public partial class F_P_000021 : DKFormBase
  19. {
  20. private const string TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
  21. private DateTime? _nonShowErrorTime = null;
  22. public string UserCode
  23. {
  24. get;
  25. set;
  26. }
  27. public DateTime DateStart
  28. {
  29. get
  30. {
  31. return dtpDateStart.Value;
  32. }
  33. }
  34. public DateTime DateMonth
  35. {
  36. get
  37. {
  38. return dtpMonth.Value;
  39. }
  40. }
  41. public string ErrorMessges
  42. {
  43. get
  44. {
  45. return this.lblErrorMessges.Text;
  46. }
  47. set
  48. {
  49. this.lblErrorMessges.Text = value;
  50. }
  51. }
  52. public F_P_000021()
  53. {
  54. InitializeComponent();
  55. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  56. this.lblErrorMessges.Text = null;
  57. //#if DEBUG
  58. // this.lblAccountDateStart.Visible = true;
  59. // this.dtpDateStart.Visible = true;
  60. // this.btnSearch.Visible = true;
  61. // this.label1.Visible = true;
  62. //#else
  63. this.lblAccountDateStart.Visible = false;
  64. this.dtpDateStart.Visible = false;
  65. this.btnSearch.Visible = false;
  66. this.label1.Visible = false;
  67. //#endif
  68. }
  69. private void F_P_000021_Shown(object sender, System.EventArgs e)
  70. {
  71. this.timer1.Start();
  72. this.txtUserCode.Focus();
  73. DateTime date = DateTime.Now.Date;
  74. //this.dtpDateStart.Value = date;
  75. DateTime month = new DateTime(date.Year, date.Month, 1);
  76. this.dtpMonth.Value = month;
  77. this.dtpMonth.MaxDate = month;
  78. this.dtpMonth.MinDate = month.AddMonths(-1);
  79. this.hScrollBar1.Value = 1;
  80. if (string.IsNullOrEmpty(this.lblErrorMessges.Text))
  81. {
  82. _nonShowErrorTime = null;
  83. }
  84. else
  85. {
  86. _nonShowErrorTime = DateTime.Now.AddSeconds(10);
  87. }
  88. }
  89. private void F_P_000021_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e)
  90. {
  91. this.timer1.Stop();
  92. }
  93. private void timer1_Tick(object sender, System.EventArgs e)
  94. {
  95. this.lblDataTime.Text = DateTime.Now.ToString(TIME_FORMAT);
  96. if (_nonShowErrorTime.HasValue)
  97. {
  98. if (DateTime.Now > _nonShowErrorTime.Value)
  99. {
  100. this.lblErrorMessges.Text = null;
  101. _nonShowErrorTime = null;
  102. }
  103. }
  104. }
  105. private void txtUserCode_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
  106. {
  107. if (e.KeyCode == Keys.Enter)
  108. {
  109. string text = this.txtUserCode.Text.Trim().ToUpper();
  110. if (string.IsNullOrWhiteSpace(text))
  111. {
  112. return;
  113. }
  114. if (text.Length > 3 && text.StartsWith("#") && text.EndsWith("#"))
  115. {
  116. this.txtUserCode.Clear();
  117. if (F_P_00002.PreMonth == text)
  118. {
  119. this.hScrollBar1.Value = 0;
  120. }
  121. else if (F_P_00002.CurMonth == text)
  122. {
  123. this.hScrollBar1.Value = 1;
  124. }
  125. }
  126. else
  127. {
  128. this.btnSearch_Click(sender, e);
  129. }
  130. }
  131. else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown || e.KeyCode == Keys.VolumeDown)
  132. {
  133. this.hScrollBar1.Value = 0;
  134. }
  135. else if (e.KeyCode == Keys.Up || e.KeyCode == Keys.PageUp || e.KeyCode == Keys.VolumeUp)
  136. {
  137. this.hScrollBar1.Value = 1;
  138. }
  139. }
  140. private void btnSearch_Click(object sender, EventArgs e)
  141. {
  142. this.UserCode = this.txtUserCode.Text.Trim();
  143. if (string.IsNullOrWhiteSpace(this.UserCode))
  144. {
  145. return;
  146. }
  147. this.txtUserCode.Clear();
  148. this.lblErrorMessges.Text = null;
  149. _nonShowErrorTime = null;
  150. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  151. this.Close();
  152. }
  153. private void hScrollBar1_ValueChanged(object sender, EventArgs e)
  154. {
  155. if (hScrollBar1.Value == 0)
  156. {
  157. this.dtpMonth.Value = this.dtpMonth.MinDate;
  158. }
  159. else
  160. {
  161. this.dtpMonth.Value = this.dtpMonth.MaxDate;
  162. }
  163. }
  164. }
  165. }