F_RPT_080115.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080115.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_080115 : DKDockPanelBase
  23. {
  24. #region 成员变量
  25. // 窗体的单例模式
  26. private static F_RPT_080115 _instance;
  27. #endregion
  28. #region 构造函数
  29. public F_RPT_080115()
  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_080115 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null || _instance.IsDisposed)
  50. {
  51. _instance = new F_RPT_080115();
  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_080115_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. // 设置表格不自动创建列
  73. this.dgvBarcodeIdnrk.AutoGenerateColumns = false;
  74. //绑定检验类型
  75. ClientRequestEntity cre = new ClientRequestEntity();
  76. cre.NameSpace = "F_RPT_080115";
  77. cre.Name = "GetInspectType";
  78. ServiceResultEntity sre = DoAsync(() =>
  79. {
  80. return PCModuleProxyNew.Service.HandleRequest(cre);
  81. });
  82. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  83. {
  84. this.cbInpectType.DisplayMember = "dictionaryvalue";
  85. this.cbInpectType.ValueMember = "dictionaryid";
  86. this.cbInpectType.DataSource = sre.Data.Tables[0];
  87. }
  88. }
  89. catch (Exception ex)
  90. {
  91. // 对异常进行共通处理
  92. ExceptionManager.HandleEventException(this.ToString(),
  93. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  94. }
  95. }
  96. /// <summary>
  97. /// 自动适应列宽
  98. /// </summary>
  99. /// <param name="sender"></param>
  100. /// <param name="e"></param>
  101. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  102. {
  103. this.dgvBarcodeIdnrk.AutoResizeColumns();
  104. }
  105. /// <summary>
  106. /// 窗体关闭事件
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. private void F_RPT_080115_FormClosed(object sender, FormClosedEventArgs e)
  111. {
  112. _instance = null;
  113. }
  114. /// <summary>
  115. /// 关闭按钮
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. private void tsbtnClose_Click(object sender, EventArgs e)
  120. {
  121. this.Close();
  122. }
  123. /// <summary>
  124. /// 查询按钮事件
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. private void btnSearch_Click(object sender, EventArgs e)
  129. {
  130. try
  131. {
  132. this.dgvBarcodeIdnrk.DataSource = null;
  133. ClientRequestEntity cre = new ClientRequestEntity();
  134. cre.NameSpace = "F_RPT_080115";
  135. cre.Name = "GetDetail";
  136. cre.Properties["GoodsType"] = this.scbGoodsType.SearchedValue+"";
  137. cre.Properties["GoodsCode"] = this.txtGoodsCode.Text.Trim();
  138. cre.Properties["CreateTime"] = this.dtpCreateTimeBegin.Value;
  139. cre.Properties["InpectType"] = this.cbInpectType.SelectedValue;
  140. ServiceResultEntity sre = DoAsync(() =>
  141. {
  142. return PCModuleProxyNew.Service.HandleRequest(cre);
  143. });
  144. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  145. {
  146. dgvBarcodeIdnrk.DataSource = sre.Data.Tables[0];
  147. tsbtnAdaptive_Click(null, null);
  148. }
  149. else
  150. {
  151. // 提示未查找到数据
  152. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  153. MessageBoxButtons.OK, MessageBoxIcon.Information);
  154. }
  155. }
  156. catch (Exception ex)
  157. {
  158. this.btnSearch.Enabled = true;
  159. this.btnClearCondition.Enabled = true;
  160. // 对异常进行共通处理
  161. ExceptionManager.HandleEventException(this.ToString(),
  162. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  163. }
  164. }
  165. /// <summary>
  166. /// 清空条件按钮事件
  167. /// </summary>
  168. /// <param name="sender"></param>
  169. /// <param name="e"></param>
  170. private void btnClearCondition_Click(object sender, EventArgs e)
  171. {
  172. this.scbGoodsType.Text = "";
  173. this.txtGoodsCode.Text = "";
  174. this.dtpCreateTimeBegin.Value = DateTime.Now.Date;
  175. this.cbInpectType.SelectedValue = 0;
  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 PLANID = dgvr.Cells["PLANID"].Value.ToString();
  222. //跳转页
  223. this.tabControl1.SelectTab(1);
  224. //清空数据
  225. this.dgvQCdata.DataSource = null;
  226. this.dgvQCdata.DataSource = GetSearchDetailData(PLANID);
  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 PLANID)
  241. {
  242. try
  243. {
  244. ClientRequestEntity cre = new ClientRequestEntity();
  245. cre.NameSpace = "F_RPT_080115";
  246. cre.Name = "GetDetailData";
  247. cre.Properties["PLANID"] = PLANID;
  248. ServiceResultEntity sre = DoAsync(() =>
  249. {
  250. return PCModuleProxyNew.Service.HandleRequest(cre);
  251. });
  252. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  253. {
  254. return sre.Data.Tables[0];
  255. }
  256. else
  257. {
  258. return null;
  259. // 提示未查找到数据
  260. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  261. MessageBoxButtons.OK, MessageBoxIcon.Information);
  262. }
  263. }
  264. catch (Exception ex)
  265. {
  266. throw ex;
  267. }
  268. }
  269. #endregion
  270. }
  271. }