| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_2107.cs
- * 2.功能描述:公坯判定
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/06/13 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_2107 : DKFormBase
- {
- #region 成员变量
- private string _currentbarcode = "";//当前产品条码
- #endregion
- #region 构造函数
- public F_PM_2107()
- {
- InitializeComponent();
- this.btnClose.Text = ButtonText.BTN_CLOSE;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.Text = FormTitles.F_PM_2107;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- //try
- //{
- // 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.AddChancelFinishedproduct(this.txtBarCode.Text.Trim());
- // }));
- // if (returnValue == -1)
- // {
- // MessageBox.Show("此产品没有损坯,不能撤销", this.Text,
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.txtBarCode.SelectAll();
- // return;
- // }
- // else if (returnValue == 0)
- // {
- // MessageBox.Show("损坯撤销失败", this.Text,
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.txtBarCode.SelectAll();
- // return;
- // }
- // else if (returnValue > 0)
- // {
- // MessageBox.Show("损坯撤销成功", 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);
- //}
- try
- {
- if (this._currentbarcode.Trim() == "")
- {
- MessageBox.Show("产品条码不能为空", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.Focus();
- return;
- }
- int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddPublicBodyProduct(this._currentbarcode.Trim());
- }));
- if (returnValue == -1)
- {
- MessageBox.Show("此产品不在生产线上", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarCode.Focus();
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == -2)
- {
- MessageBox.Show("该产品已经标识为公坯", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarCode.Focus();
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue == 0)
- {
- MessageBox.Show("公坯设定失败", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarCode.Focus();
- this.txtBarCode.SelectAll();
- return;
- }
- else if (returnValue > 0)
- {
- MessageBox.Show("公坯设定成功", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarCode.Text = "";//成功后,直接下一个
- this._currentbarcode = "";
- this.btnSave.Visible = false;
- this.txtProductionInfo.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 txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- //try
- //{
- // if (this.txtBarCode.ReadOnly)
- // {
- // return;
- // }
- // if ((int)e.KeyChar == 13) // 按了回车键
- // {
- // 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.AddCancelScrapProduction(this.txtBarCode.Text.Trim());
- // }));
- // if (returnValue == -1)
- // {
- // MessageBox.Show("此产品没有损坯,不能撤销", this.Text,
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.txtBarCode.SelectAll();
- // return;
- // }
- // else if (returnValue == 0)
- // {
- // MessageBox.Show("损坯撤销失败", this.Text,
- // MessageBoxButtons.OK, MessageBoxIcon.Information);
- // this.txtBarCode.SelectAll();
- // return;
- // }
- // else if (returnValue > 0)
- // {
- // MessageBox.Show("损坯撤销成功", 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);
- //}
- try
- {
- if (this.txtBarCode.ReadOnly)
- {
- return;
- }
- if ((int)e.KeyChar == 13) // 按了回车键
- {
- this.btnSave.Visible = false;
- this.txtProductionInfo.Text = "";
- if (this.txtBarCode.Text.Trim() == "")
- {
- MessageBox.Show("产品条码不能为空", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarCode.Focus();
- return;
- }
- this._currentbarcode = this.txtBarCode.Text.Trim();
- // 由产品条码获取注浆信息
- DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.GetGroutingInfoBybarcode(this.txtBarCode.Text.Trim());
- }));
- if (dsGroutingProduct != null && dsGroutingProduct.Tables[0].Rows.Count > 0)
- {
- this.txtProductionInfo.Text = "产品编码:" + dsGroutingProduct.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
- this.txtProductionInfo.Text += "成型工号:" + dsGroutingProduct.Tables[0].Rows[0]["UserCode"] + "\r\n\r\n";
- this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
- this.txtProductionInfo.Text += "模具编码:" + dsGroutingProduct.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
- this.btnSave.Visible = true;
- }
- else
- {
- MessageBox.Show("产品条码无效", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarCode.SelectAll();
- return;
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- }
- }
|