/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PM_1103.cs
* 2.功能描述:扫描盘点单
* 编辑履历:
* 作者 日期 版本 修改内容
* 王鑫 2015/05/14 1.00 新建
*******************************************************************************/
using System;
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_PC_1103 : DKFormBase
{
#region 成员变量
private int _inCheckedCount = 0; //盘点数量
#endregion
#region 构造函数
public F_PC_1103()
{
InitializeComponent();
this.btnClose.Text = ButtonText.BTN_CLOSE;
}
public F_PC_1103(int checkedID, string checkedNo)
{
InitializeComponent();
this.dkInChecked1.InCheckedID = checkedID;
this.dkInChecked1.Text = checkedNo;
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;
}
ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
{
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "FPC1101";
cre.Name = "UpdateMouldChecked";
cre.Properties["CheckedID"] = Convert.ToInt32(this.dkInChecked1.InCheckedID);
cre.Properties["Barcode"] = this.txtBarCode.Text.Trim();
return PCModuleProxyNew.Service.HandleRequest(cre);
}));
if (returnValue == null)
{
MessageBox.Show("盘点失败", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtBarCode.Focus();
this.txtBarCode.SelectAll();
}
else if (returnValue.Status == Constant.ServiceResultStatus.Success)
{
_inCheckedCount = _inCheckedCount + 1;
MessageBox.Show("产品" + this.txtBarCode.Text + "盘点成功", this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtBarCode.Text = "";
this.txtBarCode.Focus();
}
else if (returnValue.Status == Constant.ServiceResultStatus.Other)
{
MessageBox.Show(returnValue.Message, this.Text,
MessageBoxButtons.OK, MessageBoxIcon.Warning);
this.txtBarCode.Focus();
this.txtBarCode.SelectAll();
}
}
}
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
}
}