| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2603.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
- {
- /// <summary>
- /// 扫描注浆盘点单
- /// </summary>
- public partial class F_PM_2603 : DKFormBase
- {
- #region 成员变量
- private int _inCheckedCount = 0; //盘点数量
- #endregion
- #region 构造函数
- public F_PM_2603()
- {
- InitializeComponent();
- this.btnClose.Text = ButtonText.BTN_CLOSE;
- }
- public F_PM_2603(int checkedID, string checkedNo)
- {
- InitializeComponent();
- this.dkInChecked1.InCheckedID = checkedID;
- this.dkInChecked1.Text = checkedNo;
- 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;
- }
- ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "GBChecked";
- cre.Name = "UpdateGBChecked";
- cre.Properties["CheckedID"] = Convert.ToInt32(this.dkInChecked1.InCheckedID);
- cre.Properties["Barcode"] = this.txtBarCode.Text.Trim();
- return PMModuleProxyNew.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);
- }
- }
- /// <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
- }
- }
|