| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2103.cs
- * 2.功能描述:扫描在产盘点单
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/05/14 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Reflection;
- using System.Text;
- 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_2103 : DKFormBase
- {
- #region 成员变量
- private int _inCheckedCount = 0; //盘点数量
- #endregion
- #region 构造函数
- public F_PM_2103()
- {
- InitializeComponent();
- this.btnClose.Text = ButtonText.BTN_CLOSE;
- }
- public F_PM_2103(int InCheckedID, string InCheckedNo)
- {
- InitializeComponent();
- this.dkInChecked1.InCheckedID = InCheckedID;
- this.dkInChecked1.Text = InCheckedNo;
- this.btnClose.Text = ButtonText.BTN_CLOSE;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 回车符事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (this.txtBarCode.ReadOnly)
- {
- return;
- }
- if ((int)e.KeyChar == 13) // 按了回车键
- {
- if (this.dkInChecked1.InCheckedID == null)
- {
- MessageBox.Show("盘点单号必须选择", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.dkInChecked1.Focus();
- return;
- }
- if (this.txtBarCode.Text.Trim() == "")
- {
- MessageBox.Show("产品条码不能为空", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.Focus();
- return;
- }
- int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.UpdateInChecked(Convert.ToInt32(this.dkInChecked1.InCheckedID), this.txtBarCode.Text.Trim());
- }));
- //if (returnValue == -1)
- //{
- // MessageBox.Show("盘点单号不存在需要此盘点条码", this.Text,
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.txtBarCode.SelectAll();
- // return;
- //}
- if (returnValue == -2)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "不在在产产品", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == -22)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "己被其他工号盘点", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == -24)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "己被此工号盘点", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == -23)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "己被其他工号盘盈", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == -25)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "己被此工号盘盈", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == 0)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "盘点失败", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == 10)
- {
- MessageBox.Show("产品" + this.txtBarCode.Text + "盘盈成功", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue > 0)
- {
- _inCheckedCount = _inCheckedCount + 1;
- MessageBox.Show("产品" + this.txtBarCode.Text + "盘点成功", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.Text = "";//盘点成功后,直接下一个
- return;
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 窗体关闭时事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2103_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this._inCheckedCount > 0)
- {
- this.DialogResult = DialogResult.OK;
- }
- }
- /// <summary>
- /// 条码获得焦点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_2103_Shown(object sender, EventArgs e)
- {
- if (this.dkInChecked1.InCheckedID > 0)
- {
- this.txtBarCode.Focus();
- }
- }
- #endregion
- }
- }
|