F_RPT_040111.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_040111.cs
  5. * 2.功能描述:模具注浆分析表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/05/11 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. public partial class F_RPT_040111 : DKDockPanelBase
  24. {
  25. #region 成员变量
  26. // 窗体的单例模式
  27. private static F_RPT_040111 _instance;
  28. //默认清空生产线,重置回用户当前权限生产线
  29. private string _currentUserLinePuview = null;
  30. #endregion
  31. #region 构造函数
  32. public F_RPT_040111()
  33. {
  34. InitializeComponent();
  35. // 窗体显示的Title
  36. this.Text = "模具注浆分析表";
  37. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  38. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  39. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  40. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  41. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  42. }
  43. #endregion
  44. #region 单例模式
  45. /// <summary>
  46. /// 单例模式,防止重复创建窗体
  47. /// </summary>
  48. public static F_RPT_040111 Instance
  49. {
  50. get
  51. {
  52. if (_instance == null || _instance.IsDisposed)
  53. {
  54. _instance = new F_RPT_040111();
  55. }
  56. return _instance;
  57. }
  58. }
  59. #endregion
  60. #region 事件处理
  61. /// <summary>
  62. /// 窗体加载事件
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_RPT_040104_Load(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. // 加载权限
  71. FormPermissionManager.FormPermissionControl(this.Name, this,
  72. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  74. // 设置表格不自动创建列
  75. this.dgvRptProcedure.AutoGenerateColumns = false;
  76. // 初始化时间控件为当前日期
  77. DateTime date = DateTime.Now.Date;
  78. this.dtpAccountDateEnd.Value = date;
  79. this.dtpAccountDateStart.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. }
  97. /// <summary>
  98. /// 窗体关闭事件
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void F_RPT_040104_FormClosed(object sender, FormClosedEventArgs e)
  103. {
  104. _instance = null;
  105. }
  106. /// <summary>
  107. /// 关闭按钮
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void tsbtnClose_Click(object sender, EventArgs e)
  112. {
  113. this.Close();
  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. this.dgvRptProcedure.DataSource = null;
  125. ClientRequestEntity cre = new ClientRequestEntity();
  126. cre.NameSpace = "R04";
  127. cre.Name = "R040111";
  128. cre.Properties["GroutingDateBegin"] = this.dtpAccountDateStart.Value;
  129. cre.Properties["GroutingDateEnd"] = this.dtpAccountDateEnd.Value;
  130. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  131. cre.Properties["MouldBarcode"] = this.txtMouldBarcode.Text.Trim();
  132. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  133. {
  134. return ReportModuleProxy.Service.DoRequest(cre);
  135. });
  136. if (resultEntity == null || resultEntity.Data == null ||
  137. resultEntity.Data.Tables.Count == 0 ||
  138. resultEntity.Data.Tables[0].Rows.Count == 0)
  139. {
  140. return;
  141. }
  142. else
  143. {
  144. this.dgvRptProcedure.DataSource = resultEntity.Data.Tables[0];
  145. this.dgvRptProcedure.ReadOnly = true;
  146. this.dgvRptProcedure.Rows[0].Selected = true;
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. this.btnSearch.Enabled = true;
  152. this.btnClearCondition.Enabled = true;
  153. // 对异常进行共通处理
  154. ExceptionManager.HandleEventException(this.ToString(),
  155. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  156. }
  157. }
  158. /// <summary>
  159. /// 清空条件按钮事件
  160. /// </summary>
  161. /// <param name="sender"></param>
  162. /// <param name="e"></param>
  163. private void btnClearCondition_Click(object sender, EventArgs e)
  164. {
  165. DateTime date = DateTime.Now.Date;
  166. this.dtpAccountDateEnd.Value = date;
  167. this.dtpAccountDateStart.Value = new DateTime(date.Year, date.Month, 1);
  168. this.txtGoodsCode.Clear();
  169. this.txtMouldBarcode.Clear();
  170. }
  171. #endregion
  172. #region 私有方法
  173. /// <summary>
  174. /// 根据界面查询条件获取数据集
  175. /// </summary>
  176. private DataTable GetData(ClientRequestEntity cre)
  177. {
  178. try
  179. {
  180. ServiceResultEntity resultEntity = ReportModuleProxy.Service.DoRequest(cre);
  181. if (resultEntity == null || resultEntity.Data == null || resultEntity.Data.Tables.Count == 0)
  182. {
  183. return null;
  184. }
  185. return resultEntity.Data.Tables[0];
  186. }
  187. catch (Exception ex)
  188. {
  189. throw ex;
  190. }
  191. }
  192. #endregion
  193. }
  194. }