/******************************************************************************* * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_RPT_040112.cs * 2.功能描述:窑车产量汇总表 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2018/05/28 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.Client.Controls; using Dongke.IBOSS.PRD.Client.DataModels; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.ReportModule { /// /// 窑车产量汇总表 /// public partial class F_RPT_040112 : DKDockPanelBase { #region 成员变量 // 窗体的单例模式 private static F_RPT_040112 _instance; #endregion #region 构造函数 public F_RPT_040112() { InitializeComponent(); // 窗体显示的Title this.Text = "成检产品预算分析表"; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_RPT_040112 Instance { get { if (_instance == null || _instance.IsDisposed) { _instance = new F_RPT_040112(); } return _instance; } } #endregion #region 事件处理 /// /// 窗体加载事件 /// /// /// private void F_RPT_040112_Load(object sender, EventArgs e) { try { // 加载权限 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); // 设置表格不自动创建列 this.dgvKilnCarInfo.AutoGenerateColumns = false; this.dgvKilnCarGoods.AutoGenerateColumns = false; //绑下拉列定 BindPageKiln(); // 初始化时间控件为当前日期 this.dtpInTimeBegin.Value = DateTime.Now.Date; this.dtpInTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddMinutes(-1); this.dtpOutTimeBegin.Value = DateTime.Now.Date.AddDays(1); this.dtpOutTimeEnd.Value = DateTime.Now.Date.AddDays(2).AddMinutes(-1); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭事件 /// /// /// private void F_RPT_040112_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 关闭按钮 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 自动适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvKilnCarInfo.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvKilnCarGoods.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 查询按钮事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { this.dgvKilnCarInfo.DataSource = null; this.dgvKilnCarGoods.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "R04"; cre.Name = "R040112"; if (this.rdoInTime.Checked) { cre.Properties["InTimeBegin"] = this.dtpInTimeBegin.Value; cre.Properties["InTimeEnd"] = this.dtpInTimeEnd.Value; } if (this.rdoOutTime.Checked) { cre.Properties["OutTimeBegin"] = this.dtpOutTimeBegin.Value; cre.Properties["OutTimeEnd"] = this.dtpOutTimeEnd.Value; } if (this.dropKilnCode.SelectedValue != null && this.dropKilnCode.SelectedValue != DBNull.Value) { cre.Properties["KilnID"] = Convert.ToInt32(this.dropKilnCode.SelectedValue); } cre.Properties["KilnCarNumBegin"] = this.txtKilnCarNumBegin.DataValue; cre.Properties["KilnCarNumEnd"] = this.txtKilnCarNumEnd.DataValue; ServiceResultEntity resultEntity = DoAsync(() => { return ReportModuleProxy.Service.DoRequest(cre); }); if (resultEntity == null || resultEntity.Data == null || resultEntity.Data.Tables.Count < 1) { return; } else { this.dgvKilnCarInfo.DataSource = resultEntity.Data.Tables[0]; this.dgvKilnCarGoods.DataSource = resultEntity.Data.Tables[1]; } } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空条件按钮事件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.dropKilnCode.SelectedValue = DBNull.Value; this.txtKilnCarNumBegin.Clear(); this.txtKilnCarNumEnd.Clear(); this.rdoInTime.Checked = true; } private void rdoInTime_CheckedChanged(object sender, EventArgs e) { this.dtpInTimeBegin.Enabled = this.rdoInTime.Checked; this.dtpInTimeEnd.Enabled = this.rdoInTime.Checked; } private void rdoOutTime_CheckedChanged(object sender, EventArgs e) { this.dtpOutTimeBegin.Enabled = this.rdoOutTime.Checked; this.dtpOutTimeEnd.Enabled = this.rdoOutTime.Checked; } #endregion #region 私有方法 /// /// 绑定下拉列表窑炉值 /// /// private void BindPageKiln() { byte byFlage = Convert.ToByte(Constant.ValueFlag.Invalid); ServiceResultEntity sre = ReportModuleProxy.Service.GetKilnData(byFlage); DataTable dtKilnInfo = sre.Data.Tables[Constant.INT_IS_ZERO]; DataRow newRowDic = dtKilnInfo.NewRow(); newRowDic["KilnID"] = DBNull.Value; newRowDic["KilnCode"] = Constant.CBO_SELECT_ALL_NAME; dtKilnInfo.Rows.InsertAt(newRowDic, Constant.INT_IS_ZERO); this.dropKilnCode.DataSource = dtKilnInfo; this.dropKilnCode.ValueMember = "KilnID"; this.dropKilnCode.DisplayMember = "KilnCode"; } #endregion private void tsbSetting_Click(object sender, EventArgs e) { F_RPT_04011201 f = new F_RPT_04011201(); f.ShowDialog(); } } }