/******************************************************************************* * 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 { /// /// 扫描在产盘点单 /// 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 事件 /// /// 回车符事件 /// /// /// 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); } } /// /// 窗体关闭时事件 /// /// /// private void F_PM_2103_FormClosing(object sender, FormClosingEventArgs e) { if (this._inCheckedCount > 0) { this.DialogResult = DialogResult.OK; } } /// /// 条码获得焦点 /// /// /// private void F_PM_2103_Shown(object sender, EventArgs e) { if (this.dkInChecked1.InCheckedID > 0) { this.txtBarCode.Focus(); } } #endregion } }