/******************************************************************************* * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_P_000021.cs * 2.功能描述:成型结算信息表-查询条件(成型工号) * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2017/01/11 1.00 新建 *******************************************************************************/ using System; using System.Windows.Forms; using Dongke.IBOSS.PRD.Client.Controls; namespace Dongke.IBOSS.PRD.Client.Public { /// /// 成型结算信息表-查询条件(成型工号) /// public partial class F_P_000021 : DKFormBase { private const string TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; private DateTime? _nonShowErrorTime = null; public string UserCode { get; set; } public DateTime DateStart { get { return dtpDateStart.Value; } } public DateTime DateMonth { get { return dtpMonth.Value; } } public string ErrorMessges { get { return this.lblErrorMessges.Text; } set { this.lblErrorMessges.Text = value; } } public F_P_000021() { InitializeComponent(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.lblErrorMessges.Text = null; //#if DEBUG // this.lblAccountDateStart.Visible = true; // this.dtpDateStart.Visible = true; // this.btnSearch.Visible = true; // this.label1.Visible = true; //#else this.lblAccountDateStart.Visible = false; this.dtpDateStart.Visible = false; this.btnSearch.Visible = false; this.label1.Visible = false; //#endif } private void F_P_000021_Shown(object sender, System.EventArgs e) { this.timer1.Start(); this.txtUserCode.Focus(); DateTime date = DateTime.Now.Date; //this.dtpDateStart.Value = date; DateTime month = new DateTime(date.Year, date.Month, 1); this.dtpMonth.Value = month; this.dtpMonth.MaxDate = month; this.dtpMonth.MinDate = month.AddMonths(-1); this.hScrollBar1.Value = 1; if (string.IsNullOrEmpty(this.lblErrorMessges.Text)) { _nonShowErrorTime = null; } else { _nonShowErrorTime = DateTime.Now.AddSeconds(10); } } private void F_P_000021_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) { this.timer1.Stop(); } private void timer1_Tick(object sender, System.EventArgs e) { this.lblDataTime.Text = DateTime.Now.ToString(TIME_FORMAT); if (_nonShowErrorTime.HasValue) { if (DateTime.Now > _nonShowErrorTime.Value) { this.lblErrorMessges.Text = null; _nonShowErrorTime = null; } } } private void txtUserCode_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string text = this.txtUserCode.Text.Trim().ToUpper(); if (string.IsNullOrWhiteSpace(text)) { return; } if (text.Length > 3 && text.StartsWith("#") && text.EndsWith("#")) { this.txtUserCode.Clear(); if (F_P_00002.PreMonth == text) { this.hScrollBar1.Value = 0; } else if (F_P_00002.CurMonth == text) { this.hScrollBar1.Value = 1; } } else { this.btnSearch_Click(sender, e); } } else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.PageDown || e.KeyCode == Keys.VolumeDown) { this.hScrollBar1.Value = 0; } else if (e.KeyCode == Keys.Up || e.KeyCode == Keys.PageUp || e.KeyCode == Keys.VolumeUp) { this.hScrollBar1.Value = 1; } } private void btnSearch_Click(object sender, EventArgs e) { this.UserCode = this.txtUserCode.Text.Trim(); if (string.IsNullOrWhiteSpace(this.UserCode)) { return; } this.txtUserCode.Clear(); this.lblErrorMessges.Text = null; _nonShowErrorTime = null; this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } private void hScrollBar1_ValueChanged(object sender, EventArgs e) { if (hScrollBar1.Value == 0) { this.dtpMonth.Value = this.dtpMonth.MinDate; } else { this.dtpMonth.Value = this.dtpMonth.MaxDate; } } } }