/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_0203.cs * 2.功能描述:条码变更 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2015/03/25 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.Reflection; using System.Windows.Forms; using Dongke.IBOSS.PRD.Basics.BaseControls; 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.PMModule { /// /// 条码变更 /// public partial class F_PM_0203 : DKDockPanelBase { #region 成员变量 // 单例模式 private static F_PM_0203 _instance; #endregion #region 构造函数 /// /// 注浆日报一览窗体构造 /// private F_PM_0203() { this.InitializeComponent(); this.InitializeControls(); } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_0203 Instance { get { if (_instance == null) { _instance = new F_PM_0203(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// private void F_PM_0203_Load(object sender, EventArgs e) { try { // 按钮权限控制 //FormPermissionManager.FormPermissionControl(this.Name, this, // LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, // LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); // 获取成型线类型数据并绑定到控件上 ServiceResultEntity sre = this.DoAsync(() => { return PMModuleProxyNew.Service.GetFPM0101IData(); } ); if (sre.Data != null && sre.Data.Tables.Count > 0) { this.cboGroutingLineType.DataSource = sre.Data.Tables[0]; } this.cboGroutingLineType.SelectedValue = null; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空条件 /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtGroutingBatchNo.Clear(); this.txtRemarks.Clear(); this.txtGoodsCode.Clear(); this.txtGoodsName.Clear(); this.txtGroutingLineCode.Clear(); this.txtGroutingLineName.Clear(); this.txtGroutingMouldCode.Clear(); this.txtGroutingUser.Clear(); this.dtpGroutingDateBegin.Value = DateTime.Now.Date; this.dtpGroutingDateEnd.Value = DateTime.Now.Date; this.cboGroutingLineType.SelectedValue = null; this.ckbGroutingDate.Checked = false; this.dtpCreateTimeBegin.Value = DateTime.Now.Date; this.dtpCreateTimeEnd.Value = DateTime.Now.Date; } /// /// 查询数据 /// private void btnSearch_Click(object sender, System.EventArgs e) { try { this.dgvBarCodes.DataSource = null; this.dgvBarCodes.DataSource = this.GetSearchData(); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 添加新注浆日报 /// /// /// private void tsbtnReplace_Click(object sender, EventArgs e) { try { F_PM_0201 frmFPM0201 = new F_PM_0201(); DialogResult dialogresult = frmFPM0201.ShowDialog(); if (dialogresult == DialogResult.OK) { string barcode = frmFPM0201.BarCode; this.dgvBarCodes.DataSource = null; // 调用服务器端获取数据集 ServiceResultEntity sre = DoAsync(() => { return PMModuleProxyNew.Service.GetFPM0203SData(barcode); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { this.dgvBarCodes.DataSource = sre.Data.Tables[0]; } this.btnSearch_Click(sender, e); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 选择要替换的条码 /// /// /// private void tsbtnSelectBarCode_Click(object sender, EventArgs e) { try { F_PM_0202 frmPM0202 = F_PM_0202.Instance; DialogResult dialogResult = frmPM0202.ShowDialog(); // 查询窗体返回值给控件赋值 if (dialogResult == DialogResult.OK) { //string barcode = frmPM0202.BarCode; if (!string.IsNullOrWhiteSpace(frmPM0202.BarCode)) { F_PM_0201 frmFPM0201 = new F_PM_0201(); frmFPM0201.BarCode = frmPM0202.BarCode; frmFPM0201.GoodsCode = frmPM0202.GoodsCodeText; DialogResult dialogresult = frmFPM0201.ShowDialog(); if (dialogresult == DialogResult.OK) { string barcode = frmFPM0201.BarCode; this.dgvBarCodes.DataSource = null; // 调用服务器端获取数据集 ServiceResultEntity sre = DoAsync(() => { return PMModuleProxyNew.Service.GetFPM0203SData(barcode); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { this.dgvBarCodes.DataSource = sre.Data.Tables[0]; } this.btnSearch_Click(sender, e); } } } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 关闭按钮事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 自动列宽事件 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvBarCodes.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 注浆日期 /// /// /// private void ckbGroutingDate_CheckedChanged(object sender, EventArgs e) { this.dtpGroutingDateBegin.Enabled = this.ckbGroutingDate.Checked; this.dtpGroutingDateEnd.Enabled = this.ckbGroutingDate.Checked; } /// /// 窗体关闭 /// /// /// private void F_PM_0101_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 /// /// 初始化控件 /// private void InitializeControls() { this.Text = FormTitles.F_PM_0203; this.tsbtnReplace.Text = ButtonText.TSBTN_REPLACE; this.tsbtnSelectBarCode.Text = ButtonText.TSBTN_SELECTBARCODE; 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; this.dgvBarCodes.AutoGenerateColumns = false; this.dgvBarCodes.ReadOnly = true; } /// /// 根据界面查询条件获取数据集 /// private DataTable GetSearchData() { try { FPM0203_SE se = new FPM0203_SE(); se.GroutingLineCode = this.txtGroutingLineCode.Text; se.GroutingLineName = this.txtGroutingLineName.Text; se.GroutingMouldCode = this.txtGroutingMouldCode.Text; se.GoodsCode = this.txtGoodsCode.Text; se.GoodsName = this.txtGoodsName.Text; se.Remarks = this.txtRemarks.Text; se.DateBegin = this.dtpCreateTimeBegin.Value.Date; se.DateEnd = this.dtpCreateTimeEnd.Value.Date; if (this.txtGroutingBatchNo.DataValue.HasValue) { se.GroutingBatchNo = System.Convert.ToInt32(this.txtGroutingBatchNo.DataValue); } if (this.ckbGroutingDate.Checked) { se.GroutingDateBegin = this.dtpGroutingDateBegin.Value.Date; se.GroutingDateEnd = this.dtpGroutingDateEnd.Value.Date; } if (this.cboGroutingLineType.SelectedValue != null) { se.GMouldTypeID = Convert.ToInt32(this.cboGroutingLineType.SelectedValue); } se.GroutingUserCode = this.txtGroutingUser.Text; // 调用服务器端获取数据集 ServiceResultEntity sre = DoAsync(() => { return PMModuleProxyNew.Service.GetFPM0203SData(se); } ); if (sre.Status == Constant.ServiceResultStatus.Success) { return sre.Data.Tables[0]; } return null; } catch (Exception ex) { throw ex; } } #endregion } }