F_PM_2103.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2103.cs
  5. * 2.功能描述:扫描在产盘点单
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/05/14 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. /// <summary>
  24. /// 扫描在产盘点单
  25. /// </summary>
  26. public partial class F_PM_2103 : DKFormBase
  27. {
  28. #region 成员变量
  29. private int _inCheckedCount = 0; //盘点数量
  30. #endregion
  31. #region 构造函数
  32. public F_PM_2103()
  33. {
  34. InitializeComponent();
  35. this.btnClose.Text = ButtonText.BTN_CLOSE;
  36. }
  37. public F_PM_2103(int InCheckedID, string InCheckedNo)
  38. {
  39. InitializeComponent();
  40. this.dkInChecked1.InCheckedID = InCheckedID;
  41. this.dkInChecked1.Text = InCheckedNo;
  42. this.btnClose.Text = ButtonText.BTN_CLOSE;
  43. }
  44. #endregion
  45. #region 事件
  46. /// <summary>
  47. /// 回车符事件
  48. /// </summary>
  49. /// <param name="sender"></param>
  50. /// <param name="e"></param>
  51. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  52. {
  53. try
  54. {
  55. if (this.txtBarCode.ReadOnly)
  56. {
  57. return;
  58. }
  59. if ((int)e.KeyChar == 13) // 按了回车键
  60. {
  61. if (this.dkInChecked1.InCheckedID == null)
  62. {
  63. MessageBox.Show("盘点单号必须选择", this.Text,
  64. MessageBoxButtons.OK, MessageBoxIcon.Information);
  65. this.dkInChecked1.Focus();
  66. return;
  67. }
  68. if (this.txtBarCode.Text.Trim() == "")
  69. {
  70. MessageBox.Show("产品条码不能为空", this.Text,
  71. MessageBoxButtons.OK, MessageBoxIcon.Information);
  72. this.txtBarCode.Focus();
  73. return;
  74. }
  75. int returnValue = (int)DoAsync(new BaseAsyncMethod(() =>
  76. {
  77. return PMModuleProxy.Service.UpdateInChecked(Convert.ToInt32(this.dkInChecked1.InCheckedID), this.txtBarCode.Text.Trim());
  78. }));
  79. //if (returnValue == -1)
  80. //{
  81. // MessageBox.Show("盘点单号不存在需要此盘点条码", this.Text,
  82. // MessageBoxButtons.OK, MessageBoxIcon.Information);
  83. // this.txtBarCode.SelectAll();
  84. // return;
  85. //}
  86. if (returnValue == -2)
  87. {
  88. MessageBox.Show("产品" + this.txtBarCode.Text + "不在在产产品", this.Text,
  89. MessageBoxButtons.OK, MessageBoxIcon.Information);
  90. this.txtBarCode.SelectAll();
  91. return;
  92. }
  93. else if (returnValue == -22)
  94. {
  95. MessageBox.Show("产品" + this.txtBarCode.Text + "己被其他工号盘点", this.Text,
  96. MessageBoxButtons.OK, MessageBoxIcon.Information);
  97. this.txtBarCode.SelectAll();
  98. return;
  99. }
  100. else if (returnValue == -24)
  101. {
  102. MessageBox.Show("产品" + this.txtBarCode.Text + "己被此工号盘点", this.Text,
  103. MessageBoxButtons.OK, MessageBoxIcon.Information);
  104. this.txtBarCode.SelectAll();
  105. return;
  106. }
  107. else if (returnValue == -23)
  108. {
  109. MessageBox.Show("产品" + this.txtBarCode.Text + "己被其他工号盘盈", this.Text,
  110. MessageBoxButtons.OK, MessageBoxIcon.Information);
  111. this.txtBarCode.SelectAll();
  112. return;
  113. }
  114. else if (returnValue == -25)
  115. {
  116. MessageBox.Show("产品" + this.txtBarCode.Text + "己被此工号盘盈", this.Text,
  117. MessageBoxButtons.OK, MessageBoxIcon.Information);
  118. this.txtBarCode.SelectAll();
  119. return;
  120. }
  121. else if (returnValue == 0)
  122. {
  123. MessageBox.Show("产品" + this.txtBarCode.Text + "盘点失败", this.Text,
  124. MessageBoxButtons.OK, MessageBoxIcon.Information);
  125. this.txtBarCode.SelectAll();
  126. return;
  127. }
  128. else if (returnValue == 10)
  129. {
  130. MessageBox.Show("产品" + this.txtBarCode.Text + "盘盈成功", this.Text,
  131. MessageBoxButtons.OK, MessageBoxIcon.Information);
  132. this.txtBarCode.SelectAll();
  133. return;
  134. }
  135. else if (returnValue > 0)
  136. {
  137. _inCheckedCount = _inCheckedCount + 1;
  138. MessageBox.Show("产品" + this.txtBarCode.Text + "盘点成功", this.Text,
  139. MessageBoxButtons.OK, MessageBoxIcon.Information);
  140. this.txtBarCode.Text = "";//盘点成功后,直接下一个
  141. return;
  142. }
  143. }
  144. }
  145. catch (Exception ex)
  146. {
  147. // 对异常进行共通处理
  148. ExceptionManager.HandleEventException(this.ToString(),
  149. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  150. }
  151. }
  152. /// <summary>
  153. /// 窗体关闭时事件
  154. /// </summary>
  155. /// <param name="sender"></param>
  156. /// <param name="e"></param>
  157. private void F_PM_2103_FormClosing(object sender, FormClosingEventArgs e)
  158. {
  159. if (this._inCheckedCount > 0)
  160. {
  161. this.DialogResult = DialogResult.OK;
  162. }
  163. }
  164. /// <summary>
  165. /// 条码获得焦点
  166. /// </summary>
  167. /// <param name="sender"></param>
  168. /// <param name="e"></param>
  169. private void F_PM_2103_Shown(object sender, EventArgs e)
  170. {
  171. if (this.dkInChecked1.InCheckedID > 0)
  172. {
  173. this.txtBarCode.Focus();
  174. }
  175. }
  176. #endregion
  177. }
  178. }