F_RPT_010201_1.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_010201_1.cs
  5. * 2.功能描述:工序漏扫明细表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 袁新成 2015/4/10 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.Controls.FormCommon;
  17. using Dongke.IBOSS.PRD.Client.DataModels;
  18. using Dongke.IBOSS.PRD.WCF.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.Proxys;
  20. namespace Dongke.IBOSS.PRD.Client.ReportModule
  21. {
  22. /// <summary>
  23. /// 工序产量统计表
  24. /// </summary>
  25. public partial class F_RPT_010201_1 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 窗体的单例模式
  29. private static F_RPT_010201_1 _instance;
  30. #endregion
  31. #region 构造函数
  32. public F_RPT_010201_1()
  33. {
  34. InitializeComponent();
  35. // 窗体显示的Title
  36. this.Text = FormTitles.F_RPT_010201;
  37. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  38. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  39. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  40. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  41. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  42. }
  43. #endregion
  44. #region 单例模式
  45. /// <summary>
  46. /// 单例模式,防止重复创建窗体
  47. /// </summary>
  48. public static F_RPT_010201_1 Instance
  49. {
  50. get
  51. {
  52. if (_instance == null || _instance.IsDisposed)
  53. {
  54. _instance = new F_RPT_010201_1();
  55. }
  56. return _instance;
  57. }
  58. }
  59. #endregion
  60. #region 事件处理
  61. /// <summary>
  62. /// 窗体加载事件
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_RPT_010201_1_Load(object sender, EventArgs e)
  67. {
  68. try
  69. {
  70. // 加载权限
  71. // 加载权限
  72. FormPermissionManager.FormPermissionControl(this.Name, this,
  73. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  74. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  75. // 设置表格不自动创建列
  76. this.dgvReportModule.AutoGenerateColumns = false;
  77. this.scbOrganization.Focus();
  78. // 初始化时间控件为当前日期
  79. this.btnClearCondition_Click(null, null);
  80. }
  81. catch (Exception ex)
  82. {
  83. // 对异常进行共通处理
  84. ExceptionManager.HandleEventException(this.ToString(),
  85. System.Reflection.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 F_RPT_010201_1_FormClosed(object sender, FormClosedEventArgs e)
  94. {
  95. _instance = null;
  96. }
  97. /// <summary>
  98. /// 关闭按钮
  99. /// </summary>
  100. /// <param name="sender"></param>
  101. /// <param name="e"></param>
  102. private void tsbtnClose_Click(object sender, EventArgs e)
  103. {
  104. this.Close();
  105. }
  106. /// <summary>
  107. /// 查询按钮事件
  108. /// </summary>
  109. /// <param name="sender"></param>
  110. /// <param name="e"></param>
  111. private void btnSearch_Click(object sender, EventArgs e)
  112. {
  113. try
  114. {
  115. this.dgvReportModule.DataSource = null;
  116. this.dgvReportModule.DataSource = this.GetSearchData();
  117. }
  118. catch (Exception ex)
  119. {
  120. this.btnSearch.Enabled = true;
  121. this.btnClearCondition.Enabled = true;
  122. // 对异常进行共通处理
  123. ExceptionManager.HandleEventException(this.ToString(),
  124. System.Reflection.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 btnClearCondition_Click(object sender, EventArgs e)
  133. {
  134. this.scbOrganization.ClearValue();
  135. this.scbGoods.ClearValue();
  136. this.scbGoodsType.ClearValue();
  137. this.dkProcedureSearchBox.ClearControl();
  138. this.dkmissingProcedureSearchBox.ClearControl();
  139. this.dkcompleteProcedureSearchBox.ClearControl();
  140. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  141. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  142. }
  143. /// <summary>
  144. /// 自动适应列宽
  145. /// </summary>
  146. /// <param name="sender"></param>
  147. /// <param name="e"></param>
  148. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  149. {
  150. this.dgvReportModule.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  151. }
  152. #endregion
  153. #region 私有方法
  154. /// <summary>
  155. /// 根据界面查询条件获取数据集
  156. /// </summary>
  157. private DataTable GetSearchData()
  158. {
  159. try
  160. {
  161. RPT010201_SE se = new RPT010201_SE();
  162. se.OrganizationIDS = this.scbOrganization.CheckedPKMember;
  163. se.CompleteProcedureIDS = this.dkcompleteProcedureSearchBox.ProcedureIDS;
  164. se.ProcedureIDS = this.dkProcedureSearchBox.ProcedureIDS;
  165. se.MissingProcedureIDS = this.dkmissingProcedureSearchBox.ProcedureIDS;
  166. se.GoodsIDS = this.scbGoods.CheckedPKMember;
  167. se.GoodsTypeIDS = scbGoodsType.SearchedValue + "";
  168. se.beginCreateTime = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd HH:mm") + ":00");
  169. se.endCreateTime = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd HH:mm") + ":59");
  170. // 调用服务器端获取数据集
  171. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  172. {
  173. return ReportModuleProxy.Service.GetRPT010201SData(se);
  174. }
  175. );
  176. if (sre.Status == Constant.ServiceResultStatus.Success)
  177. {
  178. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  179. {
  180. // 提示未查找到数据
  181. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  182. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  183. //清空数据
  184. return null;
  185. }
  186. return sre.Data.Tables[0];
  187. }
  188. return null;
  189. }
  190. catch (Exception ex)
  191. {
  192. throw ex;
  193. }
  194. }
  195. /// <summary>
  196. /// 漏扫工号按钮事件
  197. /// </summary>
  198. /// <param name="sender"></param>
  199. /// <param name="e"></param>
  200. private void tsbtnMissed_Click(object sender, EventArgs e)
  201. {
  202. try
  203. {
  204. if (this.dgvReportModule.CurrentRow != null)
  205. {
  206. if (this.dgvReportModule.CurrentRow.Cells["BarCode"].Value.ToString() != "--")
  207. {
  208. int missid = Convert.ToInt32(this.dgvReportModule.CurrentRow.Cells["MissID"].Value);
  209. string groutingusercode = this.dgvReportModule.CurrentRow.Cells["MissUserCode"].Value.ToString();
  210. S_CMN_020 frm202 = new S_CMN_020(missid, "", groutingusercode);
  211. frm202.ShowDialog();
  212. }
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. // 对异常进行共通处理
  218. ExceptionManager.HandleEventException(this.ToString(),
  219. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  220. }
  221. }
  222. #endregion
  223. }
  224. }