| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_0503.cs
- * 2.功能描述:撤销装车
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈冰 2014/10/23 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.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 撤销装车
- /// </summary>
- public partial class F_PM_0503 : FormBase
- {
- #region
- //当前工序
- int _procedureID = 0;
- //保存标记
- bool _SaveOKFlag = false;
- #endregion
- #region 构造
- public F_PM_0503(int procedureID)
- {
- this._procedureID = procedureID;
- InitializeComponent();
- this.SetFromTitleInfo();
- this.btnSave.Enabled = false;
- this.txtBarcode.Focus();
- }
- public F_PM_0503(int procedureID,string barcode)
- {
-
- this._procedureID = procedureID;
- InitializeComponent();
- this.SetFromTitleInfo();
- this.txtBarcode.Text = barcode;
- this.btnSave.Enabled = false;
- this.txtBarcode.SelectionStart = barcode.Length;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 条码焦点离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtBarcode_Leave(object sender, System.EventArgs e)
- {
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- if (string.IsNullOrEmpty(this.txtBarcode.Text.Trim()))
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "条码", "条码"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- string err = (string)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddCancelLoadCar(this._procedureID, this.txtBarcode.Text.Trim());
- }));
- if (string.IsNullOrEmpty(err))
- {
- this._SaveOKFlag = true;
- // 提示信息
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // 清空文本框
- this.CleanTextBox();
- }
- else
- {
- MessageBox.Show(err,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- 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 btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 关闭窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_0503_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this._SaveOKFlag)
- {
- this.DialogResult = DialogResult.OK;
- }
- }
- /// <summary>
- /// 条码回车事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- // 按了回车键
- if ((int)e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE)
- {
- this.CheckBarcode();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 清空文本框
- /// </summary>
- private void CleanTextBox()
- {
- this.txtBarcode.Text = string.Empty;
- this.txtGoodsCode.Text = string.Empty;
- this.txtGoodsName.Text = string.Empty;
- this.txtKilnCarNo.Text = string.Empty;
- this.txtBarcodeStatus.Text = string.Empty;
- }
- /// <summary>
- /// 设置窗体按钮的文本信息
- /// </summary>
- private void SetFromTitleInfo()
- {
- this.Text = FormTitles.F_PM_0503;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CANCEL;
- }
- /// <summary>
- /// 检验条码是否可以下车
- /// </summary>
- private void CheckBarcode()
- {
- try
- {
- if (!string.IsNullOrEmpty(this.txtBarcode.Text.Trim()))
- {
- CheckCancelLoadCar checkCancelLoadCar = (CheckCancelLoadCar)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.CheckCancelLoadCar(this._procedureID, this.txtBarcode.Text.Trim());
- }));
- if (!string.IsNullOrEmpty(checkCancelLoadCar.ErrMsg))
- {
- this.txtBarcodeStatus.Text = checkCancelLoadCar.ErrMsg;
- this.txtGoodsCode.Text = "";
- this.txtGoodsName.Text = "";
- this.txtKilnCarNo.Text = "";
- this.btnSave.Enabled = false;
- //this.btnCancel.Focus();
- }
- else
- {
- this.txtBarcodeStatus.Text = checkCancelLoadCar.ErrMsg;
- this.btnSave.Enabled = true;
- this.txtGoodsCode.Text = checkCancelLoadCar.GoodsCode;
- this.txtGoodsName.Text = checkCancelLoadCar.GoodsName;
- this.txtKilnCarNo.Text = checkCancelLoadCar.KilnCarCode;
- }
-
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- #endregion
- }
- }
|