F_PM_2403.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*******************************************************************************
  2. * Copyright(c) 2017 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_2403.cs
  5. * 2.功能描述:撤销产成品交接
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2017/02/10 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_2403 : DKFormBase
  27. {
  28. #region 成员变量
  29. private string _currentbarcode = "";//当前产品条码
  30. #endregion
  31. #region 构造函数
  32. public F_PM_2403()
  33. {
  34. InitializeComponent();
  35. this.btnClose.Text = ButtonText.BTN_CLOSE;
  36. this.btnSave.Text = ButtonText.BTN_SAVE;
  37. this.Text = FormTitles.F_PM_2403;
  38. }
  39. #endregion
  40. #region 事件
  41. /// <summary>
  42. /// 保存按钮事件
  43. /// </summary>
  44. /// <param name="sender"></param>
  45. /// <param name="e"></param>
  46. private void btnSave_Click(object sender, EventArgs e)
  47. {
  48. try
  49. {
  50. if (this._currentbarcode.Trim() == "")
  51. {
  52. MessageBox.Show("产品条码不能为空", this.Text,
  53. MessageBoxButtons.OK, MessageBoxIcon.Information);
  54. this.txtBarCode.Focus();
  55. return;
  56. }
  57. ServiceResultEntity returnValue = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  58. {
  59. return PMModuleProxy.Service.SaveCancelFinishedHandoverByBarcode(this._currentbarcode.Trim());
  60. }));
  61. if (Convert.ToInt32(returnValue.Result) < 0)
  62. {
  63. MessageBox.Show(returnValue.Message, this.Text,
  64. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  65. this.txtBarCode.Focus();
  66. this.txtBarCode.SelectAll();
  67. return;
  68. }
  69. else if (Convert.ToInt32(returnValue.Result) > 0)
  70. {
  71. MessageBox.Show("产成品交接撤销成功", this.Text,
  72. MessageBoxButtons.OK, MessageBoxIcon.Information);
  73. this.txtBarCode.Text = "";//成功后,直接下一个
  74. this._currentbarcode = "";
  75. this.btnSave.Visible = false;
  76. this.txtProductionInfo.Text = "";
  77. this.txtBarCode.Focus();
  78. return;
  79. }
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  86. }
  87. }
  88. /// <summary>
  89. /// 回车符事件
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  94. {
  95. try
  96. {
  97. if (this.txtBarCode.ReadOnly)
  98. {
  99. return;
  100. }
  101. if ((int)e.KeyChar == 13) // 按了回车键
  102. {
  103. this.btnSave.Visible = false;
  104. this.txtProductionInfo.Text = "";
  105. if (this.txtBarCode.Text.Trim() == "")
  106. {
  107. MessageBox.Show("产品条码不能为空", this.Text,
  108. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  109. this.txtBarCode.Focus();
  110. return;
  111. }
  112. //this._currentbarcode = this.txtBarCode.Text.Trim();
  113. // 由产品条码获取注浆信息
  114. ServiceResultEntity entity = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  115. {
  116. return PMModuleProxy.Service.CancelFinishedHandoverBarcode(this.txtBarCode.Text.Trim());
  117. }));
  118. if (Convert.ToInt32(entity.Result) > 0)
  119. {
  120. this._currentbarcode = entity.Data.Tables[0].Rows[0]["BarCode"].ToString();
  121. this.txtProductionInfo.Text = "生产订单:" + entity.Data.Tables[0].Rows[0]["OrderNo"] + "\r\n\r\n";
  122. this.txtProductionInfo.Text += "产品条码:" + this._currentbarcode + "\r\n\r\n";
  123. this.txtProductionInfo.Text += "包装条码:" + entity.Data.Tables[0].Rows[0]["FinishedBarCode"] + "\r\n\r\n";
  124. this.txtProductionInfo.Text += "产品编码:" + entity.Data.Tables[0].Rows[0]["GoodsCode"] + "\r\n\r\n";
  125. this.txtProductionInfo.Text += "产品商标:" + entity.Data.Tables[0].Rows[0]["LogoName"] + "\r\n\r\n";
  126. this.txtProductionInfo.Text += "成型工号:" + entity.Data.Tables[0].Rows[0]["GroutingUserCode"] + "\r\n\r\n";
  127. this.txtProductionInfo.Text += "模具编号:" + entity.Data.Tables[0].Rows[0]["GroutingMouldCode"] + "\r\n\r\n";
  128. this.txtProductionInfo.Text += "注浆日期:" + Convert.ToDateTime(entity.Data.Tables[0].Rows[0]["GroutingDate"]).ToString("yyyy-MM-dd") + "\r\n\r\n";
  129. this.txtProductionInfo.Text += "交坯日期:" + Convert.ToDateTime(entity.Data.Tables[0].Rows[0]["DeliverTime"]).ToString("yyyy-MM-dd hh:mm:ss") + "\r\n\r\n";
  130. this.btnSave.Visible = true;
  131. }
  132. else
  133. {
  134. MessageBox.Show(entity.Message, this.Text,
  135. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  136. this.txtBarCode.SelectAll();
  137. return;
  138. }
  139. }
  140. }
  141. catch (Exception ex)
  142. {
  143. // 对异常进行共通处理
  144. ExceptionManager.HandleEventException(this.ToString(),
  145. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  146. }
  147. }
  148. #endregion
  149. }
  150. }