F_RPT_080116.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080116.cs
  5. * 2.功能描述:QC检验分析汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 秦祺 2022/12/09 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.DataModels;
  17. using Dongke.IBOSS.PRD.Client.PMModule;
  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_080116 : DKDockPanelBase
  23. {
  24. #region 成员变量
  25. // 窗体的单例模式
  26. private static F_RPT_080116 _instance;
  27. #endregion
  28. #region 构造函数
  29. public F_RPT_080116()
  30. {
  31. InitializeComponent();
  32. // 窗体显示的Title
  33. this.Text = "QC检验分析汇总表";
  34. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  35. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  36. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  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_080116 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null || _instance.IsDisposed)
  50. {
  51. _instance = new F_RPT_080116();
  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_080116_Load(object sender, EventArgs e)
  64. {
  65. try
  66. {
  67. // 加载权限
  68. FormPermissionManager.FormPermissionControl(this.Name, this,
  69. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  70. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  71. this.dtpCreateTimeBegin.Value = DateTime.Now.Date;
  72. this.dtpCreateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  73. // 设置表格不自动创建列
  74. this.dgvBarcodeIdnrk.AutoGenerateColumns = false;
  75. // 检验标准名称
  76. //绑定检验类型
  77. ClientRequestEntity cre = new ClientRequestEntity();
  78. cre.NameSpace = "F_RPT_080116";
  79. cre.Name = "GetInspectName";
  80. ServiceResultEntity sre = DoAsync(() =>
  81. {
  82. return PCModuleProxyNew.Service.HandleRequest(cre);
  83. });
  84. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  85. {
  86. this.cbInpectName.DisplayMember = "INSPECTNAME";
  87. this.cbInpectName.ValueMember = "ITEMSID";
  88. this.cbInpectName.DataSource = sre.Data.Tables[0];
  89. }
  90. }
  91. catch (Exception ex)
  92. {
  93. // 对异常进行共通处理
  94. ExceptionManager.HandleEventException(this.ToString(),
  95. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  96. }
  97. }
  98. /// <summary>
  99. /// 自动适应列宽
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  104. {
  105. this.dgvBarcodeIdnrk.AutoResizeColumns();
  106. }
  107. /// <summary>
  108. /// 窗体关闭事件
  109. /// </summary>
  110. /// <param name="sender"></param>
  111. /// <param name="e"></param>
  112. private void F_RPT_080116_FormClosed(object sender, FormClosedEventArgs e)
  113. {
  114. _instance = null;
  115. }
  116. /// <summary>
  117. /// 关闭按钮
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void tsbtnClose_Click(object sender, EventArgs e)
  122. {
  123. this.Close();
  124. }
  125. /// <summary>
  126. /// 查询按钮事件
  127. /// </summary>
  128. /// <param name="sender"></param>
  129. /// <param name="e"></param>
  130. private void btnSearch_Click(object sender, EventArgs e)
  131. {
  132. try
  133. {
  134. this.dgvBarcodeIdnrk.DataSource = null;
  135. ClientRequestEntity cre = new ClientRequestEntity();
  136. cre.NameSpace = "F_RPT_080116";
  137. cre.Name = "Get080116Detail";
  138. cre.Properties["CreateTimeBegin"] = this.dtpCreateTimeBegin.Value;
  139. cre.Properties["CreateTimeEnd"] = Convert.ToDateTime(this.dtpCreateTimeEnd.Value).AddSeconds(1);
  140. cre.Properties["ITEMSID"] = this.cbInpectName.SelectedValue;
  141. ServiceResultEntity sre = DoAsync(() =>
  142. {
  143. return PCModuleProxyNew.Service.HandleRequest(cre);
  144. });
  145. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  146. {
  147. dgvBarcodeIdnrk.DataSource = sre.Data.Tables[0];
  148. tsbtnAdaptive_Click(null, null);
  149. }
  150. else
  151. {
  152. // 提示未查找到数据
  153. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  154. MessageBoxButtons.OK, MessageBoxIcon.Information);
  155. }
  156. }
  157. catch (Exception ex)
  158. {
  159. this.btnSearch.Enabled = true;
  160. this.btnClearCondition.Enabled = true;
  161. // 对异常进行共通处理
  162. ExceptionManager.HandleEventException(this.ToString(),
  163. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  164. }
  165. }
  166. /// <summary>
  167. /// 清空条件按钮事件
  168. /// </summary>
  169. /// <param name="sender"></param>
  170. /// <param name="e"></param>
  171. private void btnClearCondition_Click(object sender, EventArgs e)
  172. {
  173. this.dtpCreateTimeBegin.Value = DateTime.Now.Date;
  174. this.dtpCreateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  175. this.cbInpectName.SelectedValue = 1;
  176. }
  177. /// <summary>
  178. /// 编辑
  179. /// </summary>
  180. /// <param name="sender"></param>
  181. /// <param name="e"></param>
  182. private void tsbtnEdit_Click(object sender, EventArgs e)
  183. {
  184. try
  185. {
  186. if (this.dgvBarcodeIdnrk.CurrentCell != null)
  187. {
  188. F_RPT_080111 frm080111 = new F_RPT_080111();
  189. frm080111.DrValue = (this.dgvBarcodeIdnrk.CurrentRow.DataBoundItem as DataRowView).Row;
  190. frm080111.ShowDialog();
  191. if (DialogResult.OK.Equals(frm080111.DialogResult))
  192. {
  193. btnSearch_Click(null, null);
  194. }
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. this.btnSearch.Enabled = true;
  200. this.btnClearCondition.Enabled = true;
  201. // 对异常进行共通处理
  202. ExceptionManager.HandleEventException(this.ToString(),
  203. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  204. }
  205. }
  206. /// <summary>
  207. /// 双击编辑
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. private void dgvBarcodeIdnrk_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  212. {
  213. try
  214. {
  215. if (this.dgvBarcodeIdnrk.CurrentRow == null)
  216. {
  217. return;
  218. }
  219. //获取数据信息
  220. DataGridViewRow dgvr = dgvBarcodeIdnrk.CurrentRow;
  221. string INSPECTITEM = dgvr.Cells["INSPECTITEM"].Value.ToString();
  222. //跳转页
  223. this.tabControl1.SelectTab(1);
  224. //清空数据
  225. this.dgvQCdata.DataSource = null;
  226. this.dgvQCdata.DataSource = GetSearchDetailData(INSPECTITEM);
  227. }
  228. catch (Exception ex)
  229. {
  230. this.btnSearch.Enabled = true;
  231. this.btnClearCondition.Enabled = true;
  232. // 对异常进行共通处理
  233. ExceptionManager.HandleEventException(this.ToString(),
  234. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  235. }
  236. }
  237. /// <summary>
  238. /// 查询检验计划明细
  239. /// </summary>
  240. private DataTable GetSearchDetailData(string INSPECTITEM)
  241. {
  242. try
  243. {
  244. ClientRequestEntity cre = new ClientRequestEntity();
  245. cre.NameSpace = "F_RPT_080116";
  246. cre.Name = "GetDetailInspection";
  247. cre.Properties["INSPECTITEM"] = INSPECTITEM;
  248. cre.Properties["CreateTimeBegin"] = this.dtpCreateTimeBegin.Value;
  249. cre.Properties["CreateTimeEnd"] = Convert.ToDateTime(this.dtpCreateTimeEnd.Value).AddSeconds(1);
  250. ServiceResultEntity sre = DoAsync(() =>
  251. {
  252. return PCModuleProxyNew.Service.HandleRequest(cre);
  253. });
  254. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  255. {
  256. return sre.Data.Tables[0];
  257. }
  258. else
  259. {
  260. return null;
  261. // 提示未查找到数据
  262. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  263. MessageBoxButtons.OK, MessageBoxIcon.Information);
  264. }
  265. }
  266. catch (Exception ex)
  267. {
  268. throw ex;
  269. }
  270. }
  271. #endregion
  272. }
  273. }