F_PM_0201.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0201.cs
  5. * 2.功能描述:变更条码
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/23 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Reflection;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseControls;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Client.CommonModule;
  16. using Dongke.IBOSS.PRD.Client.Controls;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.PMModule
  20. {
  21. /// <summary>
  22. /// 变更条码
  23. /// </summary>
  24. public partial class F_PM_0201 : DKFormBase
  25. {
  26. #region 构造函数
  27. /// <summary>
  28. /// 变更条码
  29. /// </summary>
  30. public F_PM_0201()
  31. {
  32. this.InitializeComponent();
  33. this.Text = FormTitles.F_PM_0201;
  34. this.btnSave.Text = ButtonText.BTN_SAVE;
  35. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  36. this.btnClose.Text = ButtonText.BTN_CLOSE;
  37. }
  38. #endregion
  39. #region 属性
  40. /// <summary>
  41. /// 原条码
  42. /// </summary>
  43. public string BarCode
  44. {
  45. get
  46. {
  47. return this.txtBarCode.Text;
  48. }
  49. set
  50. {
  51. this.txtBarCode.Text = value;
  52. }
  53. }
  54. /// <summary>
  55. /// 新条码
  56. /// </summary>
  57. public string NewBarCode
  58. {
  59. get
  60. {
  61. return this.txtNewBarCode.Text;
  62. }
  63. set
  64. {
  65. this.txtNewBarCode.Text = value;
  66. }
  67. }
  68. /// <summary>
  69. /// 产品编码
  70. /// </summary>
  71. public string GoodsCode
  72. {
  73. get
  74. {
  75. return this.txtGoodsCode.Text;
  76. }
  77. set
  78. {
  79. this.txtGoodsCode.Text = value;
  80. }
  81. }
  82. #endregion 属性
  83. #region 事件
  84. /// <summary>
  85. /// 画面加载事件
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. private void F_PM_0201_Load(object sender, EventArgs e)
  90. {
  91. if (!string.IsNullOrWhiteSpace(this.txtBarCode.Text))
  92. {
  93. this.txtNewBarCode.Focus();
  94. }
  95. }
  96. /// <summary>
  97. /// 替换条码
  98. /// </summary>
  99. private void btnSave_Click(object sender, EventArgs e)
  100. {
  101. string barCode = this.txtBarCode.Text.Trim();
  102. string newBarCode = this.txtNewBarCode.Text.Trim();
  103. string groutingusercode = this.txtGroutingUserCode.Text.Trim();
  104. string goodscode = this.txtGoodsCode.Text.Trim();
  105. try
  106. {
  107. if (string.IsNullOrWhiteSpace(groutingusercode))
  108. {
  109. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblGroutingUserCode.Text);
  110. this.txtGroutingUserCode.Focus();
  111. return;
  112. }
  113. if (string.IsNullOrWhiteSpace(goodscode))
  114. {
  115. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblBarCode.Text);
  116. this.txtGoodsCode.Focus();
  117. return;
  118. }
  119. if (string.IsNullOrWhiteSpace(barCode))
  120. {
  121. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblBarCode.Text);
  122. this.txtBarCode.Focus();
  123. return;
  124. }
  125. if (string.IsNullOrWhiteSpace(newBarCode))
  126. {
  127. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_003, this.lblNewBarCode.Text);
  128. this.txtNewBarCode.Focus();
  129. return;
  130. }
  131. if (newBarCode == barCode)
  132. {
  133. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_C_004, this.lblNewBarCode.Text, this.lblBarCode.Text);
  134. this.txtNewBarCode.Focus();
  135. return;
  136. }
  137. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  138. {
  139. return PMModuleProxyNew.Service.SetFPM0201Data(barCode, newBarCode, this.txtRemarks.Text, this.txtGroutingUserCode.Text,goodscode);
  140. }
  141. );
  142. if (sre.Status == Constant.ServiceResultStatus.Success)
  143. {
  144. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
  145. this.DialogResult = DialogResult.OK;
  146. //this.Close();
  147. return;
  148. }
  149. if (sre.Status == Constant.ServiceResultStatus.Other)
  150. {
  151. DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, sre.Message);
  152. }
  153. }
  154. catch (Exception ex)
  155. {
  156. // 对异常进行共通处理
  157. ExceptionManager.HandleEventException(this.ToString(),
  158. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  159. }
  160. }
  161. /// <summary>
  162. /// 查询原条码
  163. /// </summary>
  164. /// <param name="sender"></param>
  165. /// <param name="e"></param>
  166. private void btnSearch_Click(object sender, EventArgs e)
  167. {
  168. try
  169. {
  170. F_PM_0202 frmPM0202 = F_PM_0202.Instance;
  171. frmPM0202.BarCode = this.txtBarCode.Text;
  172. frmPM0202.GroutingUserCode = this.txtGroutingUserCode.Text;
  173. frmPM0202.GoodsCodeText = this.txtGoodsCode.Text;
  174. DialogResult dialogResult = frmPM0202.ShowDialog();
  175. // 查询窗体返回值给控件赋值
  176. if (dialogResult == DialogResult.OK)
  177. {
  178. this.txtBarCode.Text = frmPM0202.BarCode;
  179. this.txtGoodsCode.Text = frmPM0202.GoodsCodeText;
  180. if (!string.IsNullOrWhiteSpace(this.txtBarCode.Text))
  181. {
  182. this.txtNewBarCode.Focus();
  183. }
  184. }
  185. }
  186. catch (Exception ex)
  187. {
  188. // 对异常进行共通处理
  189. ExceptionManager.HandleEventException(this.ToString(),
  190. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  191. }
  192. }
  193. /// <summary>
  194. /// 输入原条码后,新条码获得焦点
  195. /// </summary>
  196. /// <param name="sender"></param>
  197. /// <param name="e"></param>
  198. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  199. {
  200. if (e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE)
  201. {
  202. this.txtNewBarCode.Focus();
  203. }
  204. }
  205. #endregion
  206. }
  207. }