F_PM_3103.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_3103.cs
  5. * 2.功能描述:注浆确定
  6. * 编辑履历:
  7. * 作者 日期 版本
  8. *******************************************************************************/
  9. using System;
  10. using System.Data;
  11. using System.Windows.Forms;
  12. using Dongke.IBOSS.PRD.Basics.BaseResources;
  13. using Dongke.IBOSS.PRD.Basics.DockPanel;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.WCF.DataModels;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. namespace Dongke.IBOSS.PRD.Client.PMModule
  18. {
  19. /// <summary>
  20. /// 注浆确定
  21. /// </summary>
  22. public partial class F_PM_3103 : DockPanelBase
  23. {
  24. #region 成员变量
  25. private static F_PM_3103 _instance; //单例模式
  26. #endregion
  27. #region 构造函数
  28. /// <summary>
  29. /// 注浆确定
  30. /// </summary>
  31. private F_PM_3103()
  32. {
  33. InitializeComponent();
  34. this.Text = "注浆确定";
  35. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  36. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  37. this.cbSelectTime.Checked = true;
  38. this.txtDateStart.Value = DateTime.Now.Date.AddDays(-1);
  39. this.txtDateEnd.Value = DateTime.Now.Date;
  40. }
  41. #endregion
  42. #region 单例模式
  43. /// <summary>
  44. /// 单例模式,防止重复创建窗体
  45. /// </summary>
  46. public static F_PM_3103 Instance
  47. {
  48. get
  49. {
  50. if (_instance == null)
  51. {
  52. _instance = new F_PM_3103();
  53. }
  54. return _instance;
  55. }
  56. }
  57. #endregion
  58. #region 事件
  59. /// <summary>
  60. /// 窗体加载
  61. /// </summary>
  62. /// <param name="sender"></param>
  63. /// <param name="e"></param>
  64. private void F_PM_3103_Load(object sender, EventArgs e)
  65. {
  66. try
  67. {
  68. this.dgvScrapProduct.AutoGenerateColumns = false;
  69. }
  70. catch (Exception ex)
  71. {
  72. // 对异常进行共通处理
  73. ExceptionManager.HandleEventException(this.ToString(),
  74. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  75. }
  76. }
  77. /// <summary>
  78. /// 查询事件
  79. /// </summary>
  80. /// <param name="sender"></param>
  81. /// <param name="e"></param>
  82. private void btnSearch_Click(object sender, EventArgs e)
  83. {
  84. try
  85. {
  86. DataSet dsScrapProduct = (DataSet)DoAsync(new AsyncMethod(() =>
  87. {
  88. return this.GetScrapProduct();
  89. }));
  90. if (dsScrapProduct != null)
  91. {
  92. if (dsScrapProduct.Tables[0].Rows.Count != Constant.INT_IS_ZERO)
  93. {
  94. this.dgvScrapProduct.DataSource = ((DataSet)dsScrapProduct).Tables[Constant.INT_IS_ZERO];
  95. this.dgvScrapProduct.ReadOnly = true;
  96. }
  97. else
  98. {
  99. this.dgvScrapProduct.DataSource = null;
  100. // 提示未查找到数据
  101. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  102. MessageBoxButtons.OK, MessageBoxIcon.Information);
  103. }
  104. }
  105. else
  106. {
  107. this.dgvScrapProduct.DataSource = null;
  108. // 提示未查找到数据
  109. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  110. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  111. }
  112. }
  113. catch (Exception ex)
  114. {
  115. // 对异常进行共通处理
  116. ExceptionManager.HandleEventException(this.ToString(),
  117. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  118. }
  119. }
  120. /// <summary>
  121. /// 抽查按钮点击事件
  122. /// </summary>
  123. /// <param name="sender"></param>
  124. /// <param name="e"></param>
  125. private void tsbtnSuspend_Click(object sender, EventArgs e)
  126. {
  127. // 抽查
  128. F_PM_3102 frm3102 = new F_PM_3102();
  129. DialogResult dialogResult = frm3102.ShowDialog();
  130. }
  131. /// <summary>
  132. /// 时间有效性切换
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void cbSelectTime_CheckedChanged(object sender, EventArgs e)
  137. {
  138. this.txtDateStart.Enabled = this.cbSelectTime.Checked;
  139. this.txtDateEnd.Enabled = this.cbSelectTime.Checked;
  140. }
  141. /// <summary>
  142. /// 清空条件
  143. /// </summary>
  144. /// <param name="sender"></param>
  145. /// <param name="e"></param>
  146. private void btnClearCondition_Click(object sender, EventArgs e)
  147. {
  148. this.txtBarCode.Text = "";
  149. this.cbSelectTime.Checked = true;
  150. this.txtDateStart.Value = DateTime.Now.Date.AddDays(-1);
  151. this.txtDateEnd.Value = DateTime.Now.Date;
  152. }
  153. /// <summary>
  154. /// 关闭一览窗体
  155. /// </summary>
  156. /// <param name="sender"></param>
  157. /// <param name="e"></param>
  158. private void tsbtnClose_Click(object sender, EventArgs e)
  159. {
  160. this.Close();
  161. }
  162. /// <summary>
  163. /// 窗体关闭事件
  164. /// </summary>
  165. /// <param name="sender"></param>
  166. /// <param name="e"></param>
  167. private void F_PM_3103_FormClosed(object sender, FormClosedEventArgs e)
  168. {
  169. _instance = null;
  170. }
  171. /// <summary>
  172. /// 自动列宽
  173. /// </summary>
  174. /// <param name="sender"></param>
  175. /// <param name="e"></param>
  176. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  177. {
  178. this.dgvScrapProduct.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  179. }
  180. #endregion
  181. #region 私有方法
  182. /// <summary>
  183. /// 根据界面查询条件获取数据集
  184. /// </summary>
  185. private DataSet GetScrapProduct()
  186. {
  187. try
  188. {
  189. ClientRequestEntity cre = new ClientRequestEntity();
  190. cre.NameSpace = "F_PM_3103";
  191. cre.Name = "GetAllGROUTINGCHECK";
  192. cre.Properties["usercode"] = txtBarCode.Text.Trim();
  193. if (this.cbSelectTime.Checked == true)
  194. {
  195. cre.Properties["startdata"] = this.txtDateStart.Value.ToString("yyyy-MM-dd");
  196. cre.Properties["enddata"] = this.txtDateEnd.Value.ToString("yyyy-MM-dd");
  197. }
  198. ServiceResultEntity result = PMModuleProxyNew.Service.HandleRequest(cre);
  199. return result.Data;
  200. }
  201. catch (Exception ex)
  202. {
  203. throw ex;
  204. }
  205. }
  206. #endregion
  207. }
  208. }