F_PM_2116.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2116.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_2116 : DKFormBase
  24. {
  25. #region 成员变量
  26. private string _currentbarcode = "";//当前产品条码
  27. #endregion
  28. #region 构造函数
  29. public F_PM_2116()
  30. {
  31. InitializeComponent();
  32. this.btnClose.Text = ButtonText.BTN_CLOSE;
  33. this.btnSave.Text = ButtonText.BTN_SAVE;
  34. this.Text = FormTitles.F_PM_2116;
  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.AddChancelDeliverMudBarCode(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) == -2)
  67. {
  68. MessageBox.Show("已经生产完成", 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) == -3)
  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) == -4)
  83. {
  84. MessageBox.Show("此条码当前工序不允许进行撤销", this.Text,
  85. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  86. this.txtBarCode.Focus();
  87. this.txtBarCode.SelectAll();
  88. return;
  89. }
  90. else if (Convert.ToInt32(returnValue.Result) == -5)
  91. {
  92. MessageBox.Show("此条码没有生产数据", this.Text,
  93. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  94. this.txtBarCode.Focus();
  95. this.txtBarCode.SelectAll();
  96. return;
  97. }
  98. else if (Convert.ToInt32(returnValue.Result) == -55)
  99. {
  100. MessageBox.Show("条码已经不在交坯工序,不允许撤销", this.Text,
  101. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  102. this.txtBarCode.Focus();
  103. this.txtBarCode.SelectAll();
  104. return;
  105. }
  106. else if (Convert.ToInt32(returnValue.Result) == -6)
  107. {
  108. MessageBox.Show("没有任何影响行", this.Text,
  109. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  110. this.txtBarCode.Focus();
  111. this.txtBarCode.SelectAll();
  112. return;
  113. }
  114. else if (Convert.ToInt32(returnValue.Result) == -7)
  115. {
  116. MessageBox.Show("条码不在生产线上", this.Text,
  117. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  118. this.txtBarCode.Focus();
  119. this.txtBarCode.SelectAll();
  120. return;
  121. }
  122. else if (Convert.ToInt32(returnValue.Result) == -8)
  123. {
  124. MessageBox.Show("条码已经是返工状态", this.Text,
  125. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  126. this.txtBarCode.Focus();
  127. this.txtBarCode.SelectAll();
  128. return;
  129. }
  130. else if (Convert.ToInt32(returnValue.Result) == -200) // wangx 2016-10-10
  131. {
  132. MessageBox.Show(returnValue.Message, this.Text,
  133. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  134. this.txtBarCode.Focus();
  135. this.txtBarCode.SelectAll();
  136. return;
  137. }
  138. else if (Convert.ToInt32(returnValue.Result) > 0)
  139. {
  140. MessageBox.Show("条码撤销成功", this.Text,
  141. MessageBoxButtons.OK, MessageBoxIcon.Information);
  142. this.txtBarCode.Text = "";//成功后,直接下一个
  143. this._currentbarcode = "";
  144. this.btnSave.Visible = false;
  145. this.txtProductionInfo.Text = "";
  146. return;
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. // 对异常进行共通处理
  152. ExceptionManager.HandleEventException(this.ToString(),
  153. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  154. }
  155. }
  156. /// <summary>
  157. /// 回车符事件
  158. /// </summary>
  159. /// <param name="sender"></param>
  160. /// <param name="e"></param>
  161. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  162. {
  163. try
  164. {
  165. if (this.txtBarCode.ReadOnly)
  166. {
  167. return;
  168. }
  169. if ((int)e.KeyChar == 13) // 按了回车键
  170. {
  171. this.btnSave.Visible = false;
  172. this.txtProductionInfo.Text = "";
  173. if (this.txtBarCode.Text.Trim() == "")
  174. {
  175. MessageBox.Show("产品条码不能为空", this.Text,
  176. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  177. this.txtBarCode.Focus();
  178. return;
  179. }
  180. this._currentbarcode = this.txtBarCode.Text.Trim();
  181. // 由产品条码获取注浆信息
  182. DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  183. {
  184. return PMModuleProxy.Service.GetGroutingInfoBybarcode(this.txtBarCode.Text.Trim());
  185. }));
  186. if (dsGroutingProduct != null && dsGroutingProduct.Tables[0].Rows.Count > 0)
  187. {
  188. this.txtProductionInfo.Text = "产品编码:" + dsGroutingProduct.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
  189. this.txtProductionInfo.Text += "成型工号:" + dsGroutingProduct.Tables[0].Rows[0]["UserCode"] + "\r\n\r\n";
  190. this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
  191. this.txtProductionInfo.Text += "模具编码:" + dsGroutingProduct.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
  192. this.txtProductionInfo.Text += "当前工序:" + dsGroutingProduct.Tables[0].Rows[0]["procedurename"] + "\r\n\r\n";
  193. this.btnSave.Visible = true;
  194. }
  195. else
  196. {
  197. MessageBox.Show("产品条码无效", this.Text,
  198. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  199. this.txtBarCode.SelectAll();
  200. return;
  201. }
  202. }
  203. }
  204. catch (Exception ex)
  205. {
  206. // 对异常进行共通处理
  207. ExceptionManager.HandleEventException(this.ToString(),
  208. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  209. }
  210. }
  211. #endregion
  212. }
  213. }