F_RPT_080110.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_080110.cs
  5. * 2.功能描述:产品装配明细表
  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_080110 : DKDockPanelBase
  23. {
  24. #region 成员变量
  25. // 窗体的单例模式
  26. private static F_RPT_080110 _instance;
  27. #endregion
  28. #region 构造函数
  29. public F_RPT_080110()
  30. {
  31. InitializeComponent();
  32. // 窗体显示的Title
  33. this.Text = "产品装配明细表";
  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_080110 Instance
  46. {
  47. get
  48. {
  49. if (_instance == null || _instance.IsDisposed)
  50. {
  51. _instance = new F_RPT_080110();
  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_080110_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. catch (Exception ex)
  77. {
  78. // 对异常进行共通处理
  79. ExceptionManager.HandleEventException(this.ToString(),
  80. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  81. }
  82. }
  83. /// <summary>
  84. /// 自动适应列宽
  85. /// </summary>
  86. /// <param name="sender"></param>
  87. /// <param name="e"></param>
  88. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  89. {
  90. this.dgvBarcodeIdnrk.AutoResizeColumns();
  91. }
  92. /// <summary>
  93. /// 窗体关闭事件
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. private void F_RPT_080110_FormClosed(object sender, FormClosedEventArgs e)
  98. {
  99. _instance = null;
  100. }
  101. /// <summary>
  102. /// 关闭按钮
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void tsbtnClose_Click(object sender, EventArgs e)
  107. {
  108. this.Close();
  109. }
  110. /// <summary>
  111. /// 查询按钮事件
  112. /// </summary>
  113. /// <param name="sender"></param>
  114. /// <param name="e"></param>
  115. private void btnSearch_Click(object sender, EventArgs e)
  116. {
  117. try
  118. {
  119. this.dgvBarcodeIdnrk.DataSource = null;
  120. ClientRequestEntity cre = new ClientRequestEntity();
  121. cre.NameSpace = "F_RPT_080110";
  122. cre.Name = "GetBarCodeIdnrkRel";
  123. cre.Properties["BarCode"] = this.txtBarCode.Text.Trim();
  124. cre.Properties["Matnr"] = this.txtMatnr.Text.Trim();
  125. cre.Properties["Idnrk"] = this.txtIdnrk.Text.Trim();
  126. cre.Properties["IdnrkName"] = this.txtIdnrkName.Text.Trim();
  127. cre.Properties["CreateTimeBegin"] = this.dtpCreateTimeBegin.Value;
  128. cre.Properties["CreateTimeEnd"] = Convert.ToDateTime(this.dtpCreateTimeEnd.Value).AddSeconds(1);
  129. ServiceResultEntity sre = DoAsync(() =>
  130. {
  131. return PCModuleProxyNew.Service.HandleRequest(cre);
  132. });
  133. if (sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  134. {
  135. dgvBarcodeIdnrk.DataSource = sre.Data.Tables[0];
  136. tsbtnAdaptive_Click(null, null);
  137. }
  138. else
  139. {
  140. // 提示未查找到数据
  141. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  142. MessageBoxButtons.OK, MessageBoxIcon.Information);
  143. }
  144. }
  145. catch (Exception ex)
  146. {
  147. this.btnSearch.Enabled = true;
  148. this.btnClearCondition.Enabled = true;
  149. // 对异常进行共通处理
  150. ExceptionManager.HandleEventException(this.ToString(),
  151. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  152. }
  153. }
  154. /// <summary>
  155. /// 清空条件按钮事件
  156. /// </summary>
  157. /// <param name="sender"></param>
  158. /// <param name="e"></param>
  159. private void btnClearCondition_Click(object sender, EventArgs e)
  160. {
  161. this.txtIdnrkName.Text = "";
  162. this.txtIdnrk.Text = "";
  163. this.txtMatnr.Text = "";
  164. this.dtpCreateTimeBegin.Value = DateTime.Now.Date;
  165. this.dtpCreateTimeEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  166. this.txtBarCode.Text = "";
  167. }
  168. /// <summary>
  169. /// 编辑
  170. /// </summary>
  171. /// <param name="sender"></param>
  172. /// <param name="e"></param>
  173. private void tsbtnEdit_Click(object sender, EventArgs e)
  174. {
  175. try
  176. {
  177. if (this.dgvBarcodeIdnrk.CurrentCell != null)
  178. {
  179. F_RPT_080111 frm080111 = new F_RPT_080111();
  180. frm080111.DrValue = (this.dgvBarcodeIdnrk.CurrentRow.DataBoundItem as DataRowView).Row;
  181. frm080111.ShowDialog();
  182. if (DialogResult.OK.Equals(frm080111.DialogResult))
  183. {
  184. btnSearch_Click(null, null);
  185. }
  186. }
  187. }
  188. catch (Exception ex)
  189. {
  190. this.btnSearch.Enabled = true;
  191. this.btnClearCondition.Enabled = true;
  192. // 对异常进行共通处理
  193. ExceptionManager.HandleEventException(this.ToString(),
  194. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  195. }
  196. }
  197. /// <summary>
  198. /// 双击编辑
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. private void dgvBarcodeIdnrk_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  203. {
  204. try
  205. {
  206. if (this.dgvBarcodeIdnrk.CurrentCell != null)
  207. {
  208. tsbtnEdit_Click(null, null);
  209. }
  210. }
  211. catch (Exception ex)
  212. {
  213. this.btnSearch.Enabled = true;
  214. this.btnClearCondition.Enabled = true;
  215. // 对异常进行共通处理
  216. ExceptionManager.HandleEventException(this.ToString(),
  217. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  218. }
  219. }
  220. #endregion
  221. }
  222. }