F_PM_0106.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*******************************************************************************
  2. * Copyright(c) 2015 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_0106.cs
  5. * 2.功能描述:取消最后一次注浆登记
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2020/02/18 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Reflection;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseControls;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.PMModule
  21. {
  22. /// <summary>
  23. /// 取消最后一次注浆登记
  24. /// </summary>
  25. public partial class F_PM_0106 : DKFormBase
  26. {
  27. #region 成员变量
  28. private DataSet _data = null;
  29. #endregion
  30. #region 构造函数
  31. /// <summary>
  32. /// 构造函数
  33. /// </summary>
  34. public F_PM_0106()
  35. {
  36. this.InitializeComponent();
  37. // 为各个控件文本赋值
  38. this.InitializeControls();
  39. }
  40. #endregion
  41. #region 属性
  42. /// <summary>
  43. /// 注浆日报ID
  44. /// </summary>
  45. public string GroutingLineCode
  46. {
  47. get;
  48. private set;
  49. }
  50. /// <summary>
  51. /// 是否在开模报损中使用
  52. /// </summary>
  53. public bool IsBarCodeScrapReasonUseFlag
  54. {
  55. get;
  56. set;
  57. }
  58. #endregion
  59. #region 控件事件
  60. /// <summary>
  61. /// 页面Load事件
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void F_PM_0106_Load(object sender, EventArgs e)
  66. {
  67. }
  68. /// <summary>
  69. /// 查询按钮按下事件
  70. /// </summary>
  71. /// <param name="sender"></param>
  72. /// <param name="e"></param>
  73. private void btnSearch_Click(object sender, System.EventArgs e)
  74. {
  75. string glcode = this.txtGroutingLineCode.Text.Trim();
  76. if (string.IsNullOrWhiteSpace(glcode))
  77. {
  78. MessageBox.Show("请输入成型线编码",this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  79. this.txtGroutingLineCode.Focus();
  80. return;
  81. }
  82. try
  83. {
  84. ClientRequestEntity cre = new ClientRequestEntity();
  85. cre.NameSpace = "F_PM_0106";
  86. cre.Name = "CheckFPM0106GLCode";
  87. cre.Properties["glcode"] = glcode;
  88. // 根据注浆日期、成型线获取所有可注浆模具信息
  89. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  90. {
  91. return PMModuleProxyNew.Service.HandleRequest(cre);
  92. }
  93. );
  94. // 异常情况处理
  95. if (sre.Status == Constant.ServiceResultStatus.Success)
  96. {
  97. _data = sre.Data;
  98. DataRow dataRow = _data.Tables[0].Rows[0];
  99. this.txtTextBox1.Text =
  100. $"成型线编码 :{dataRow["GroutingLineCode"]} " + Environment.NewLine + Environment.NewLine +
  101. $"最后注浆日期:{(dataRow["LastGroutingDate"] as DateTime?)?.ToString("yyyy-MM-dd")?? dataRow["LastGroutingDate"]+""} " + Environment.NewLine + Environment.NewLine +
  102. $"最后注浆批次:{dataRow["LastGroutingBatchNo"]} " + Environment.NewLine + Environment.NewLine +
  103. $"成型工号 :{dataRow["usercode"]} "
  104. ;
  105. this.btnOK.Enabled = true;
  106. return;
  107. }
  108. _data = null;
  109. this.btnOK.Enabled = false;
  110. MessageBox.Show(sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  111. }
  112. catch (Exception ex)
  113. {
  114. // 对异常进行共通处理
  115. ExceptionManager.HandleEventException(this.ToString(),
  116. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  117. }
  118. }
  119. /// <summary>
  120. /// 确定按钮按下事件
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void btnOK_Click(object sender, System.EventArgs e)
  125. {
  126. if (_data == null)
  127. {
  128. return;
  129. }
  130. try
  131. {
  132. ClientRequestEntity cre = new ClientRequestEntity();
  133. cre.NameSpace = "F_PM_0106";
  134. cre.Name = "SetFPM0106GLCode";
  135. cre.Data = _data;
  136. // 根据注浆日期、成型线获取所有可注浆模具信息
  137. ServiceResultEntity sre = this.DoAsync<ServiceResultEntity>(() =>
  138. {
  139. return PMModuleProxyNew.Service.HandleRequest(cre);
  140. }
  141. );
  142. // 异常情况处理
  143. if (sre.Status == Constant.ServiceResultStatus.Success)
  144. {
  145. DialogResult dr = MessageBox.Show("撤销成功,是否关闭画面", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  146. if (dr == DialogResult.Yes)
  147. {
  148. this.Close();
  149. }
  150. _data = null;
  151. this.txtGroutingLineCode.Clear();
  152. this.txtTextBox1.Clear();
  153. this.btnOK.Enabled = false;
  154. return;
  155. }
  156. MessageBox.Show(sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  157. }
  158. catch (Exception ex)
  159. {
  160. // 对异常进行共通处理
  161. ExceptionManager.HandleEventException(this.ToString(),
  162. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  163. }
  164. }
  165. /// <summary>
  166. /// 关闭按钮按下事件
  167. /// </summary>
  168. /// <param name="sender"></param>
  169. /// <param name="e"></param>
  170. private void btnClose_Click(object sender, System.EventArgs e)
  171. {
  172. this.DialogResult = DialogResult.Cancel;
  173. this.Close();
  174. }
  175. #endregion
  176. #region 私有方法/函数
  177. /// <summary>
  178. /// 初始化控件
  179. /// </summary>
  180. private void InitializeControls()
  181. {
  182. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  183. this.btnOK.Text = ButtonText.BTN_OK;
  184. this.btnCancel.Text = ButtonText.BTN_CANCEL;
  185. }
  186. #endregion
  187. private void txtGroutingLineCode_KeyPress(object sender, KeyPressEventArgs e)
  188. {
  189. if (e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE)
  190. {
  191. btnSearch_Click(null, null);
  192. }
  193. }
  194. }
  195. }