F_RPT_030118.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030118.cs
  5. * 2.功能描述:年度各工序月产量统计表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/12/26 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Reflection;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. /// <summary>
  24. /// 年度各工序月产量统计表
  25. /// </summary>
  26. public partial class F_RPT_030118 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. private static F_RPT_030118 _instance = null;
  30. #endregion
  31. #region 单例模式
  32. /// <summary>
  33. /// 单例模式,防止重复创建窗体
  34. /// </summary>
  35. public static F_RPT_030118 Instance
  36. {
  37. get
  38. {
  39. if (_instance == null)
  40. {
  41. _instance = new F_RPT_030118();
  42. }
  43. return _instance;
  44. }
  45. }
  46. #endregion
  47. #region 构造函数
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. public F_RPT_030118()
  52. {
  53. InitializeComponent();
  54. this.Text = "年度各工序月产量统计表";
  55. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  56. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  57. this.dgvSum.AutoGenerateColumns = false;
  58. }
  59. #endregion
  60. #region 控件事件
  61. /// <summary>
  62. /// 关闭
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_PC_1001_FormClosed(object sender, FormClosedEventArgs e)
  67. {
  68. _instance = null;
  69. }
  70. /// <summary>
  71. /// 画面加载
  72. /// </summary>
  73. /// <param name="sender"></param>
  74. /// <param name="e"></param>
  75. private void F_PC_1001_Load(object sender, System.EventArgs e)
  76. {
  77. try
  78. {
  79. this.dtpYear1.Value = DateTime.Now;
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. 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 tsbtnSearch_Click(object sender, EventArgs e)
  94. {
  95. try
  96. {
  97. this.dgvSum.DataSource = null;
  98. this.QueryDataFromOther();
  99. }
  100. catch (Exception ex)
  101. {
  102. // 对异常进行共通处理
  103. ExceptionManager.HandleEventException(this.ToString(),
  104. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  105. }
  106. }
  107. /// <summary>
  108. /// 清除条件
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  113. {
  114. this.dtpYear1.Value = DateTime.Now;
  115. }
  116. /// <summary>
  117. /// 自适应列宽
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  122. {
  123. this.dgvSum.AutoResizeColumns();
  124. }
  125. /// <summary>
  126. /// 关闭画面
  127. /// </summary>
  128. /// <param name="sender"></param>
  129. /// <param name="e"></param>
  130. private void tsbtnClose_Click(object sender, EventArgs e)
  131. {
  132. this.Close();
  133. }
  134. #endregion
  135. #region 私有方法
  136. /// <summary>
  137. /// 查询数据
  138. /// </summary>
  139. private void QueryDataFromOther()
  140. {
  141. try
  142. {
  143. this.tsrToolStrip1.Focus();
  144. ClientRequestEntity cre = new ClientRequestEntity();
  145. cre.NameSpace = "R03";
  146. cre.Name = "R030118Data";
  147. int y = this.dtpYear1.Value.Value.Year;
  148. cre.Properties["DateBegin"] = new DateTime(y - 1, 12, 1);
  149. cre.Properties["DateEnd"] = new DateTime(y, 12, 1);
  150. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  151. {
  152. return ReportModuleProxy.Service.DoRequest(cre);
  153. }
  154. );
  155. if (sre.Status == Constant.ServiceResultStatus.Success)
  156. {
  157. // 查询成功
  158. this.dgvSum.DataSource = sre.Data.Tables[0];
  159. }
  160. }
  161. catch (Exception ex)
  162. {
  163. throw ex;
  164. }
  165. }
  166. #endregion
  167. }
  168. }