F_RPT_030108.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. 
  2. /*******************************************************************************
  3. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  4. * 类的信息:
  5. * 1.程序名称:F_RPT_030108.cs
  6. * 2.功能描述:成型信息汇总表
  7. * 编辑履历:
  8. * 作者 日期 版本 修改内容
  9. * 袁新成 2015/4/14 1.00 新建
  10. *******************************************************************************/
  11. using System;
  12. using System.Data;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.ReportModule
  23. {
  24. /// <summary>
  25. /// 成型信息汇总表
  26. /// </summary>
  27. public partial class F_RPT_030108 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. // 窗体的单例模式
  31. private static F_RPT_030108 _instance;
  32. //实体类
  33. private RPT030108_SE _rptse = null;
  34. //默认清空工序,重置回用户当前权限工序
  35. private string _currentUserPurview = null;
  36. //默认清空生产线,重置回用户当前权限生产线
  37. private string _currentUserLinePuview = null;
  38. #endregion
  39. #region 构造函数
  40. public F_RPT_030108()
  41. {
  42. InitializeComponent();
  43. // 窗体显示的Title
  44. this.Text = "成型信息汇总表";
  45. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  46. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  47. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  48. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  49. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  50. }
  51. #endregion
  52. #region 单例模式
  53. /// <summary>
  54. /// 单例模式,防止重复创建窗体
  55. /// </summary>
  56. public static F_RPT_030108 Instance
  57. {
  58. get
  59. {
  60. if (_instance == null || _instance.IsDisposed)
  61. {
  62. _instance = new F_RPT_030108();
  63. }
  64. return _instance;
  65. }
  66. }
  67. #endregion
  68. #region 事件处理
  69. /// <summary>
  70. /// 窗体加载事件
  71. /// </summary>
  72. /// <param name="sender"></param>
  73. /// <param name="e"></param>
  74. private void F_RPT_030103_1_Load(object sender, EventArgs e)
  75. {
  76. try
  77. {
  78. // 加载权限
  79. FormPermissionManager.FormPermissionControl(this.Name, this,
  80. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  81. this.dgvRptProcedure.AutoGenerateColumns = false;
  82. // 初始化时间控件为当前日期
  83. this.dtpGDateStart.Value = DateTime.Now.Date;
  84. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  85. this.dtpSDateStart.Value = DateTime.Now.Date;
  86. this.dtpSDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  87. this.dtpDDateStart.Value = DateTime.Now.Date;
  88. this.dtpDDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  89. }
  90. catch (Exception ex)
  91. {
  92. // 对异常进行共通处理
  93. ExceptionManager.HandleEventException(this.ToString(),
  94. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  95. }
  96. }
  97. /// <summary>
  98. /// 自动适应列宽
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  103. {
  104. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  105. }
  106. /// <summary>
  107. /// 窗体关闭事件
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void F_RPT_030103_1_FormClosed(object sender, FormClosedEventArgs e)
  112. {
  113. _instance = null;
  114. }
  115. /// <summary>
  116. /// 关闭按钮
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void tsbtnClose_Click(object sender, EventArgs e)
  121. {
  122. this.Close();
  123. }
  124. /// <summary>
  125. /// 查询按钮事件
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void btnSearch_Click(object sender, EventArgs e)
  130. {
  131. try
  132. {
  133. CreateSearchCondition();
  134. this.dgvRptProcedure.DataSource = null;
  135. this.dgvRptProcedure.DataSource = this.GetSearchTotalData();
  136. }
  137. catch (Exception ex)
  138. {
  139. this.btnSearch.Enabled = true;
  140. this.btnClearCondition.Enabled = true;
  141. // 对异常进行共通处理
  142. ExceptionManager.HandleEventException(this.ToString(),
  143. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  144. }
  145. }
  146. /// <summary>
  147. /// 清空条件按钮事件
  148. /// </summary>
  149. /// <param name="sender"></param>
  150. /// <param name="e"></param>
  151. private void btnClearCondition_Click(object sender, EventArgs e)
  152. {
  153. this.scbGoodsType.ClearValue();
  154. this.txtGoodCode.Clear();
  155. this.dtpGDateStart.Value = DateTime.Now.Date;
  156. this.dtpGDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  157. this.dtpSDateStart.Value = DateTime.Now.Date;
  158. this.dtpSDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  159. this.dtpDDateStart.Value = DateTime.Now.Date;
  160. this.dtpDDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  161. this.txtUserCode.Clear();
  162. }
  163. #endregion
  164. #region 私有方法
  165. /// <summary>
  166. /// 搜索条件
  167. /// </summary>
  168. /// <returns></returns>
  169. private void CreateSearchCondition()
  170. {
  171. this._rptse = new RPT030108_SE();
  172. this._rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  173. this._rptse.GoodsCode = this.txtGoodCode.Text.Trim();
  174. this._rptse.UserCode = this.txtUserCode.Text.Trim();
  175. this._rptse.GTimeStart = DateTime.Parse(this.dtpGDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  176. this._rptse.GTimeEnd = DateTime.Parse(this.dtpGDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  177. this._rptse.STimeStart = DateTime.Parse(this.dtpSDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  178. this._rptse.STimeEnd = DateTime.Parse(this.dtpSDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  179. this._rptse.DTimeStart = DateTime.Parse(this.dtpDDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  180. this._rptse.DTimeEnd = DateTime.Parse(this.dtpDDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  181. }
  182. /// <summary>
  183. /// 查询出窑数量汇总表
  184. /// </summary>
  185. private DataTable GetSearchTotalData()
  186. {
  187. try
  188. {
  189. // 调用服务器端获取数据集
  190. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  191. {
  192. return ReportModuleProxy.Service.GetRPT030108SData(_rptse);
  193. }
  194. );
  195. if (sre.Status == Constant.ServiceResultStatus.Success)
  196. {
  197. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  198. {
  199. // 提示未查找到数据
  200. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  201. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  202. //清空数据
  203. return null;
  204. }
  205. return sre.Data.Tables[0];
  206. }
  207. return null;
  208. }
  209. catch (Exception ex)
  210. {
  211. throw ex;
  212. }
  213. }
  214. #endregion
  215. }
  216. }