F_PM_3102.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3102.cs
  5. * 2.功能描述:品保抽查操作页面
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2019/05/10 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  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_3102 : DKFormBase
  25. {
  26. #region 成员变量
  27. private const string F_INFO = "产品编码:{0}\r\n\r\n注浆日期:{1:yyyy-MM-dd}\r\n\r\n模具编号:{2}\r\n\r\n成型工号:{3}\r\n\r\n当前工序:{4}";
  28. #endregion
  29. #region 构造函数
  30. /// <summary>
  31. /// 品保抽查操作页面
  32. /// </summary>
  33. public F_PM_3102()
  34. {
  35. InitializeComponent();
  36. // 控件赋值
  37. this.Text = "品保抽查";
  38. this.btnSave.Text = ButtonText.BTN_SAVE;
  39. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  40. }
  41. #endregion
  42. #region 事件
  43. /// <summary>
  44. /// 窗体加载
  45. /// </summary>
  46. /// <param name="sender"></param>
  47. /// <param name="e"></param>
  48. private void F_PM_3102_Load(object sender, EventArgs e)
  49. {
  50. try
  51. {
  52. }
  53. catch (Exception ex)
  54. {
  55. // 对异常进行共通处理
  56. ExceptionManager.HandleEventException(this.ToString(),
  57. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  58. }
  59. }
  60. /// <summary>
  61. /// 条码按键事件
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void txtBarCode_KeyPress(object sender, KeyPressEventArgs e)
  66. {
  67. try
  68. {
  69. if ((int)e.KeyChar == 13) // 按了回车键
  70. {
  71. //this.btnSave.Visible = false;
  72. string barCode = this.txtBarCode.Text.Trim();
  73. if (string.IsNullOrEmpty(barCode))
  74. {
  75. MessageBox.Show("产品条码不能为空", this.Text,
  76. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  77. this.txtBarCode.Focus();
  78. return;
  79. }
  80. // 异步处理,验证挂起条码
  81. ClientRequestEntity cre = new ClientRequestEntity();
  82. cre.NameSpace = "QASpotCheck";
  83. cre.Name = "CheckQASpotCheck";
  84. cre.Request = barCode;
  85. // 调用服务器端获取数据集
  86. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  87. {
  88. return PMModuleProxyNew.Service.HandleRequest(cre);
  89. }));
  90. if (sre.Data != null && sre.Data.Tables[0].Rows.Count > 0)
  91. {
  92. DataRow dataRow = sre.Data.Tables[0].Rows[0];
  93. this.txtInfo.Text = string.Format(F_INFO,
  94. dataRow["goodscode"],
  95. dataRow["groutingdate"],
  96. dataRow["groutingmouldcode"],
  97. dataRow["usercode"],
  98. dataRow["procedurename"]);
  99. this.txtInfo.Tag = dataRow;
  100. this.btnSave.Visible = true;
  101. this.txtRemarks.Focus();
  102. }
  103. else
  104. {
  105. this.txtInfo.Text = null;
  106. this.txtInfo.Tag = null;
  107. MessageBox.Show(sre.Message, this.Text,
  108. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  109. this.txtBarCode.SelectAll();
  110. return;
  111. }
  112. }
  113. }
  114. catch (Exception ex)
  115. {
  116. // 对异常进行共通处理
  117. ExceptionManager.HandleEventException(this.ToString(),
  118. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  119. }
  120. }
  121. /// <summary>
  122. /// 保存按钮点击事件
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void btnSave_Click(object sender, EventArgs e)
  127. {
  128. try
  129. {
  130. DataRow dataRow = this.txtInfo.Tag as DataRow;
  131. if (dataRow == null)
  132. {
  133. return;
  134. }
  135. ClientRequestEntity cre = new ClientRequestEntity();
  136. cre.NameSpace = "QASpotCheck";
  137. cre.Name = "SaveQASpotCheck";
  138. cre.Properties["GroutingDailyDetailID"] = dataRow["GroutingDailyDetailID"];
  139. cre.Properties["Remarks"] = this.txtRemarks.Text.Trim();
  140. cre.Properties["ProcedureID"] = dataRow["ProcedureID"];
  141. cre.Properties["ProcedureName"] = dataRow["ProcedureName"];
  142. cre.Properties["CheckTime"] = dataRow["CheckTime"];
  143. // 异步处理
  144. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
  145. {
  146. return PMModuleProxyNew.Service.HandleRequest(cre);
  147. }));
  148. if (Convert.ToInt32(sre.Result) < 0)
  149. {
  150. MessageBox.Show(sre.Message,
  151. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  152. return;
  153. }
  154. else
  155. {
  156. // 提示信息
  157. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
  158. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  159. this.btnSave.Visible = false;
  160. this.Close();
  161. }
  162. }
  163. catch (Exception ex)
  164. {
  165. // 对异常进行共通处理
  166. ExceptionManager.HandleEventException(this.ToString(),
  167. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  168. }
  169. }
  170. /// <summary>
  171. /// 关闭按钮点击事件
  172. /// </summary>
  173. /// <param name="sender"></param>
  174. /// <param name="e"></param>
  175. private void btnCancel_Click(object sender, EventArgs e)
  176. {
  177. this.Close();
  178. }
  179. #endregion
  180. }
  181. }