F_SAP_HEGII_0105.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_SAP_HEGII_0105.cs
  5. * 2.功能描述:成品SAP日志
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * fy 2022/09/07 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.BaseControls;
  16. using Dongke.IBOSS.PRD.Basics.BaseResources;
  17. using Dongke.IBOSS.PRD.Client.CommonModule;
  18. using Dongke.IBOSS.PRD.Client.Controls;
  19. using Dongke.IBOSS.PRD.Client.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.DataModels;
  21. using Dongke.IBOSS.PRD.WCF.Proxys;
  22. namespace Dongke.IBOSS.PRD.Client.SAPDataModule
  23. {
  24. /// <summary>
  25. /// 成品SAP日志
  26. /// </summary>
  27. public partial class F_SAP_HEGII_0105 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. private static F_SAP_HEGII_0105 _instance = null;
  31. #endregion
  32. #region 单例模式
  33. /// <summary>
  34. /// 单例模式,防止重复创建窗体
  35. /// </summary>
  36. public static F_SAP_HEGII_0105 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_SAP_HEGII_0105();
  43. }
  44. return _instance;
  45. }
  46. }
  47. #endregion
  48. #region 构造函数
  49. /// <summary>
  50. /// 成品SAP日志
  51. /// </summary>
  52. public F_SAP_HEGII_0105()
  53. {
  54. InitializeComponent();
  55. this.Text = "跨车间作业同步日志";
  56. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  57. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  58. this.dgvLog.AutoGenerateColumns = false;
  59. this.dgvSum.AutoGenerateColumns = false;
  60. }
  61. #endregion
  62. #region 控件事件
  63. /// <summary>
  64. /// 关闭
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. private void F_SAP_HEGII_0105_FormClosed(object sender, FormClosedEventArgs e)
  69. {
  70. _instance = null;
  71. }
  72. /// <summary>
  73. /// 画面加载
  74. /// </summary>
  75. /// <param name="sender"></param>
  76. /// <param name="e"></param>
  77. private void F_SAP_HEGII_0105_Load(object sender, System.EventArgs e)
  78. {
  79. dgvLog.AutoGenerateColumns = false;
  80. dtpDatebegin.Value = DateTime.Now.Date;
  81. dtpDateend.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
  82. }
  83. /// <summary>
  84. /// 查询
  85. /// </summary>
  86. /// <param name="sender"></param>
  87. /// <param name="e"></param>
  88. private void tsbtnSearch_Click(object sender, EventArgs e)
  89. {
  90. try
  91. {
  92. //this.dgvLog.DataSource = null;
  93. this.QueryDataFromOther();
  94. }
  95. catch (Exception ex)
  96. {
  97. // 对异常进行共通处理
  98. ExceptionManager.HandleEventException(this.ToString(),
  99. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  100. }
  101. }
  102. /// <summary>
  103. /// 清除条件
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  108. {
  109. this.dtpDatebegin.Value = DateTime.Now.Date;
  110. this.dtpDateend.Value = DateTime.Now.Date.AddDays(1).AddMilliseconds(-1);
  111. }
  112. /// <summary>
  113. /// 自适应列宽
  114. /// </summary>
  115. /// <param name="sender"></param>
  116. /// <param name="e"></param>
  117. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  118. {
  119. this.dgvLog.AutoResizeColumns();
  120. this.dgvSum.AutoResizeColumns();
  121. }
  122. /// <summary>
  123. /// 关闭画面
  124. /// </summary>
  125. /// <param name="sender"></param>
  126. /// <param name="e"></param>
  127. private void tsbtnClose_Click(object sender, EventArgs e)
  128. {
  129. this.Close();
  130. }
  131. /// <summary>
  132. /// 查询同步明细
  133. /// </summary>
  134. /// <param name="sender"></param>
  135. /// <param name="e"></param>
  136. private void dgvLog_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  137. {
  138. if (e.RowIndex < 0 || this.dgvLog.CurrentRow == null)
  139. {
  140. return;
  141. }
  142. try
  143. {
  144. DataGridViewRow dgvr = this.dgvLog.CurrentRow;
  145. this.dgvSum.DataSource = null;
  146. ClientRequestEntity cre = new ClientRequestEntity();
  147. cre.NameSpace = "Hegii";
  148. cre.Name = "GetWorkData_kczzy";
  149. cre.Request = dgvr.Cells["logid"].Value;
  150. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  151. {
  152. return SAPDataModuleProxy.Service.DoRequest(cre);
  153. }
  154. );
  155. if (sre.Status == Constant.ServiceResultStatus.Success)
  156. {
  157. // 查询成功
  158. this.dgvSum.DataSource = sre.Data.Tables[0];
  159. }
  160. this.tabControl1.SelectedIndex = 1;
  161. }
  162. catch (Exception ex)
  163. {
  164. // 对异常进行共通处理
  165. ExceptionManager.HandleEventException(this.ToString(),
  166. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  167. }
  168. }
  169. #endregion
  170. #region 私有方法
  171. /// <summary>
  172. /// 查询数据
  173. /// </summary>
  174. private void QueryDataFromOther()
  175. {
  176. if (this.dtpDatebegin.Value == null ||
  177. this.dtpDateend.Value == null)
  178. {
  179. return;
  180. }
  181. try
  182. {
  183. this.tsrToolStrip1.Focus();
  184. int Indexed = this.tabControl1.SelectedIndex;
  185. ClientRequestEntity cre = new ClientRequestEntity();
  186. cre.NameSpace = "Hegii";
  187. cre.Properties["datebegin"] = this.dtpDatebegin.Value;
  188. cre.Properties["dateend"] = Convert.ToDateTime( this.dtpDateend.Value).AddSeconds(1);
  189. if(Indexed == 0)
  190. {
  191. this.dgvLog.DataSource = null;
  192. cre.Name = "GetDataLog_kczzy";
  193. }
  194. else if (Indexed == 1)
  195. {
  196. this.dgvSum.DataSource = null;
  197. cre.Name = "GetWorkData_kczzy";
  198. }
  199. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  200. {
  201. return SAPDataModuleProxy.Service.DoRequest(cre);
  202. }
  203. );
  204. if (sre.Status == Constant.ServiceResultStatus.Success)
  205. {
  206. if(Indexed == 0)
  207. {
  208. // 查询成功
  209. this.dgvLog.DataSource = sre.Data.Tables[0];
  210. // this.tabControl1.SelectedIndex = 0;
  211. if (this.dgvLog.RowCount == 0)
  212. {
  213. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
  214. }
  215. }
  216. else if (Indexed == 1)
  217. {
  218. // 查询成功
  219. this.dgvSum.DataSource = sre.Data.Tables[0];
  220. if (this.dgvSum.RowCount == 0)
  221. {
  222. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
  223. }
  224. }
  225. }
  226. }
  227. catch (Exception ex)
  228. {
  229. throw ex;
  230. }
  231. }
  232. #endregion
  233. }
  234. }