F_RPT_020105.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_020105.cs
  5. * 2.功能描述:模具跟踪表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/12/26 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Reflection;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. /// <summary>
  24. /// 模具跟踪表
  25. /// </summary>
  26. public partial class F_RPT_020105 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. private static F_RPT_020105 _instance = null;
  30. #endregion
  31. #region 单例模式
  32. /// <summary>
  33. /// 单例模式,防止重复创建窗体
  34. /// </summary>
  35. public static F_RPT_020105 Instance
  36. {
  37. get
  38. {
  39. if (_instance == null)
  40. {
  41. _instance = new F_RPT_020105();
  42. }
  43. return _instance;
  44. }
  45. }
  46. #endregion
  47. #region 构造函数
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. public F_RPT_020105()
  52. {
  53. InitializeComponent();
  54. this.Text = "模具跟踪表";
  55. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  56. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  57. this.dgvMould.AutoGenerateColumns = false;
  58. this.dgvTracking.AutoGenerateColumns = false;
  59. }
  60. #endregion
  61. #region 控件事件
  62. /// <summary>
  63. /// 关闭
  64. /// </summary>
  65. /// <param name="sender"></param>
  66. /// <param name="e"></param>
  67. private void F_PC_1001_FormClosed(object sender, FormClosedEventArgs e)
  68. {
  69. _instance = null;
  70. }
  71. /// <summary>
  72. /// 画面加载
  73. /// </summary>
  74. /// <param name="sender"></param>
  75. /// <param name="e"></param>
  76. private void F_PC_1001_Load(object sender, System.EventArgs e)
  77. {
  78. try
  79. {
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  86. }
  87. }
  88. /// <summary>
  89. /// 查询
  90. /// </summary>
  91. /// <param name="sender"></param>
  92. /// <param name="e"></param>
  93. private void tsbtnSearch_Click(object sender, EventArgs e)
  94. {
  95. try
  96. {
  97. this.QueryDataFromOther();
  98. }
  99. catch (Exception ex)
  100. {
  101. // 对异常进行共通处理
  102. ExceptionManager.HandleEventException(this.ToString(),
  103. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  104. }
  105. }
  106. /// <summary>
  107. /// 查询
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void txtModelBarcode_KeyDown(object sender, KeyEventArgs e)
  112. {
  113. try
  114. {
  115. if (e.KeyCode == Keys.Enter)
  116. {
  117. this.QueryDataFromOther();
  118. }
  119. }
  120. catch (Exception ex)
  121. {
  122. // 对异常进行共通处理
  123. ExceptionManager.HandleEventException(this.ToString(),
  124. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  125. }
  126. }
  127. /// <summary>
  128. /// 自适应列宽
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  133. {
  134. this.dgvMould.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  135. this.dgvTracking.AutoResizeColumns();
  136. }
  137. /// <summary>
  138. /// 关闭画面
  139. /// </summary>
  140. /// <param name="sender"></param>
  141. /// <param name="e"></param>
  142. private void tsbtnClose_Click(object sender, EventArgs e)
  143. {
  144. this.Close();
  145. }
  146. #endregion
  147. #region 私有方法
  148. /// <summary>
  149. /// 查询数据
  150. /// </summary>
  151. private void QueryDataFromOther()
  152. {
  153. try
  154. {
  155. this.tsrToolStrip1.Focus();
  156. if (string.IsNullOrWhiteSpace(this.txtModelBarcode.Text))
  157. {
  158. MessageBox.Show("没有输入模具条码", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  159. this.txtModelBarcode.Focus();
  160. return;
  161. }
  162. ClientRequestEntity cre = new ClientRequestEntity();
  163. cre.NameSpace = "R02";
  164. cre.Name = "R020105";
  165. cre.Properties["MouldBarcode"] = this.txtModelBarcode.Text.Trim();
  166. this.dgvMould.DataSource = null;
  167. this.dgvTracking.DataSource = null;
  168. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  169. {
  170. return ReportModuleProxy.Service.DoRequest(cre);
  171. }
  172. );
  173. if (sre.Status == Constant.ServiceResultStatus.Success)
  174. {
  175. // 查询成功
  176. this.dgvMould.DataSource = sre.Data.Tables[0];
  177. this.dgvTracking.DataSource = sre.Data.Tables[1];
  178. this.txtModelBarcode.Clear();
  179. }
  180. else
  181. {
  182. this.txtModelBarcode.SelectAll();
  183. }
  184. this.txtModelBarcode.Focus();
  185. }
  186. catch (Exception ex)
  187. {
  188. throw ex;
  189. }
  190. }
  191. #endregion
  192. }
  193. }