/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_0107.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.Basics.DockPanel; 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_0107 : DKDockPanelBase { #region 成员变量 // 单例模式 private static F_PM_0107 _instance; #endregion #region 构造函数 /// /// 注浆日报一览窗体构造 /// private F_PM_0107() { this.InitializeComponent(); this.Text = FormTitles.F_PM_0107; 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; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_0107 Instance { get { if (_instance == null) { _instance = new F_PM_0107(); } return _instance; } } #endregion #region 事件 /// /// 窗体加载 /// private void F_PM_0107_Load(object sender, EventArgs e) { try { // 按钮权限控制 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); this.dtpGroutingDateFrom.Value = DateTime.Now.Date.AddDays(1); this.dtpGroutingDateTo.Value = DateTime.Now.Date.AddDays(1); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空条件 /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtRemarks.Clear(); this.txtGoodsCode.Clear(); this.txtGroutingLineCode.Clear(); this.txtGroutingMouldCode.Clear(); this.dtpGroutingDateFrom.Value = DateTime.Now.Date.AddDays(1); this.dtpGroutingDateTo.Value = DateTime.Now.Date.AddDays(1); this.txtGroutingBatchNo.Clear(); scbUser.ClearValue(); } /// /// 查询数据 /// private void btnSearch_Click(object sender, System.EventArgs e) { try { dgvDetail.DataSource = null; // 异步处理,获取信息 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PM_0107"; cre.Name = "GetBarcodeDraft"; cre.Properties["GroutingDateFrom"] = dtpGroutingDateFrom.Value; cre.Properties["GroutingDateTo"] = dtpGroutingDateTo.Value.AddDays(1); cre.Properties["GroutingLineCode"] = txtGroutingLineCode.Text.Trim(); cre.Properties["GroutingMouldCode"] = txtGroutingMouldCode.Text.Trim(); cre.Properties["GoodsCode"] = txtGoodsCode.Text.Trim(); cre.Properties["GroutingBatchNo"] = txtGroutingBatchNo.Text.Trim(); cre.Properties["Remarks"] = txtRemarks.Text.Trim(); cre.Properties["UserID"] = scbUser.SearchedPKMember; // 调用服务器端获取数据集 ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() => { return PMModuleProxyNew.Service.HandleRequest(cre); })); if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0) { dgvDetail.DataSource = sre.Data.Tables[0]; } else { MessageBox.Show(Messages.I_CMN_S_001, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 新建条码预设 /// /// /// private void tsbtnAdd_Click(object sender, EventArgs e) { try { F_PM_0108 frm = new F_PM_0108(); frm.FormMode = Constant.FormMode.Add; DialogResult dialogresult = frm.ShowDialog(); if (dialogresult == DialogResult.OK) { this.btnSearch_Click(sender, e); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 编辑条码预设 /// private void tsbtnEdit_Click(object sender, EventArgs e) { try { DataGridViewRow currentRow = this.dgvDetail.CurrentRow; if (currentRow != null) { F_PM_0108 frm = new F_PM_0108(); frm.FormMode = Constant.FormMode.Edit; frm.DrRow = (this.dgvDetail.CurrentRow.DataBoundItem as DataRowView).Row; DialogResult dialogresult = frm.ShowDialog(); if (dialogresult == DialogResult.OK) { this.btnSearch_Click(sender, e); } } else { DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_001); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 删除当前成型线当前批次的条码 /// /// /// private void tsbtnDelete_Click(object sender, EventArgs e) { try { // 验证条码重复 DataRow drDetail = (this.dgvDetail.CurrentRow?.DataBoundItem as DataRowView).Row; if (drDetail == null) { MessageBox.Show(string.Format(Messages.W_CMN_C_006, "没有任何数据"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DialogResult drs = MessageBox.Show("是否删除"+ Convert.ToDateTime(drDetail["groutingdate"]).ToString("yyyy-MM-dd") + ",【" + drDetail["GroutingLineCode"] + "】,第"+ drDetail["groutingbatchno"] + "批次的条码数据?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (drs == DialogResult.No) { return; } // 异步处理,获取信息 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PM_0108"; cre.Name = "SaveBarcodeDraft"; cre.Properties["groutingdate"] = drDetail["groutingdate"]; cre.Properties["groutinglineid"] = drDetail["groutinglineid"]; cre.Properties["groutingbatchno"] = drDetail["groutingbatchno"]; // 调用服务器端获取数据集 ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new AsyncMethod(() => { return PMModuleProxyNew.Service.HandleRequest(cre); })); if (sre.OtherStatus > 0) { // 提示未查找到数据 MessageBox.Show(string.Format(Messages.MSG_CMN_I001, Text, "删除"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); btnSearch_Click(null, null); } else if (sre.OtherStatus < 0 && !string.IsNullOrEmpty(sre.Message)) { // 提示未查找到数据 MessageBox.Show(string.Format(Messages.W_CMN_C_006, sre.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_W007, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { //this.SetEditGrid(); // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 编辑注浆日报 /// private void dgvDetail_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } this.tsbtnEdit_Click(sender, null); } /// /// 关闭按钮事件 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 自动列宽事件 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 窗体关闭 /// /// /// private void F_PM_0107_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion } }