F_RPT_080106.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080106.cs
  5. * 2.功能描述:温湿计明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/06/21 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  18. using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
  19. using Dongke.IBOSS.PRD.Client.CommonModule;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. /// <summary>
  24. /// 温湿计明细表
  25. /// </summary>
  26. public partial class F_RPT_080106 : DockPanelBase
  27. {
  28. #region 成员变量
  29. //单例模式
  30. private static F_RPT_080106 _instance;
  31. #endregion
  32. #region 构造函数
  33. public F_RPT_080106()
  34. {
  35. InitializeComponent();
  36. }
  37. #endregion
  38. #region 单例模式
  39. /// <summary>
  40. /// 单例模式,防止重复创建窗体
  41. /// </summary>
  42. public static F_RPT_080106 Instance
  43. {
  44. get
  45. {
  46. if (_instance == null)
  47. {
  48. _instance = new F_RPT_080106();
  49. }
  50. return _instance;
  51. }
  52. }
  53. #endregion
  54. #region 事件
  55. /// <summary>
  56. /// 窗体加载
  57. /// </summary>
  58. private void F_RPT_080106_Load(object sender, EventArgs e)
  59. {
  60. // 加载权限
  61. FormPermissionManager.FormPermissionControl(this.Name, this,
  62. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  63. Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  64. this.dgvCelsiusRecord.AutoGenerateColumns = false;
  65. this.Text = FormTitles.F_RPT_080106;
  66. }
  67. /// <summary>
  68. /// 获取数据
  69. /// </summary>
  70. private void btnSearch_Click(object sender, System.EventArgs e)
  71. {
  72. try
  73. {
  74. ServiceResultEntity resultEntity = (ServiceResultEntity)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  75. {
  76. return this.GetCelsiusRecord();
  77. }));
  78. if (resultEntity.Data != null)
  79. {
  80. if (resultEntity.Data.Tables.Count != Constant.INT_IS_ZERO)
  81. {
  82. this.dgvCelsiusRecord.DataSource = ((DataSet)resultEntity.Data).Tables[Constant.INT_IS_ZERO];
  83. this.dgvCelsiusRecord.ReadOnly = true;
  84. if (this.dgvCelsiusRecord.Rows.Count == Constant.INT_IS_ZERO)
  85. {
  86. // 提示未查找到数据
  87. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  88. MessageBoxButtons.OK, MessageBoxIcon.Information);
  89. }
  90. }
  91. }
  92. else
  93. {
  94. this.dgvCelsiusRecord.DataSource = null;
  95. // 提示未查找到数据
  96. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  97. MessageBoxButtons.OK, MessageBoxIcon.Information);
  98. }
  99. }
  100. catch (Exception ex)
  101. {
  102. // 对异常进行共通处理
  103. ExceptionManager.HandleEventException(this.ToString(),
  104. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  105. }
  106. }
  107. /// <summary>
  108. /// 清空条件
  109. /// </summary>
  110. private void btnClearCondition_Click(object sender, EventArgs e)
  111. {
  112. this.txtRemarks.Text = "";
  113. this.dkThermometer.Text = "";
  114. this.dkThermometer.ThermometerID = null;
  115. this.txtRecordDateStart.Value = DateTime.Now;
  116. this.txtRecordDateEnd.Value = DateTime.Now;
  117. }
  118. /// <summary>
  119. /// 窗体关闭
  120. /// </summary>
  121. /// <param name="sender"></param>
  122. /// <param name="e"></param>
  123. private void F_PM_1701_FormClosed(object sender, FormClosedEventArgs e)
  124. {
  125. _instance = null;
  126. }
  127. /// <summary>
  128. /// 关闭按钮事件
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void tsbtnClose_Click(object sender, EventArgs e)
  133. {
  134. this.Close();
  135. }
  136. /// <summary>
  137. /// 自动列宽事件
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  142. {
  143. this.dgvCelsiusRecord.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  144. }
  145. #endregion
  146. #region 私有方法
  147. /// <summary>
  148. /// 根据界面查询条件获取数据集
  149. /// </summary>
  150. private ServiceResultEntity GetCelsiusRecord()
  151. {
  152. try
  153. {
  154. CelsiusRecordEntity crEntity = new CelsiusRecordEntity();
  155. if (this.dkThermometer.ThermometerID != null)
  156. {
  157. crEntity.ThermometerID = this.dkThermometer.ThermometerID;
  158. }
  159. crEntity.RecordDate = this.txtRecordDateStart.Value.Date;
  160. crEntity.RecordDateEnd = this.txtRecordDateEnd.Value.Date.AddDays(1);
  161. crEntity.ThermometerIDS = this.dkThermometer.ThermometerIDS;
  162. if (string.IsNullOrWhiteSpace(this.txtRemarks.Text))
  163. {
  164. crEntity.Remarks = this.txtRemarks.Text;
  165. }
  166. return ReportModuleProxy.Service.GetRPT080106IData(crEntity);
  167. }
  168. catch (Exception ex)
  169. {
  170. throw ex;
  171. }
  172. }
  173. #endregion
  174. }
  175. }