| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_0201.cs
- * 2.功能描述:变更条码
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 庄天威 2014/09/23 1.00 新建
- *******************************************************************************/
- using System;
- 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.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 变更条码
- /// </summary>
- public partial class F_PM_0201 : DKFormBase
- {
- #region 构造函数
- /// <summary>
- /// 变更条码
- /// </summary>
- public F_PM_0201()
- {
- this.InitializeComponent();
- this.Text = FormTitles.F_PM_0201;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClose.Text = ButtonText.BTN_CLOSE;
- }
- #endregion
- #region 属性
- /// <summary>
- /// 原条码
- /// </summary>
- public string BarCode
- {
- get
- {
- return this.txtBarCode.Text;
- }
- set
- {
- this.txtBarCode.Text = value;
- }
- }
- /// <summary>
- /// 新条码
- /// </summary>
- public string NewBarCode
- {
- get
- {
- return this.txtNewBarCode.Text;
- }
- set
- {
- this.txtNewBarCode.Text = value;
- }
- }
- /// <summary>
- /// 产品编码
- /// </summary>
- public string GoodsCode
- {
- get
- {
- return this.txtGoodsCode.Text;
- }
- set
- {
- this.txtGoodsCode.Text = value;
- }
- }
- #endregion 属性
- #region 事件
- /// <summary>
- /// 画面加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_0201_Load(object sender, EventArgs e)
- {
- if (!string.IsNullOrWhiteSpace(this.txtBarCode.Text))
- {
- this.txtNewBarCode.Focus();
- }
- }
- /// <summary>
- /// 替换条码
- /// </summary>
- private void btnSave_Click(object sender, EventArgs e)
- {
- string barCode = this.txtBarCode.Text.Trim();
- string newBarCode = this.txtNewBarCode.Text.Trim();
- string groutingusercode = this.txtGroutingUserCode.Text.Trim();
- string goodscode = this.txtGoodsCode.Text.Trim();
- try
- {
- if (string.IsNullOrWhiteSpace(groutingusercode))
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblGroutingUserCode.Text);
- this.txtGroutingUserCode.Focus();
- return;
- }
- if (string.IsNullOrWhiteSpace(goodscode))
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblBarCode.Text);
- this.txtGoodsCode.Focus();
- return;
- }
- if (string.IsNullOrWhiteSpace(barCode))
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblBarCode.Text);
- this.txtBarCode.Focus();
- return;
- }
- if (string.IsNullOrWhiteSpace(newBarCode))
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblNewBarCode.Text);
- this.txtNewBarCode.Focus();
- return;
- }
- if (newBarCode == barCode)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_004, this.lblNewBarCode.Text, this.lblBarCode.Text);
- this.txtNewBarCode.Focus();
- return;
- }
- ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.SetFPM0201Data(barCode, newBarCode, this.txtRemarks.Text, this.txtGroutingUserCode.Text,goodscode);
- }
- );
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- this.DialogResult = DialogResult.OK;
- //this.Close();
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
- }
- }
- 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 btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_0202 frmPM0202 = F_PM_0202.Instance;
- frmPM0202.BarCode = this.txtBarCode.Text;
- frmPM0202.GroutingUserCode = this.txtGroutingUserCode.Text;
- frmPM0202.GoodsCodeText = this.txtGoodsCode.Text;
- DialogResult dialogResult = frmPM0202.ShowDialog();
- // 查询窗体返回值给控件赋值
- if (dialogResult == DialogResult.OK)
- {
- this.txtBarCode.Text = frmPM0202.BarCode;
- this.txtGoodsCode.Text = frmPM0202.GoodsCodeText;
- if (!string.IsNullOrWhiteSpace(this.txtBarCode.Text))
- {
- this.txtNewBarCode.Focus();
- }
- }
- }
- 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 txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE)
- {
- this.txtNewBarCode.Focus();
- }
- }
- #endregion
- }
- }
|