F_RPT_080104.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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_080104 : DKDockPanelBase
  23. {
  24. #region 成员变量
  25. // 窗体的单例模式
  26. private static F_RPT_080104 _instance;
  27. #endregion
  28. #region 构造函数
  29. public F_RPT_080104()
  30. {
  31. InitializeComponent();
  32. // 窗体显示的Title
  33. this.Text = FormTitles.F_RPT_080104;
  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_080104 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null || _instance.IsDisposed)
  50. {
  51. _instance = new F_RPT_080104();
  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. dgvKiln.AutoGenerateColumns = false;
  75. dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1);
  76. dtpEndTime.Value = dtpStartTime.Value.AddMonths(1).AddSeconds(-1);
  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 F_RPT_010201_1_FormClosed(object sender, FormClosedEventArgs e)
  91. {
  92. _instance = null;
  93. }
  94. /// <summary>
  95. /// 关闭按钮
  96. /// </summary>
  97. /// <param name="sender"></param>
  98. /// <param name="e"></param>
  99. private void tsbtnClose_Click(object sender, EventArgs e)
  100. {
  101. this.Close();
  102. }
  103. /// <summary>
  104. /// 查询按钮事件
  105. /// </summary>
  106. /// <param name="sender"></param>
  107. /// <param name="e"></param>
  108. private void btnSearch_Click(object sender, EventArgs e)
  109. {
  110. try
  111. {
  112. this.dgv1.DataSource = null;
  113. dgvKiln.DataSource = null;
  114. if (this.dkProcedureSearchBox1.Text.Trim() == "")
  115. {
  116. MessageBox.Show("统计工序不能为空!", this.Text,
  117. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  118. return;
  119. }
  120. //if (this.dkProcedureSearchBox3.Text.Trim() == "")
  121. //{
  122. // MessageBox.Show("质量登记工序不能为空!", this.Text,
  123. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  124. // return;
  125. //}
  126. //if (this.dkProcedureSearchBox2.Text.Trim() == "")
  127. //{
  128. // MessageBox.Show("出窑数统计工序不能为空!", this.Text,
  129. // MessageBoxButtons.OK, MessageBoxIcon.Warning);
  130. // return;
  131. //}
  132. DataSet ds = this.GetSearchData();
  133. if (ds != null)
  134. {
  135. this.dgv1.DataSource = ds.Tables[0];
  136. dgvKiln.DataSource = ds.Tables[1];
  137. }
  138. }
  139. catch (Exception ex)
  140. {
  141. this.btnSearch.Enabled = true;
  142. this.btnClearCondition.Enabled = true;
  143. // 对异常进行共通处理
  144. ExceptionManager.HandleEventException(this.ToString(),
  145. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  146. }
  147. }
  148. /// <summary>
  149. /// 清空条件按钮事件
  150. /// </summary>
  151. /// <param name="sender"></param>
  152. /// <param name="e"></param>
  153. private void btnClearCondition_Click(object sender, EventArgs e)
  154. {
  155. dtpStartTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
  156. dtpEndTime.Value = dtpStartTime.Value.AddMonths(1).AddSeconds(-1);
  157. this.dkProcedureSearchBox1.ClearControl();
  158. this.dkProcedureSearchBox3.ClearControl();
  159. this.dkProcedureSearchBox2.ClearControl();
  160. this.dkDefectSearchBox1.ClearControl();
  161. this.dkDefectSearchBox2.ClearControl();
  162. }
  163. /// <summary>
  164. /// 自动适应列宽
  165. /// </summary>
  166. /// <param name="sender"></param>
  167. /// <param name="e"></param>
  168. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  169. {
  170. this.dgv1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  171. dgvKiln.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  172. }
  173. #endregion
  174. #region 私有方法
  175. /// <summary>
  176. /// 根据界面查询条件获取数据集
  177. /// </summary>
  178. private DataSet GetSearchData()
  179. {
  180. try
  181. {
  182. RPT080103_SE se = new RPT080103_SE();
  183. //se.startDateTime = new DateTime(this.dtpStartTime.Value.Year, this.dtpStartTime.Value.Month, 1);
  184. //se.endDateTime = se.startDateTime.Value.AddMonths(1).AddSeconds(-1);
  185. se.startDateTime = this.dtpStartTime.Value;
  186. se.endDateTime = this.dtpEndTime.Value;
  187. se.ProcedureIDS = dkProcedureSearchBox1.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox1.ProcedureIDS;
  188. se.OutProcedureIDS = dkProcedureSearchBox2.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox2.ProcedureIDS;
  189. se.QualityProcedureIDS = dkProcedureSearchBox3.ProcedureIDS == null ? string.Empty : dkProcedureSearchBox3.ProcedureIDS;;
  190. se.DefectIDS = dkDefectSearchBox1.DefectIDS == null ? string.Empty : dkDefectSearchBox1.DefectIDS;
  191. se.DefectIDS2 = dkDefectSearchBox2.DefectIDS == null ? string.Empty : dkDefectSearchBox2.DefectIDS;
  192. // 调用服务器端获取数据集
  193. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  194. {
  195. return ReportModuleProxy.Service.GetRPT080104SData(se);
  196. }
  197. );
  198. if (sre.Status == Constant.ServiceResultStatus.Success)
  199. {
  200. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  201. {
  202. // 提示未查找到数据
  203. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  204. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  205. //清空数据
  206. return null;
  207. }
  208. return sre.Data;
  209. }
  210. return null;
  211. }
  212. catch (Exception ex)
  213. {
  214. throw ex;
  215. }
  216. }
  217. #endregion
  218. }
  219. }