F_RPT_040101_1.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_040101_1.cs
  5. * 2.功能描述:注浆交坯比率分析表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/4/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  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_040101_1 : DKDockPanelBase
  25. {
  26. #region 成员变量
  27. // 窗体的单例模式
  28. private static F_RPT_040101_1 _instance;
  29. #endregion
  30. #region 构造函数
  31. public F_RPT_040101_1()
  32. {
  33. InitializeComponent();
  34. // 窗体显示的Title
  35. this.Text = FormTitles.F_RPT_040101;
  36. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  37. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  38. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  39. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  40. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  41. }
  42. #endregion
  43. #region 单例模式
  44. /// <summary>
  45. /// 单例模式,防止重复创建窗体
  46. /// </summary>
  47. public static F_RPT_040101_1 Instance
  48. {
  49. get
  50. {
  51. if (_instance == null || _instance.IsDisposed)
  52. {
  53. _instance = new F_RPT_040101_1();
  54. }
  55. return _instance;
  56. }
  57. }
  58. #endregion
  59. #region 事件处理
  60. /// <summary>
  61. /// 窗体加载事件
  62. /// </summary>
  63. /// <param name="sender"></param>
  64. /// <param name="e"></param>
  65. private void F_RPT_040101_1_Load(object sender, EventArgs e)
  66. {
  67. try
  68. {
  69. // 加载权限
  70. FormPermissionManager.FormPermissionControl(this.Name, this,
  71. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  72. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  73. // 设置表格不自动创建列
  74. this.dgvGroutingAdobeTotal.AutoGenerateColumns = false;
  75. this.scbGoodsType.Focus();
  76. // 初始化时间控件为当前日期
  77. //this.dtpAccountDateStart.Value = DateTime.Now.Date;
  78. //this.dtpAccountDateEnd.Value = DateTime.Now.Date;
  79. btnClearCondition_Click(null, null);
  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 F_RPT_040101_1_FormClosed(object sender, FormClosedEventArgs e)
  94. {
  95. _instance = null;
  96. }
  97. /// <summary>
  98. /// 关闭按钮
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void tsbtnClose_Click(object sender, EventArgs e)
  103. {
  104. this.Close();
  105. }
  106. /// <summary>
  107. /// 自动适应列宽
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  112. {
  113. this.dgvGroutingAdobeTotal.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  114. }
  115. /// <summary>
  116. /// 查询按钮事件
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void btnSearch_Click(object sender, EventArgs e)
  121. {
  122. try
  123. {
  124. if (!this.chkGDate.Checked && !this.chkGCTime.Checked)
  125. {
  126. MessageBox.Show("查询条件【注浆日期】或【注浆操作时间】必须选择一个。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  127. return;
  128. }
  129. this.dgvGroutingAdobeTotal.DataSource = null;
  130. this.dgvGroutingAdobeTotal.DataSource = this.GetSearchData();
  131. if (this.chkMonitor.Checked)
  132. {
  133. UserCode.HeaderText = "成型班长";
  134. }
  135. else
  136. {
  137. UserCode.HeaderText = "成型工号";
  138. }
  139. }
  140. catch (Exception ex)
  141. {
  142. this.btnSearch.Enabled = true;
  143. // 对异常进行共通处理
  144. ExceptionManager.HandleEventException(this.ToString(),
  145. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  146. }
  147. }
  148. /// <summary>
  149. /// 清空条件按钮事件
  150. /// </summary>
  151. /// <param name="sender"></param>
  152. /// <param name="e"></param>
  153. private void btnClearCondition_Click(object sender, EventArgs e)
  154. {
  155. this.scbGoods.ClearValue();
  156. this.scbGoodsType.ClearValue();
  157. this.scbGroutingLine.ClearValue();
  158. this.dkUserInfoSearchBox.ClearControl();
  159. this.txtDateDifference.Text = "0";
  160. this.chkGDate.Checked = true;
  161. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  162. this.dtpAccountDateEnd.Value = DateTime.Now.Date;
  163. this.chkGCTime.Checked = false;
  164. this.dtpGCTimeBegin.Value = DateTime.Now.Date;
  165. this.dtpGCTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  166. }
  167. #endregion
  168. #region 私有方法
  169. /// <summary>
  170. /// 根据界面查询条件获取数据集
  171. /// </summary>
  172. private DataTable GetSearchData()
  173. {
  174. try
  175. {
  176. RPT040101_SE se = new RPT040101_SE();
  177. if (string.IsNullOrEmpty(this.txtDateDifference.Text.Trim()))
  178. {
  179. this.txtDateDifference.Text = "0";
  180. }
  181. se.GoodsIDS = scbGoods.CheckedPKMember;
  182. se.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  183. se.GroutingLineIDS = this.scbGroutingLine.CheckedPKMember;
  184. se.UserIDS = this.dkUserInfoSearchBox.UserIDS;
  185. se.DateDifference = Convert.ToInt32(this.txtDateDifference.Text.Trim());
  186. if (this.chkGDate.Checked)
  187. {
  188. se.GroutingDateStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0");
  189. se.GroutingDateEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  190. }
  191. if(this.chkGCTime.Checked)
  192. {
  193. se.GCTimeBegin = this.dtpGCTimeBegin.Value;
  194. se.GCTimeEnd = this.dtpGCTimeEnd.Value;
  195. }
  196. se.IsMonitor = this.chkMonitor.Checked;
  197. // 调用服务器端获取数据集
  198. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  199. {
  200. return ReportModuleProxy.Service.GetRPT040101SData(se);
  201. }
  202. );
  203. if (sre.Status == Constant.ServiceResultStatus.Success)
  204. {
  205. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  206. {
  207. // 提示未查找到数据
  208. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  209. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  210. //清空数据
  211. return null;
  212. }
  213. return sre.Data.Tables[0];
  214. }
  215. return null;
  216. }
  217. catch (Exception ex)
  218. {
  219. throw ex;
  220. }
  221. }
  222. #endregion
  223. private void chkGDate_CheckedChanged(object sender, EventArgs e)
  224. {
  225. dtpAccountDateStart.Enabled = this.chkGDate.Checked;
  226. dtpAccountDateEnd.Enabled = this.chkGDate.Checked;
  227. }
  228. private void chkGCTime_CheckedChanged(object sender, EventArgs e)
  229. {
  230. dtpGCTimeBegin.Enabled = this.chkGCTime.Checked;
  231. dtpGCTimeEnd.Enabled = this.chkGCTime.Checked;
  232. }
  233. }
  234. }