/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_0101.cs * 2.功能描述:成型线一览 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2015/04/22 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Reflection; 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.PCModule { /// /// 成型线一览 /// public partial class F_PC_0101_1 : DKDockPanelBase { #region 成员变量 // 单例模式使用 private static F_PC_0101_1 _instance; // 在查询成型线时,不通过成型线去查询模具信息 private bool _isSelecting = false; // 当前模具信息的成型线ID private int _lineID = 0; #endregion #region 构造函数 /// /// 成型线一览 /// public F_PC_0101_1() { this.InitializeComponent(); this.InitializeControls(); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PC_0101_1 Instance { get { if (_instance == null) { _instance = new F_PC_0101_1(); } return _instance; } } #endregion #region 事件处理 /// /// 页面加载事件 /// /// /// private void F_PC_0101_Load(object sender, EventArgs e) { try { // 按钮权限控制 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); // 获取成型线类型数据并绑定到控件上 ServiceResultEntity sre = this.DoAsync(() => { return PCModuleProxyNew.Service.GetFPC0101IData(); } ); if (sre.Data != null && sre.Data.Tables.Count > 1) { this.cboGMouldType.DataSource = sre.Data.Tables[0]; this.cboGMouldStatus.DataSource = sre.Data.Tables[1]; } this.cboGMouldType.SelectedValue = null; this.cboGMouldStatus.SelectedValue = null; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 自动列宽按钮按下处理 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvGroutingLine.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 开始日期条件选中状态改变处理事件 /// /// /// private void chkBeginDate_CheckedChanged(object sender, EventArgs e) { this.dtpBeginUsedDateBegin.Enabled = this.chkBeginDate.Checked; this.dtpBeginUsedDateEnd.Enabled = this.chkBeginDate.Checked; if (!this.chkBeginDate.Checked) { this.dtpBeginUsedDateBegin.Value = DateTime.Now.Date; this.dtpBeginUsedDateEnd.Value = DateTime.Now.Date; } } /// /// 结束日期条件选中状态改变处理事件 /// /// /// private void chkEndDate_CheckedChanged(object sender, EventArgs e) { this.dtpEndUsedDateBegin.Enabled = this.chkEndDate.Checked; this.dtpEndUsedDateEnd.Enabled = this.chkEndDate.Checked; if (!this.chkEndDate.Checked) { this.dtpEndUsedDateBegin.Value = DateTime.Now.Date; this.dtpEndUsedDateEnd.Value = DateTime.Now.Date; } } /// /// 查询按钮按下处理 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { this._isSelecting = true; this._lineID = 0; this.dgvGroutingLine.DataSource = null; this.dgvGroutingLineDetail.DataSource = null; DataSet dataSet = this.GetSearchData(); if (dataSet != null) { if (dataSet.Tables.Count > 0) { this.dgvGroutingLine.DataSource = dataSet.Tables[0]; this._lineID = Convert.ToInt32(dataSet.Tables[0].Rows[0]["GroutingLineID"]); } if (dataSet.Tables.Count > 1) { this.dgvGroutingLineDetail.DataSource = dataSet.Tables[1]; } } this._isSelecting = false; } catch (Exception ex) { this._isSelecting = false; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 显示明细数据 /// /// /// private void dgvGroutingLine_RowEnter(object sender, DataGridViewCellEventArgs e) { if (this._isSelecting || e.RowIndex < 0 || e.ColumnIndex < 0) { return; } try { object id = this.dgvGroutingLine.Rows[e.RowIndex].Cells["GroutingLineID"].Value; if (id == null || id == DBNull.Value) { this.dgvGroutingLineDetail.DataSource = null; return; } int lineID = Convert.ToInt32(id); if (this._lineID != lineID) { this._lineID = lineID; this.dgvGroutingLineDetail.DataSource = null; ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.GetFPC0101SDData(this._lineID); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { this.dgvGroutingLineDetail.DataSource = sre.Data.Tables[0]; } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空查询条件处理 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtBuildingNo.Clear(); this.txtFloorNo.Clear(); this.txtGroutingLineNo.Clear(); this.txtGroutingLineCode.Clear(); this.txtGroutingLineName.Clear(); this.txtGUserCode.Clear(); this.txtGoodsCode.Clear(); this.txtRemarks.Clear(); this.cboGMouldType.SelectedValue = null; this.cboGMouldStatus.SelectedValue = null; this.chkBeginDate.Checked = false; this.chkEndDate.Checked = false; } /// /// 新建 /// /// /// private void tsbtnAdd_Click(object sender, EventArgs e) { try { } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 编辑 /// /// /// private void tsbtnEdit_Click(object sender, EventArgs e) { try { } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭事件处理 /// /// /// private void tsbtnClose_Click(object sender, System.EventArgs e) { this.Close(); } /// /// 窗体关闭后,释放单例模式 /// /// /// private void F_PC_0101_FormClosed(object sender, System.Windows.Forms.FormClosedEventArgs e) { _instance = null; } /// /// 双击某成型线进行编辑 /// /// /// private void dgvGroutingLine_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } try { this.tsbtnEdit_Click(sender, e); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion #region 私有方法 /// /// 初始化控件 /// private void InitializeControls() { this.Text = FormTitles.F_PC_0101_1; this.tsbtnAdd.Text = ButtonText.TSBTN_ADD; this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT; 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; } /// /// 根据界面查询条件获取数据集 /// private DataSet GetSearchData() { try { FPC0101_SE se = new FPC0101_SE(); se.BuildingNo = this.txtBuildingNo.Text; se.FloorNo = this.txtFloorNo.Text; se.GroutingLineNo = this.txtGroutingLineNo.Text; se.GroutingLineCode = this.txtGroutingLineCode.Text; se.GroutingLineName = this.txtGroutingLineName.Text; se.GUserCode = this.txtGUserCode.Text; se.GoodsCode = this.txtGoodsCode.Text; if(this.cboGMouldType.SelectedValue != null) { se.GMouldTypeID = Convert.ToInt32(this.cboGMouldType.SelectedValue); } if (this.cboGMouldStatus.SelectedValue != null) { se.GMouldStatus = Convert.ToInt32(this.cboGMouldStatus.SelectedValue); } if(this.chkBeginDate.Checked) { se.BeginUsedDateBegin = this.dtpBeginUsedDateBegin.Value; se.BeginUsedDateEnd = this.dtpBeginUsedDateEnd.Value; } if (this.chkEndDate.Checked) { se.EndUsedDateBegin = this.dtpEndUsedDateBegin.Value; se.EndUsedDateEnd = this.dtpEndUsedDateEnd.Value; } se.Remarks = this.txtRemarks.Text; // 调用服务器端获取数据集 ServiceResultEntity sre = DoAsync(() => { return PCModuleProxyNew.Service.GetFPC0101SData(se); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { return sre.Data; } return null; } catch (Exception ex) { throw ex; } } #endregion } }