F_RPT_080103.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080103.cs
  5. * 2.功能描述:烧成前工序产量明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 王鑫 2016/01/25 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.Client.Controls;
  16. using Dongke.IBOSS.PRD.Client.Controls.FormCommon;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.ReportModule
  21. {
  22. public partial class F_RPT_080103 : DKDockPanelBase
  23. {
  24. #region 成员变量
  25. // 窗体的单例模式
  26. private static F_RPT_080103 _instance;
  27. #endregion
  28. #region 构造函数
  29. public F_RPT_080103()
  30. {
  31. InitializeComponent();
  32. // 窗体显示的Title
  33. this.Text = FormTitles.F_RPT_080103;
  34. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  35. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  36. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  37. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  38. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  39. }
  40. #endregion
  41. #region 单例模式
  42. /// <summary>
  43. /// 单例模式,防止重复创建窗体
  44. /// </summary>
  45. public static F_RPT_080103 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null || _instance.IsDisposed)
  50. {
  51. _instance = new F_RPT_080103();
  52. }
  53. return _instance;
  54. }
  55. }
  56. #endregion
  57. #region 事件处理
  58. /// <summary>
  59. /// 窗体加载事件
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. private void F_RPT_010201_1_Load(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. // 加载权限
  68. // 加载权限
  69. FormPermissionManager.FormPermissionControl(this.Name, this,
  70. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  71. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  72. // 设置表格不自动创建列
  73. this.dgv1.AutoGenerateColumns = false;
  74. dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1);
  75. dtpEndTime.Value = dtpStartTime.Value.AddMonths(1).AddSeconds(-1);
  76. }
  77. catch (Exception ex)
  78. {
  79. // 对异常进行共通处理
  80. ExceptionManager.HandleEventException(this.ToString(),
  81. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  82. }
  83. }
  84. /// <summary>
  85. /// 窗体关闭事件
  86. /// </summary>
  87. /// <param name="sender"></param>
  88. /// <param name="e"></param>
  89. private void F_RPT_010201_1_FormClosed(object sender, FormClosedEventArgs e)
  90. {
  91. _instance = null;
  92. }
  93. /// <summary>
  94. /// 关闭按钮
  95. /// </summary>
  96. /// <param name="sender"></param>
  97. /// <param name="e"></param>
  98. private void tsbtnClose_Click(object sender, EventArgs e)
  99. {
  100. this.Close();
  101. }
  102. /// <summary>
  103. /// 查询按钮事件
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void btnSearch_Click(object sender, EventArgs e)
  108. {
  109. try
  110. {
  111. this.dgv1.DataSource = null;
  112. if (this.dkProcedureSearchBox1.Text.Trim() == "")
  113. {
  114. MessageBox.Show("统计工序不能为空!", this.Text,
  115. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  116. return;
  117. }
  118. //if (this.dkProcedureSearchBox3.Text.Trim() == "")
  119. //{
  120. // MessageBox.Show("质量登记工序不能为空!", this.Text,
  121. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  122. // return;
  123. //}
  124. //if (this.dkProcedureSearchBox2.Text.Trim() == "")
  125. //{
  126. // MessageBox.Show("出窑数统计工序不能为空!", this.Text,
  127. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  128. // return;
  129. //}
  130. DataSet ds = this.GetSearchData();
  131. if (ds != null)
  132. {
  133. this.dgv1.DataSource = ds.Tables[0];
  134. }
  135. }
  136. catch (Exception ex)
  137. {
  138. this.btnSearch.Enabled = true;
  139. this.btnClearCondition.Enabled = true;
  140. // 对异常进行共通处理
  141. ExceptionManager.HandleEventException(this.ToString(),
  142. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  143. }
  144. }
  145. /// <summary>
  146. /// 清空条件按钮事件
  147. /// </summary>
  148. /// <param name="sender"></param>
  149. /// <param name="e"></param>
  150. private void btnClearCondition_Click(object sender, EventArgs e)
  151. {
  152. dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
  153. dtpEndTime.Value = dtpStartTime.Value.AddMonths(1).AddSeconds(-1);
  154. this.dkProcedureSearchBox1.ClearControl();
  155. this.dkProcedureSearchBox3.ClearControl();
  156. this.dkProcedureSearchBox2.ClearControl();
  157. this.dkDefectSearchBox1.ClearControl();
  158. this.dkDefectSearchBox2.ClearControl();
  159. this.dkHandOverProcedure.ClearControl();
  160. }
  161. /// <summary>
  162. /// 自动适应列宽
  163. /// </summary>
  164. /// <param name="sender"></param>
  165. /// <param name="e"></param>
  166. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  167. {
  168. this.dgv1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  169. }
  170. #endregion
  171. #region 私有方法
  172. /// <summary>
  173. /// 根据界面查询条件获取数据集
  174. /// </summary>
  175. private DataSet GetSearchData()
  176. {
  177. try
  178. {
  179. RPT080103_SE se = new RPT080103_SE();
  180. //se.startDateTime = new DateTime(this.dtpStartTime.Value.Year, this.dtpStartTime.Value.Month, 1);
  181. //se.endDateTime = new DateTime(this.dtpStartTime.Value.Year, this.dtpStartTime.Value.Month, 1).AddDays(DateTime.DaysInMonth(this.dtpStartTime.Value.Year, this.dtpStartTime.Value.Month)).AddDays(-1);
  182. se.startDateTime = this.dtpStartTime.Value;
  183. se.endDateTime = this.dtpEndTime.Value;
  184. se.ProcedureIDS = dkProcedureSearchBox1.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox1.ProcedureIDS;
  185. se.OutProcedureIDS = dkProcedureSearchBox2.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox2.ProcedureIDS;
  186. se.QualityProcedureIDS = dkProcedureSearchBox3.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox3.ProcedureIDS;;
  187. se.DefectIDS = dkDefectSearchBox1.DefectIDS == null ? string.Empty : dkDefectSearchBox1.DefectIDS;
  188. se.DefectIDS2 = dkDefectSearchBox2.DefectIDS == null ? string.Empty : dkDefectSearchBox2.DefectIDS;
  189. se.HandOverProcedureIDS = this.dkHandOverProcedure.ProcedureIDS == null ? string.Empty : dkHandOverProcedure.ProcedureIDS;
  190. // 调用服务器端获取数据集
  191. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  192. {
  193. return ReportModuleProxy.Service.GetRPT080103SData(se);
  194. }
  195. );
  196. if (sre.Status == Constant.ServiceResultStatus.Success)
  197. {
  198. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  199. {
  200. // 提示未查找到数据
  201. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  202. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  203. //清空数据
  204. return null;
  205. }
  206. return sre.Data;
  207. }
  208. return null;
  209. }
  210. catch (Exception ex)
  211. {
  212. throw ex;
  213. }
  214. }
  215. #endregion
  216. }
  217. }