F_RPT_010106.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_010106.cs
  5. * 2.功能描述:成型线剩余注浆次数
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2016/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_010106 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 窗体的单例模式
  30. private static F_RPT_010106 _instance;
  31. //实体类
  32. private RPT010106_SE _rptse = null;
  33. #endregion
  34. #region 构造函数
  35. public F_RPT_010106()
  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_010106 Instance
  52. {
  53. get
  54. {
  55. if (_instance == null || _instance.IsDisposed)
  56. {
  57. _instance = new F_RPT_010106();
  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. catch (Exception ex)
  79. {
  80. // 对异常进行共通处理
  81. ExceptionManager.HandleEventException(this.ToString(),
  82. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  83. }
  84. }
  85. /// <summary>
  86. /// 自动适应列宽
  87. /// </summary>
  88. /// <param name="sender"></param>
  89. /// <param name="e"></param>
  90. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  91. {
  92. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  93. }
  94. /// <summary>
  95. /// 窗体关闭事件
  96. /// </summary>
  97. /// <param name="sender"></param>
  98. /// <param name="e"></param>
  99. private void F_RPT_030103_1_FormClosed(object sender, FormClosedEventArgs e)
  100. {
  101. _instance = null;
  102. }
  103. /// <summary>
  104. /// 关闭按钮
  105. /// </summary>
  106. /// <param name="sender"></param>
  107. /// <param name="e"></param>
  108. private void tsbtnClose_Click(object sender, EventArgs e)
  109. {
  110. this.Close();
  111. }
  112. /// <summary>
  113. /// 查询按钮事件
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void btnSearch_Click(object sender, EventArgs e)
  118. {
  119. try
  120. {
  121. CreateSearchCondition();
  122. this.dgvRptProcedure.DataSource = null;
  123. this.dgvRptProcedure.DataSource = this.GetSearchTotalData();
  124. }
  125. catch (Exception ex)
  126. {
  127. this.btnSearch.Enabled = true;
  128. this.btnClearCondition.Enabled = true;
  129. // 对异常进行共通处理
  130. ExceptionManager.HandleEventException(this.ToString(),
  131. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  132. }
  133. }
  134. /// <summary>
  135. /// 清空条件按钮事件
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void btnClearCondition_Click(object sender, EventArgs e)
  140. {
  141. this.txtGoodCode.Clear();
  142. this.txtGroutingLineCode.Clear();
  143. this.scbGoodsType.ClearValue();
  144. this.txtRemarks.Clear();
  145. }
  146. #endregion
  147. #region 私有方法
  148. /// <summary>
  149. /// 搜索条件
  150. /// </summary>
  151. /// <returns></returns>
  152. private void CreateSearchCondition()
  153. {
  154. this._rptse = new RPT010106_SE();
  155. this._rptse.GroutingLineCode = this.txtGroutingLineCode.Text.Trim();
  156. this._rptse.GoodsCode = this.txtGoodCode.Text.Trim();
  157. this._rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  158. this._rptse.Remarks = txtRemarks.Text.Trim();
  159. }
  160. /// <summary>
  161. /// 查询出窑数量汇总表
  162. /// </summary>
  163. private DataTable GetSearchTotalData()
  164. {
  165. try
  166. {
  167. // 调用服务器端获取数据集
  168. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  169. {
  170. return ReportModuleProxy.Service.GetRPT010106SData(_rptse);
  171. }
  172. );
  173. if (sre.Status == Constant.ServiceResultStatus.Success)
  174. {
  175. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  176. {
  177. // 提示未查找到数据
  178. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  179. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  180. //清空数据
  181. return null;
  182. }
  183. return sre.Data.Tables[0];
  184. }
  185. return null;
  186. }
  187. catch (Exception ex)
  188. {
  189. throw ex;
  190. }
  191. }
  192. #endregion
  193. }
  194. }