F_PM_2603.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2603.cs
  5. * 2.功能描述:扫描注浆盘点单
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2015/05/14 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Basics.BaseControls;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.Client.Controls;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PMModule
  19. {
  20. /// <summary>
  21. /// 扫描注浆盘点单
  22. /// </summary>
  23. public partial class F_PM_2603 : DKFormBase
  24. {
  25. #region 成员变量
  26. private int _inCheckedCount = 0; //盘点数量
  27. #endregion
  28. #region 构造函数
  29. public F_PM_2603()
  30. {
  31. InitializeComponent();
  32. this.btnClose.Text = ButtonText.BTN_CLOSE;
  33. }
  34. public F_PM_2603(int checkedID, string checkedNo)
  35. {
  36. InitializeComponent();
  37. this.dkInChecked1.InCheckedID = checkedID;
  38. this.dkInChecked1.Text = checkedNo;
  39. this.btnClose.Text = ButtonText.BTN_CLOSE;
  40. }
  41. #endregion
  42. #region 事件
  43. /// <summary>
  44. /// 回车符事件
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  49. {
  50. try
  51. {
  52. if (this.txtBarCode.ReadOnly)
  53. {
  54. return;
  55. }
  56. if ((int)e.KeyChar == 13) // 按了回车键
  57. {
  58. if (this.dkInChecked1.InCheckedID == null)
  59. {
  60. MessageBox.Show("盘点单号必须选择", this.Text,
  61. MessageBoxButtons.OK, MessageBoxIcon.Information);
  62. this.dkInChecked1.Focus();
  63. return;
  64. }
  65. if (this.txtBarCode.Text.Trim() == "")
  66. {
  67. MessageBox.Show("产品条码不能为空", this.Text,
  68. MessageBoxButtons.OK, MessageBoxIcon.Information);
  69. this.txtBarCode.Focus();
  70. return;
  71. }
  72. ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  73. {
  74. ClientRequestEntity cre = new ClientRequestEntity();
  75. cre.NameSpace = "GBChecked";
  76. cre.Name = "UpdateGBChecked";
  77. cre.Properties["CheckedID"] = Convert.ToInt32(this.dkInChecked1.InCheckedID);
  78. cre.Properties["Barcode"] = this.txtBarCode.Text.Trim();
  79. return PMModuleProxyNew.Service.HandleRequest(cre);
  80. }));
  81. if (returnValue == null)
  82. {
  83. MessageBox.Show("盘点失败", this.Text,
  84. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  85. this.txtBarCode.Focus();
  86. this.txtBarCode.SelectAll();
  87. }
  88. else if (returnValue.Status == Constant.ServiceResultStatus.Success)
  89. {
  90. _inCheckedCount = _inCheckedCount + 1;
  91. MessageBox.Show("产品" + this.txtBarCode.Text + "盘点成功", this.Text,
  92. MessageBoxButtons.OK, MessageBoxIcon.Information);
  93. this.txtBarCode.Text = "";
  94. this.txtBarCode.Focus();
  95. }
  96. else if (returnValue.Status == Constant.ServiceResultStatus.Other)
  97. {
  98. MessageBox.Show(returnValue.Message, this.Text,
  99. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  100. this.txtBarCode.Focus();
  101. this.txtBarCode.SelectAll();
  102. }
  103. }
  104. }
  105. catch (Exception ex)
  106. {
  107. // 对异常进行共通处理
  108. ExceptionManager.HandleEventException(this.ToString(),
  109. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  110. }
  111. }
  112. /// <summary>
  113. /// 窗体关闭时事件
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void F_PM_2103_FormClosing(object sender, FormClosingEventArgs e)
  118. {
  119. if (this._inCheckedCount > 0)
  120. {
  121. this.DialogResult = DialogResult.OK;
  122. }
  123. }
  124. /// <summary>
  125. /// 条码获得焦点
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void F_PM_2103_Shown(object sender, EventArgs e)
  130. {
  131. if (this.dkInChecked1.InCheckedID > 0)
  132. {
  133. this.txtBarCode.Focus();
  134. }
  135. }
  136. #endregion
  137. }
  138. }