F_PM_2115.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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_2115 : DKFormBase
  24. {
  25. #region 成员变量
  26. private string _currentbarcode = "";//当前产品条码
  27. private string procedurename = "";
  28. #endregion
  29. #region 构造函数
  30. public F_PM_2115()
  31. {
  32. InitializeComponent();
  33. this.btnClose.Text = ButtonText.BTN_CLOSE;
  34. this.btnSave.Text = ButtonText.BTN_SAVE;
  35. this.Text = FormTitles.F_PM_2115;
  36. }
  37. #endregion
  38. #region 事件
  39. /// <summary>
  40. /// 保存按钮事件
  41. /// </summary>
  42. /// <param name="sender"></param>
  43. /// <param name="e"></param>
  44. private void btnSave_Click(object sender, EventArgs e)
  45. {
  46. try
  47. {
  48. if (this._currentbarcode.Trim() == "")
  49. {
  50. MessageBox.Show("产品条码不能为空", this.Text,
  51. MessageBoxButtons.OK, MessageBoxIcon.Information);
  52. this.txtBarCode.Focus();
  53. return;
  54. }
  55. ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  56. {
  57. return PMModuleProxy.Service.AddChancelBarCode(this._currentbarcode.Trim());
  58. }));
  59. if (Convert.ToInt32(returnValue.Result) == -1)
  60. {
  61. MessageBox.Show("无效条码", this.Text,
  62. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  63. this.txtBarCode.Focus();
  64. this.txtBarCode.SelectAll();
  65. return;
  66. }
  67. else if (Convert.ToInt32(returnValue.Result) == -2)
  68. {
  69. MessageBox.Show("已经生产完成", this.Text,
  70. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  71. this.txtBarCode.Focus();
  72. this.txtBarCode.SelectAll();
  73. return;
  74. }
  75. else if (Convert.ToInt32(returnValue.Result) == -3)
  76. {
  77. MessageBox.Show("条码已经申请报废", this.Text,
  78. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  79. this.txtBarCode.Focus();
  80. this.txtBarCode.SelectAll();
  81. return;
  82. }
  83. else if (Convert.ToInt32(returnValue.Result) == -4)
  84. {
  85. MessageBox.Show("此条码当前工序不允许进行撤销", this.Text,
  86. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  87. this.txtBarCode.Focus();
  88. this.txtBarCode.SelectAll();
  89. return;
  90. }
  91. else if (Convert.ToInt32(returnValue.Result) == -5)
  92. {
  93. MessageBox.Show("此条码没有生产数据", this.Text,
  94. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  95. this.txtBarCode.Focus();
  96. this.txtBarCode.SelectAll();
  97. return;
  98. }
  99. else if (Convert.ToInt32(returnValue.Result) == -6)
  100. {
  101. MessageBox.Show("没有当前[" + procedurename + "]工序权限", this.Text,
  102. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  103. this.txtBarCode.Focus();
  104. this.txtBarCode.SelectAll();
  105. return;
  106. }
  107. else if (Convert.ToInt32(returnValue.Result) == -7)
  108. {
  109. MessageBox.Show("条码不在生产线上", this.Text,
  110. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  111. this.txtBarCode.Focus();
  112. this.txtBarCode.SelectAll();
  113. return;
  114. }
  115. else if (Convert.ToInt32(returnValue.Result) == -8)
  116. {
  117. MessageBox.Show("操作用户无此工序的撤销范围权限", this.Text,
  118. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  119. this.txtBarCode.Focus();
  120. this.txtBarCode.SelectAll();
  121. return;
  122. }
  123. else if (Convert.ToInt32(returnValue.Result) == -9)
  124. {
  125. MessageBox.Show("条码已经是返工状态", this.Text,
  126. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  127. this.txtBarCode.Focus();
  128. this.txtBarCode.SelectAll();
  129. return;
  130. }
  131. else if (Convert.ToInt32(returnValue.Result) == -200)
  132. {
  133. MessageBox.Show(returnValue.Message, this.Text,
  134. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  135. this.txtBarCode.Focus();
  136. this.txtBarCode.SelectAll();
  137. return;
  138. }
  139. else if (Convert.ToInt32(returnValue.Result) > 0)
  140. {
  141. MessageBox.Show("条码撤销成功", this.Text,
  142. MessageBoxButtons.OK, MessageBoxIcon.Information);
  143. this.txtBarCode.Text = "";//成功后,直接下一个
  144. this._currentbarcode = "";
  145. this.btnSave.Visible = false;
  146. this.txtProductionInfo.Text = "";
  147. return;
  148. }
  149. }
  150. catch (Exception ex)
  151. {
  152. // 对异常进行共通处理
  153. ExceptionManager.HandleEventException(this.ToString(),
  154. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  155. }
  156. }
  157. /// <summary>
  158. /// 回车符事件
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  163. {
  164. try
  165. {
  166. if (this.txtBarCode.ReadOnly)
  167. {
  168. return;
  169. }
  170. if ((int)e.KeyChar == 13) // 按了回车键
  171. {
  172. this.btnSave.Visible = false;
  173. this.txtProductionInfo.Text = "";
  174. if (this.txtBarCode.Text.Trim() == "")
  175. {
  176. MessageBox.Show("产品条码不能为空", this.Text,
  177. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  178. this.txtBarCode.Focus();
  179. return;
  180. }
  181. this._currentbarcode = this.txtBarCode.Text.Trim();
  182. // 由产品条码获取注浆信息
  183. DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
  184. {
  185. return PMModuleProxy.Service.GetGroutingInfoBybarcode(this.txtBarCode.Text.Trim());
  186. }));
  187. if (dsGroutingProduct != null && dsGroutingProduct.Tables[0].Rows.Count > 0)
  188. {
  189. this.txtProductionInfo.Text = "生产条码:" + dsGroutingProduct.Tables[0].Rows[0]["barcode"] + "\r\n\r\n";
  190. this.txtProductionInfo.Text += "包装条码:" + dsGroutingProduct.Tables[0].Rows[0]["OutOnlyCode"] + "\r\n\r\n";
  191. this.txtProductionInfo.Text += "产品编码:" + dsGroutingProduct.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
  192. this.txtProductionInfo.Text += "产品商标:" + dsGroutingProduct.Tables[0].Rows[0]["logoname"] + "\r\n\r\n";
  193. this.txtProductionInfo.Text += "成型工号:" + dsGroutingProduct.Tables[0].Rows[0]["UserCode"] + "\r\n\r\n";
  194. this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
  195. this.txtProductionInfo.Text += "模具编码:" + dsGroutingProduct.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
  196. this.txtProductionInfo.Text += "当前工序:" + dsGroutingProduct.Tables[0].Rows[0]["procedurename"] + "\r\n\r\n";
  197. procedurename = dsGroutingProduct.Tables[0].Rows[0]["procedurename"].ToString();
  198. this._currentbarcode = dsGroutingProduct.Tables[0].Rows[0]["barcode"].ToString();
  199. this.btnSave.Visible = true;
  200. }
  201. else
  202. {
  203. MessageBox.Show("产品条码无效", this.Text,
  204. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  205. this.txtBarCode.SelectAll();
  206. return;
  207. }
  208. }
  209. }
  210. catch (Exception ex)
  211. {
  212. // 对异常进行共通处理
  213. ExceptionManager.HandleEventException(this.ToString(),
  214. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  215. }
  216. }
  217. #endregion
  218. }
  219. }