F_SAP_HEGII_0106.cs 7.4 KB

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