| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- /*******************************************************************************
- * 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
- {
- /// <summary>
- /// 替换条码
- /// </summary>
- public partial class F_PC_1003 : DKFormBase
- {
- #region 成员变量
- /// <summary>
- /// 模具ID
- /// </summary>
- private int _mouldID = 0;
- #endregion
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- public F_PC_1003(int mouldID)
- {
- InitializeComponent();
- this._mouldID = mouldID;
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 画面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 关闭画面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnCancel_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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<ServiceResultEntity>(() =>
- {
- 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 私有方法
- /// <summary>
- /// 保存前画面数据验证
- /// </summary>
- /// <returns></returns>
- 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
- }
- }
|