F_SAP_HEGII_0102.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_SAP_HEGII_0102.cs
  5. * 2.功能描述:成品SAP日志
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2018/11/13 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_0102 : DKDockPanelBase
  28. {
  29. #region 成员变量
  30. private static F_SAP_HEGII_0102 _instance = null;
  31. #endregion
  32. #region 单例模式
  33. /// <summary>
  34. /// 单例模式,防止重复创建窗体
  35. /// </summary>
  36. public static F_SAP_HEGII_0102 Instance
  37. {
  38. get
  39. {
  40. if (_instance == null)
  41. {
  42. _instance = new F_SAP_HEGII_0102();
  43. }
  44. return _instance;
  45. }
  46. }
  47. #endregion
  48. #region 构造函数
  49. /// <summary>
  50. /// 成品SAP日志
  51. /// </summary>
  52. public F_SAP_HEGII_0102()
  53. {
  54. InitializeComponent();
  55. this.Text = "成品SAP日志";
  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_0102_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_0102_Load(object sender, System.EventArgs e)
  78. {
  79. try
  80. {
  81. // 加载权限
  82. //FormPermissionManager.FormPermissionControl(this.Name, this,
  83. // LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  84. // LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  85. this.dtpDatebegin.Value = DateTime.Now.Date;
  86. this.dtpDateend.Value = DateTime.Now.Date;
  87. }
  88. catch (Exception ex)
  89. {
  90. // 对异常进行共通处理
  91. ExceptionManager.HandleEventException(this.ToString(),
  92. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  93. }
  94. }
  95. /// <summary>
  96. /// 查询
  97. /// </summary>
  98. /// <param name="sender"></param>
  99. /// <param name="e"></param>
  100. private void tsbtnSearch_Click(object sender, EventArgs e)
  101. {
  102. try
  103. {
  104. this.dgvLog.DataSource = null;
  105. this.QueryDataFromOther();
  106. }
  107. catch (Exception ex)
  108. {
  109. // 对异常进行共通处理
  110. ExceptionManager.HandleEventException(this.ToString(),
  111. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  112. }
  113. }
  114. /// <summary>
  115. /// 清除条件
  116. /// </summary>
  117. /// <param name="sender"></param>
  118. /// <param name="e"></param>
  119. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  120. {
  121. this.dtpDatebegin.Value = DateTime.Now.Date;
  122. this.dtpDateend.Value = DateTime.Now.Date;
  123. }
  124. /// <summary>
  125. /// 自适应列宽
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  130. {
  131. this.dgvLog.AutoResizeColumns();
  132. this.dgvSum.AutoResizeColumns();
  133. }
  134. /// <summary>
  135. /// 关闭画面
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void tsbtnClose_Click(object sender, EventArgs e)
  140. {
  141. this.Close();
  142. }
  143. /// <summary>
  144. /// 查询同步明细
  145. /// </summary>
  146. /// <param name="sender"></param>
  147. /// <param name="e"></param>
  148. private void dgvLog_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  149. {
  150. if (e.RowIndex < 0 || this.dgvLog.CurrentRow == null)
  151. {
  152. return;
  153. }
  154. try
  155. {
  156. this.dgvSum.DataSource = null;
  157. ClientRequestEntity cre = new ClientRequestEntity();
  158. cre.NameSpace = "Hegii";
  159. cre.Name = "GetWorkDataByDataLog";
  160. cre.Request = this.dgvLog.CurrentRow.Cells["logid"].Value;
  161. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  162. {
  163. return SAPDataModuleProxy.Service.DoRequest(cre);
  164. }
  165. );
  166. if (sre.Status == Constant.ServiceResultStatus.Success)
  167. {
  168. // 查询成功
  169. this.dgvSum.DataSource = sre.Data.Tables[0];
  170. }
  171. this.tabControl1.SelectedIndex = 1;
  172. }
  173. catch (Exception ex)
  174. {
  175. // 对异常进行共通处理
  176. ExceptionManager.HandleEventException(this.ToString(),
  177. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  178. }
  179. }
  180. #endregion
  181. #region 私有方法
  182. /// <summary>
  183. /// 查询数据
  184. /// </summary>
  185. private void QueryDataFromOther()
  186. {
  187. if (this.dtpDatebegin.Value == null ||
  188. this.dtpDateend.Value == null)
  189. {
  190. return;
  191. }
  192. try
  193. {
  194. this.tsrToolStrip1.Focus();
  195. this.dgvLog.DataSource = null;
  196. ClientRequestEntity cre = new ClientRequestEntity();
  197. cre.NameSpace = "Hegii";
  198. cre.Name = "GetDataLog";
  199. cre.Properties["datebegin"] = this.dtpDatebegin.Value.Value.ToString("yyyyMMdd");
  200. cre.Properties["dateend"] = this.dtpDateend.Value.Value.ToString("yyyyMMdd");
  201. cre.Properties["datacode"] = "60";
  202. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  203. {
  204. return SAPDataModuleProxy.Service.DoRequest(cre);
  205. }
  206. );
  207. if (sre.Status == Constant.ServiceResultStatus.Success)
  208. {
  209. // 查询成功
  210. this.dgvLog.DataSource = sre.Data.Tables[0];
  211. this.tabControl1.SelectedIndex = 0;
  212. if (this.dgvLog.RowCount == 0)
  213. {
  214. DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
  215. }
  216. }
  217. }
  218. catch (Exception ex)
  219. {
  220. throw ex;
  221. }
  222. }
  223. #endregion
  224. }
  225. }