F_RPT_010105.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_010105.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_010105 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. // 窗体的单例模式
  30. private static F_RPT_010105 _instance;
  31. //实体类
  32. private RPT010105_SE _rptse = null;
  33. #endregion
  34. #region 构造函数
  35. public F_RPT_010105()
  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_010105 Instance
  52. {
  53. get
  54. {
  55. if (_instance == null || _instance.IsDisposed)
  56. {
  57. _instance = new F_RPT_010105();
  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. DateTime date = DateTime.Now;
  81. this.dtpGDateStart.Value = new DateTime(date.Year, date.Month, 1);
  82. date = this.dtpGDateStart.Value;
  83. this.dtpGDateEnd.Value = date.AddMonths(1).AddDays(-1);
  84. }
  85. catch (Exception ex)
  86. {
  87. // 对异常进行共通处理
  88. ExceptionManager.HandleEventException(this.ToString(),
  89. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  90. }
  91. }
  92. /// <summary>
  93. /// 自动适应列宽
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  98. {
  99. this.dgvRptProcedure.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  100. }
  101. /// <summary>
  102. /// 窗体关闭事件
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void F_RPT_030103_1_FormClosed(object sender, FormClosedEventArgs e)
  107. {
  108. _instance = null;
  109. }
  110. /// <summary>
  111. /// 关闭按钮
  112. /// </summary>
  113. /// <param name="sender"></param>
  114. /// <param name="e"></param>
  115. private void tsbtnClose_Click(object sender, EventArgs e)
  116. {
  117. this.Close();
  118. }
  119. /// <summary>
  120. /// 查询按钮事件
  121. /// </summary>
  122. /// <param name="sender"></param>
  123. /// <param name="e"></param>
  124. private void btnSearch_Click(object sender, EventArgs e)
  125. {
  126. try
  127. {
  128. CreateSearchCondition();
  129. this.dgvRptProcedure.DataSource = null;
  130. this.dgvRptProcedure.DataSource = this.GetSearchTotalData();
  131. }
  132. catch (Exception ex)
  133. {
  134. this.btnSearch.Enabled = true;
  135. this.btnClearCondition.Enabled = true;
  136. // 对异常进行共通处理
  137. ExceptionManager.HandleEventException(this.ToString(),
  138. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  139. }
  140. }
  141. /// <summary>
  142. /// 清空条件按钮事件
  143. /// </summary>
  144. /// <param name="sender"></param>
  145. /// <param name="e"></param>
  146. private void btnClearCondition_Click(object sender, EventArgs e)
  147. {
  148. this.txtGoodCode.Clear();
  149. this.txtGroutingLineCode.Clear();
  150. this.txtGroutingUserCode.Clear();
  151. this.scbGoodsType.ClearValue();
  152. DateTime date = DateTime.Now;
  153. this.dtpGDateStart.Value = new DateTime(date.Year, date.Month, 1);
  154. date = this.dtpGDateStart.Value;
  155. this.dtpGDateEnd.Value = date.AddMonths(1).AddDays(-1);
  156. }
  157. #endregion
  158. #region 私有方法
  159. /// <summary>
  160. /// 搜索条件
  161. /// </summary>
  162. /// <returns></returns>
  163. private void CreateSearchCondition()
  164. {
  165. this._rptse = new RPT010105_SE();
  166. //DateTime date = this.dtpGDateStart.Value;
  167. //this._rptse.GDateBegin = new DateTime(date.Year, date.Month, 1);
  168. //this._rptse.GDateEnd = this._rptse.GDateBegin.AddMonths(1).AddMilliseconds(-1);
  169. this._rptse.GDateBegin = this.dtpGDateStart.Value;
  170. this._rptse.GDateEnd = this.dtpGDateEnd.Value;
  171. this._rptse.GroutingLineCode = this.txtGroutingLineCode.Text.Trim();
  172. this._rptse.GroutingUserCode = this.txtGroutingUserCode.Text.Trim();
  173. this._rptse.GoodsCode = this.txtGoodCode.Text.Trim();
  174. this._rptse.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  175. if (this.dropTotalMethod.Text.ToString() == "楼号") {
  176. this._rptse.TotalMethod = "BuildingNo";
  177. } else if (this.dropTotalMethod.Text.ToString() == "成型线编码")
  178. {
  179. this._rptse.TotalMethod = "groutinglinecode";
  180. }
  181. else if (this.dropTotalMethod.Text.ToString() == "楼层")
  182. {
  183. this._rptse.TotalMethod = "FloorNo";
  184. }
  185. else if (this.dropTotalMethod.Text.ToString() == "线号")
  186. {
  187. this._rptse.TotalMethod = "GroutingLineNo";
  188. }
  189. else if (this.dropTotalMethod.Text.ToString() == "成型工号")
  190. {
  191. this._rptse.TotalMethod = "usercode";
  192. }
  193. else if (this.dropTotalMethod.Text.ToString() == "产品编码")
  194. {
  195. this._rptse.TotalMethod = "goodscode";
  196. }
  197. }
  198. /// <summary>
  199. /// 查询出窑数量汇总表
  200. /// </summary>
  201. private DataTable GetSearchTotalData()
  202. {
  203. try
  204. {
  205. // 调用服务器端获取数据集
  206. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  207. {
  208. return ReportModuleProxy.Service.GetRPT010105SData(_rptse);
  209. }
  210. );
  211. if (sre.Status == Constant.ServiceResultStatus.Success)
  212. {
  213. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  214. {
  215. // 提示未查找到数据
  216. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  217. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  218. //清空数据
  219. return null;
  220. }
  221. return sre.Data.Tables[0];
  222. }
  223. return null;
  224. }
  225. catch (Exception ex)
  226. {
  227. throw ex;
  228. }
  229. }
  230. #endregion
  231. }
  232. }