F_RPT_040114.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. 
  2. /*******************************************************************************
  3. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  4. * 类的信息:
  5. * 1.程序名称:F_RPT_040114.cs
  6. * 2.功能描述:综合合格率分析表-恒洁三水(定制)
  7. * 编辑履历:
  8. * 作者 日期 版本 修改内容
  9. * 陈晓野 2019/07/16 1.00 新建
  10. *******************************************************************************/
  11. using System;
  12. using System.Windows.Forms;
  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.Client.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.Proxys;
  19. namespace Dongke.IBOSS.PRD.Client.ReportModule
  20. {
  21. /// <summary>
  22. /// 综合合格率分析表-恒洁三水(定制)
  23. /// </summary>
  24. public partial class F_RPT_040114 : DKDockPanelBase
  25. {
  26. #region 成员变量
  27. // 窗体的单例模式
  28. private static F_RPT_040114 _instance;
  29. private ClientRequestEntity _cre = null;
  30. private bool _init = false;
  31. #endregion
  32. #region 构造函数
  33. public F_RPT_040114()
  34. {
  35. InitializeComponent();
  36. // 窗体显示的Title
  37. this.Text = "综合合格率分析表";
  38. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  39. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  40. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  41. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  42. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  43. }
  44. #endregion
  45. #region 单例模式
  46. /// <summary>
  47. /// 单例模式,防止重复创建窗体
  48. /// </summary>
  49. public static F_RPT_040114 Instance
  50. {
  51. get
  52. {
  53. if (_instance == null || _instance.IsDisposed)
  54. {
  55. _instance = new F_RPT_040114();
  56. }
  57. return _instance;
  58. }
  59. }
  60. #endregion
  61. #region 事件处理
  62. /// <summary>
  63. /// 窗体加载事件
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void F_RPT_040114_Load(object sender, EventArgs e)
  68. {
  69. try
  70. {
  71. // 加载权限
  72. FormPermissionManager.FormPermissionControl(this.Name, this,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  74. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  75. // 设置表格不自动创建列
  76. this.dgvRpt.AutoGenerateColumns = false;
  77. this.dgvRpt2.AutoGenerateColumns = false;
  78. // 初始化时间控件为当前日期
  79. DateTime d = DateTime.Now;
  80. this.dtpAccountDateStart.Value = new DateTime(d.Year, d.Month, 1);
  81. this.dtpAccountDateEnd.Value = this.dtpAccountDateStart.Value.AddMonths(1).AddDays(-1);
  82. }
  83. catch (Exception ex)
  84. {
  85. // 对异常进行共通处理
  86. ExceptionManager.HandleEventException(this.ToString(),
  87. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  88. }
  89. }
  90. /// <summary>
  91. /// 自动适应列宽
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  96. {
  97. this.dgvRpt.AutoResizeColumns();
  98. this.dgvRpt2.AutoResizeColumns();
  99. }
  100. /// <summary>
  101. /// 窗体关闭事件
  102. /// </summary>
  103. /// <param name="sender"></param>
  104. /// <param name="e"></param>
  105. private void F_RPT_040114_FormClosed(object sender, FormClosedEventArgs e)
  106. {
  107. _instance = null;
  108. }
  109. /// <summary>
  110. /// 关闭按钮
  111. /// </summary>
  112. /// <param name="sender"></param>
  113. /// <param name="e"></param>
  114. private void tsbtnClose_Click(object sender, EventArgs e)
  115. {
  116. this.Close();
  117. }
  118. /// <summary>
  119. /// 查询按钮事件
  120. /// </summary>
  121. /// <param name="sender"></param>
  122. /// <param name="e"></param>
  123. private void btnSearch_Click(object sender, EventArgs e)
  124. {
  125. try
  126. {
  127. _init = true;
  128. if (this.tabControl1.SelectedIndex == 0)
  129. {
  130. this.dgvRpt.DataSource = null;
  131. _cre = new ClientRequestEntity();
  132. _cre.NameSpace = "R04";
  133. _cre.Name = "R040114_1";
  134. _cre.Properties["datebegin"] = this.dtpAccountDateStart.Value.Date;
  135. _cre.Properties["dateend"] = this.dtpAccountDateEnd.Value.Date.AddDays(1);
  136. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  137. {
  138. return ReportModuleProxy.Service.DoRequest(_cre);
  139. });
  140. if (resultEntity != null && resultEntity.Data != null &&
  141. resultEntity.Data.Tables.Count > 0)
  142. {
  143. this.dgvRpt.DataSource = resultEntity.Data.Tables[0];
  144. }
  145. }
  146. if (this.tabControl1.SelectedIndex == 1)
  147. {
  148. this.dgvRpt2.DataSource = null;
  149. _cre = new ClientRequestEntity();
  150. _cre.NameSpace = "R04";
  151. _cre.Name = "R040114_2";
  152. _cre.Properties["datebegin"] = this.dtpAccountDateStart.Value.Date;
  153. _cre.Properties["dateend"] = this.dtpAccountDateEnd.Value.Date.AddDays(1);
  154. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  155. {
  156. return ReportModuleProxy.Service.DoRequest(_cre);
  157. });
  158. if (resultEntity != null && resultEntity.Data != null &&
  159. resultEntity.Data.Tables.Count > 0)
  160. {
  161. this.dgvRpt2.DataSource = resultEntity.Data.Tables[0];
  162. }
  163. }
  164. }
  165. catch (Exception ex)
  166. {
  167. this.btnSearch.Enabled = true;
  168. this.btnClearCondition.Enabled = true;
  169. // 对异常进行共通处理
  170. ExceptionManager.HandleEventException(this.ToString(),
  171. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  172. }
  173. finally
  174. {
  175. _init = false;
  176. }
  177. }
  178. /// <summary>
  179. /// 清空条件按钮事件
  180. /// </summary>
  181. /// <param name="sender"></param>
  182. /// <param name="e"></param>
  183. private void btnClearCondition_Click(object sender, EventArgs e)
  184. {
  185. DateTime d = DateTime.Now;
  186. this.dtpAccountDateStart.Value = new DateTime(d.Year, d.Month, 1);
  187. this.dtpAccountDateEnd.Value = this.dtpAccountDateStart.Value.AddMonths(1).AddDays(-1);
  188. }
  189. #endregion
  190. #region 私有方法
  191. #endregion
  192. }
  193. }