/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_1901.cs * 2.功能描述:注浆次数查询 * 编辑履历: * 作者 日期 版本 修改内容 * 庄天威 2014/09/17 1.00 新建 *******************************************************************************/ using System; using System.Collections.Generic; using System.Data; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Basics.DockPanel; using Dongke.IBOSS.PRD.WCF.Proxys; using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.WCF.DataModels; namespace Dongke.IBOSS.PRD.Client.PMModule { public partial class F_PM_1901 : DockPanelBase { #region 成员变量 //单例模式 private static F_PM_1901 _instance; //查询用条件实体 private GroutingCountByUserEntity _gcEntity = new GroutingCountByUserEntity(); #endregion #region 构造函数 public F_PM_1901() { InitializeComponent(); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_1901 Instance { get { if (_instance == null) { _instance = new F_PM_1901(); } return _instance; } } #endregion #region 事件 private void F_PM_1901_Load(object sender, EventArgs e) { } private void btnSearch_Click(object sender, EventArgs e) { try { DataSet dsCount = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() => { return this.GetGroutingCount(); })); if (dsCount != null) { if (dsCount.Tables.Count != Constant.INT_IS_ZERO) { this.dgvGroutingDaily.DataSource = ((DataSet)dsCount).Tables[Constant.INT_IS_ZERO]; this.dgvGroutingDaily.ReadOnly = true; if (this.dgvGroutingDaily.Rows.Count == Constant.INT_IS_ZERO) { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } private void btnClearCondition_Click(object sender, EventArgs e) { this.txtGroutingLineCode.Text = string.Empty; this.txtGoodsCode.Text = string.Empty; this.txtUserCode.Text = string.Empty; this.scbGoodsType.ClearValue(); } private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } private void F_PM_1901_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 /// /// 根据界面查询条件获取数据集 /// private DataSet GetGroutingCount() { try { this.dgvGroutingDaily.AutoGenerateColumns = false; GroutingCountByUserEntity gcEntity = new GroutingCountByUserEntity(); gcEntity.GroutingDateS = Convert.ToDateTime(this.txtGroutingDateStart.Text); gcEntity.GroutingDateE = Convert.ToDateTime(this.txtGroutingDateEnd.Text) .AddHours(23).AddMinutes(59).AddSeconds(59); gcEntity.GroutingLineCode = this.txtGroutingLineCode.Text.Trim(); gcEntity.GoodsCode = this.txtGoodsCode.Text.Trim(); gcEntity.UserCode = this.txtUserCode.Text.Trim(); gcEntity.GoodsTypeCode = scbGoodsType.SearchedValue + ""; return PMModuleProxy.Service.GetGroutingCountByUser(gcEntity); } catch (Exception ex) { throw ex; } } #endregion } }