/******************************************************************************* * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PC_1003.cs * 2.功能描述:替换条码 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2017/12/12 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.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; namespace Dongke.IBOSS.PRD.Client.PCModule { /// /// 替换条码 /// public partial class F_PC_1003 : DKFormBase { #region 成员变量 /// /// 模具ID /// private int _mouldID = 0; #endregion #region 构造函数 /// /// 构造函数 /// public F_PC_1003(int mouldID) { InitializeComponent(); this._mouldID = mouldID; } #endregion #region 事件处理 /// /// 画面加载 /// /// /// private void F_PC_1002_Load(object sender, System.EventArgs e) { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "PC_Mould"; cre.Name = "GetMouldData"; cre.Properties["MouldID"] = this._mouldID; ServiceResultEntity sre = PCModuleProxyNew.Service.HandleRequest(cre); if (sre == null) { this.Close(); return; } DataRow item = sre.Data.Tables["InfoData"].Rows[0]; this.txtBarcode.Text = item["MouldBarcode"].ToString(); } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 关闭画面 /// /// /// private void btnCancel_Click(object sender, System.EventArgs e) { this.Close(); } /// /// 保存 /// /// /// private void btnSave_Click(object sender, EventArgs e) { try { if (!this.CheckInput()) { return; } ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "FPC1003"; cre.Name = "SetFPC1003Data"; cre.Properties["MouldID"] = this._mouldID; cre.Properties["MouldBarcode"] = this.txtBarcode.Text.Trim(); cre.Properties["NewMouldBarcode"] = this.txtNewBarcode.Text.Trim(); cre.Properties["Remarks"] = this.txtRemarks.Text; ServiceResultEntity sre = this.DoAsync(() => { return PCModuleProxyNew.Service.HandleRequest(cre); }); if (sre != null) { if (sre.Status == Constant.ServiceResultStatus.Success) { // 提示信息 MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } else if (!string.IsNullOrWhiteSpace(sre.Message)) { MessageBox.Show(sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { // 提示信息 MessageBox.Show("保存失败", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion #region 私有方法 /// /// 保存前画面数据验证 /// /// private bool CheckInput() { if (string.IsNullOrEmpty(this.txtBarcode.Text.Trim())) { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "原模具条码"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.txtBarcode.Focus(); return false; } if (string.IsNullOrEmpty(this.txtNewBarcode.Text.Trim())) { MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "新模具条码"), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.txtNewBarcode.Focus(); return false; } if (this.txtNewBarcode.Text.Trim() == this.txtBarcode.Text.Trim()) { MessageBox.Show("替换前后模具条码不能一致", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); this.txtNewBarcode.Focus(); return false; } return true; } #endregion } }