F_RPT_040108.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_040108.cs
  5. * 2.功能描述:成型线产量分析表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2018/08/29 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Text;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  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_040108 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 窗体的单例模式
  30. private static F_RPT_040108 _instance;
  31. //实体类
  32. private RPT040108_SE _rptse = null;
  33. #endregion
  34. #region 构造函数
  35. public F_RPT_040108()
  36. {
  37. InitializeComponent();
  38. // 窗体显示的Title
  39. this.Text = "成型线产量分析表";
  40. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  41. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  42. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  43. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  44. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  45. }
  46. #endregion
  47. #region 单例模式
  48. /// <summary>
  49. /// 单例模式,防止重复创建窗体
  50. /// </summary>
  51. public static F_RPT_040108 Instance
  52. {
  53. get
  54. {
  55. if (_instance == null || _instance.IsDisposed)
  56. {
  57. _instance = new F_RPT_040108();
  58. }
  59. return _instance;
  60. }
  61. }
  62. #endregion
  63. #region 事件处理
  64. /// <summary>
  65. /// 窗体加载事件
  66. /// </summary>
  67. /// <param name="sender"></param>
  68. /// <param name="e"></param>
  69. private void F_RPT_030103_1_Load(object sender, EventArgs e)
  70. {
  71. try
  72. {
  73. // 加载权限
  74. FormPermissionManager.FormPermissionControl(this.Name, this,
  75. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  76. this.dgvRptProcedure.AutoGenerateColumns = false;
  77. // 初始化时间控件为当前日期
  78. DateTime date = DateTime.Now.Date;
  79. this.dtpGDateStart.Value = new DateTime(date.Year, date.Month, 1);
  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 tsbtnAdaptive_Click(object sender, EventArgs e)
  94. {
  95. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  96. this.dgvGC.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  97. this.dgvGD.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  98. }
  99. /// <summary>
  100. /// 窗体关闭事件
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. private void F_RPT_030103_1_FormClosed(object sender, FormClosedEventArgs e)
  105. {
  106. _instance = null;
  107. }
  108. /// <summary>
  109. /// 关闭按钮
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. private void tsbtnClose_Click(object sender, EventArgs e)
  114. {
  115. this.Close();
  116. }
  117. /// <summary>
  118. /// 查询按钮事件
  119. /// </summary>
  120. /// <param name="sender"></param>
  121. /// <param name="e"></param>
  122. private void btnSearch_Click(object sender, EventArgs e)
  123. {
  124. try
  125. {
  126. CreateSearchCondition();
  127. this.dgvRptProcedure.DataSource = null;
  128. this.dgvGC.DataSource = null;
  129. this.dgvGD.DataSource = null;
  130. DataTable dt = this.GetSearchTotalData();
  131. this.dgvRptProcedure.DataSource = dt;
  132. this.dgvGC.DataSource = dt;
  133. this.dgvGD.DataSource = dt;
  134. }
  135. catch (Exception ex)
  136. {
  137. this.btnSearch.Enabled = true;
  138. this.btnClearCondition.Enabled = true;
  139. // 对异常进行共通处理
  140. ExceptionManager.HandleEventException(this.ToString(),
  141. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  142. }
  143. }
  144. /// <summary>
  145. /// 清空条件按钮事件
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void btnClearCondition_Click(object sender, EventArgs e)
  150. {
  151. this.txtGoodCode.Clear();
  152. this.txtGroutingLineCode.Clear();
  153. this.txtGroutingUserCode.Clear();
  154. this.scbGoodsType.ClearValue();
  155. DateTime date = DateTime.Now.Date;
  156. this.dtpGDateStart.Value = new DateTime(date.Year, date.Month, 1);
  157. }
  158. #endregion
  159. #region 私有方法
  160. /// <summary>
  161. /// 搜索条件
  162. /// </summary>
  163. /// <returns></returns>
  164. private void CreateSearchCondition()
  165. {
  166. this._rptse = new RPT040108_SE();
  167. DateTime date = this.dtpGDateStart.Value;
  168. this._rptse.GDateBegin = new DateTime(date.Year, date.Month, 1);
  169. this._rptse.GDateEnd = this._rptse.GDateBegin.AddMonths(1).AddMilliseconds(-1);
  170. this._rptse.GroutingLineCode = this.txtGroutingLineCode.Text.Trim();
  171. this._rptse.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  172. this._rptse.GoodsCode = this.txtGoodCode.Text.Trim();
  173. this._rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  174. }
  175. /// <summary>
  176. /// 查询出窑数量汇总表
  177. /// </summary>
  178. private DataTable GetSearchTotalData()
  179. {
  180. try
  181. {
  182. // 调用服务器端获取数据集
  183. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  184. {
  185. return ReportModuleProxy.Service.GetRPT040108SData(_rptse);
  186. }
  187. );
  188. if (sre.Status == Constant.ServiceResultStatus.Success)
  189. {
  190. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  191. {
  192. // 提示未查找到数据
  193. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  194. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  195. //清空数据
  196. return null;
  197. }
  198. return sre.Data.Tables[0];
  199. }
  200. return null;
  201. }
  202. catch (Exception ex)
  203. {
  204. throw ex;
  205. }
  206. }
  207. #endregion
  208. }
  209. }