F_PM_2104.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2104.cs
  5. * 2.功能描述:撤销包装
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/06/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.PMModule
  22. {
  23. public partial class F_PM_2104 : DKFormBase
  24. {
  25. #region 成员变量
  26. private string _currentbarcode = "";//当前产品条码
  27. #endregion
  28. #region 构造函数
  29. public F_PM_2104()
  30. {
  31. InitializeComponent();
  32. this.btnClose.Text = ButtonText.BTN_CLOSE;
  33. this.btnSave.Text = ButtonText.BTN_SAVE;
  34. this.Text = FormTitles.F_PM_2104;
  35. }
  36. #endregion
  37. #region 事件
  38. /// <summary>
  39. /// 保存按钮事件
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. private void btnSave_Click(object sender, EventArgs e)
  44. {
  45. try
  46. {
  47. if (this._currentbarcode.Trim() == "")
  48. {
  49. MessageBox.Show("产品条码不能为空", this.Text,
  50. MessageBoxButtons.OK, MessageBoxIcon.Information);
  51. this.txtBarCode.Focus();
  52. return;
  53. }
  54. ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  55. {
  56. return PMModuleProxy.Service.AddChancelFinishedproduct(this._currentbarcode.Trim());
  57. }));
  58. if (Convert.ToInt32(returnValue.Result) == -1)
  59. {
  60. MessageBox.Show("产品条码不存在包装记录", this.Text,
  61. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  62. this.txtBarCode.Focus();
  63. this.txtBarCode.SelectAll();
  64. return;
  65. }
  66. else if (Convert.ToInt32(returnValue.Result) == -200)
  67. {
  68. MessageBox.Show(returnValue.Message, this.Text,
  69. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  70. this.txtBarCode.Focus();
  71. this.txtBarCode.SelectAll();
  72. return;
  73. }
  74. else if (Convert.ToInt32(returnValue.Result) == 0)
  75. {
  76. MessageBox.Show("成品撤销失败", this.Text,
  77. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  78. this.txtBarCode.Focus();
  79. this.txtBarCode.SelectAll();
  80. return;
  81. }
  82. else if (Convert.ToInt32(returnValue.Result) > 0)
  83. {
  84. MessageBox.Show("成品撤销成功", this.Text,
  85. MessageBoxButtons.OK, MessageBoxIcon.Information);
  86. this.txtBarCode.Text = "";//成功后,直接下一个
  87. this._currentbarcode = "";
  88. this.btnSave.Visible = false;
  89. this.txtProductionInfo.Text = "";
  90. return;
  91. }
  92. }
  93. catch (Exception ex)
  94. {
  95. // 对异常进行共通处理
  96. ExceptionManager.HandleEventException(this.ToString(),
  97. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  98. }
  99. }
  100. /// <summary>
  101. /// 回车符事件
  102. /// </summary>
  103. /// <param name="sender"></param>
  104. /// <param name="e"></param>
  105. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  106. {
  107. try
  108. {
  109. if (this.txtBarCode.ReadOnly)
  110. {
  111. return;
  112. }
  113. if ((int)e.KeyChar == 13) // 按了回车键
  114. {
  115. this.btnSave.Visible = false;
  116. this.txtProductionInfo.Text = "";
  117. if (this.txtBarCode.Text.Trim() == "")
  118. {
  119. MessageBox.Show("产品条码不能为空", this.Text,
  120. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  121. this.txtBarCode.Focus();
  122. return;
  123. }
  124. this._currentbarcode = this.txtBarCode.Text.Trim();
  125. // 由产品条码获取注浆信息
  126. DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  127. {
  128. return PMModuleProxy.Service.GetFinishedProductGroutingInfoBybarcode(this.txtBarCode.Text.Trim());
  129. }));
  130. if (dsGroutingProduct != null && dsGroutingProduct.Tables[0].Rows.Count > 0)
  131. {
  132. this.txtProductionInfo.Text = "生产条码:" + dsGroutingProduct.Tables[0].Rows[0]["barcode"] + "\r\n\r\n";
  133. this.txtProductionInfo.Text += "包装条码:" + dsGroutingProduct.Tables[0].Rows[0]["OutOnlyCode"] + "\r\n\r\n";
  134. this.txtProductionInfo.Text += "产品编码:" + dsGroutingProduct.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
  135. this.txtProductionInfo.Text += "产品商标:" + dsGroutingProduct.Tables[0].Rows[0]["logoname"] + "\r\n\r\n";
  136. this.txtProductionInfo.Text += "成型工号:" + dsGroutingProduct.Tables[0].Rows[0]["UserCode"] + "\r\n\r\n";
  137. this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
  138. this.txtProductionInfo.Text += "模具编码:" + dsGroutingProduct.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
  139. this._currentbarcode = dsGroutingProduct.Tables[0].Rows[0]["barcode"].ToString();
  140. this.btnSave.Visible = true;
  141. }
  142. else
  143. {
  144. MessageBox.Show("产品条码无效", this.Text,
  145. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  146. this.txtBarCode.SelectAll();
  147. return;
  148. }
  149. }
  150. }
  151. catch (Exception ex)
  152. {
  153. // 对异常进行共通处理
  154. ExceptionManager.HandleEventException(this.ToString(),
  155. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  156. }
  157. }
  158. #endregion
  159. }
  160. }