/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_2104.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_2115 : DKFormBase { #region 成员变量 private string _currentbarcode = "";//当前产品条码 private string procedurename = ""; #endregion #region 构造函数 public F_PM_2115() { InitializeComponent(); this.btnClose.Text = ButtonText.BTN_CLOSE; this.btnSave.Text = ButtonText.BTN_SAVE; this.Text = FormTitles.F_PM_2115; } #endregion #region 事件 /// /// 保存按钮事件 /// /// /// private void btnSave_Click(object sender, EventArgs e) { try { if (this._currentbarcode.Trim() == "") { MessageBox.Show("产品条码不能为空", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBarCode.Focus(); return; } ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() => { return PMModuleProxy.Service.AddChancelBarCode(this._currentbarcode.Trim()); })); if (Convert.ToInt32(returnValue.Result) == -1) { MessageBox.Show("无效条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -2) { MessageBox.Show("已经生产完成", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -3) { MessageBox.Show("条码已经申请报废", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -4) { MessageBox.Show("此条码当前工序不允许进行撤销", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -5) { MessageBox.Show("此条码没有生产数据", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -6) { MessageBox.Show("没有当前[" + procedurename + "]工序权限", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -7) { MessageBox.Show("条码不在生产线上", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -8) { MessageBox.Show("操作用户无此工序的撤销范围权限", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -9) { MessageBox.Show("条码已经是返工状态", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) == -200) { MessageBox.Show(returnValue.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.txtBarCode.Focus(); this.txtBarCode.SelectAll(); return; } else if (Convert.ToInt32(returnValue.Result) > 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); } } /// /// 回车符事件 /// /// /// private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e) { 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]["barcode"] + "\r\n\r\n"; this.txtProductionInfo.Text += "包装条码:" + dsGroutingProduct.Tables[0].Rows[0]["OutOnlyCode"] + "\r\n\r\n"; this.txtProductionInfo.Text += "产品编码:" + dsGroutingProduct.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n"; this.txtProductionInfo.Text += "产品商标:" + dsGroutingProduct.Tables[0].Rows[0]["logoname"] + "\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.txtProductionInfo.Text += "当前工序:" + dsGroutingProduct.Tables[0].Rows[0]["procedurename"] + "\r\n\r\n"; procedurename = dsGroutingProduct.Tables[0].Rows[0]["procedurename"].ToString(); this._currentbarcode = dsGroutingProduct.Tables[0].Rows[0]["barcode"].ToString(); 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 } }