F_PM_1901.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PM_1901.cs
  5. * 2.功能描述:注浆次数查询
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/17 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. using Dongke.IBOSS.PRD.Basics.BaseResources;
  15. using Dongke.IBOSS.PRD.Basics.DockPanel;
  16. using Dongke.IBOSS.PRD.WCF.Proxys;
  17. using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
  18. using Dongke.IBOSS.PRD.Client.CommonModule;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. namespace Dongke.IBOSS.PRD.Client.PMModule
  21. {
  22. public partial class F_PM_1901 : DockPanelBase
  23. {
  24. #region 成员变量
  25. //单例模式
  26. private static F_PM_1901 _instance;
  27. //查询用条件实体
  28. private GroutingCountByUserEntity _gcEntity = new GroutingCountByUserEntity();
  29. #endregion
  30. #region 构造函数
  31. public F_PM_1901()
  32. {
  33. InitializeComponent();
  34. }
  35. #endregion
  36. #region 单例模式
  37. /// <summary>
  38. /// 单例模式,防止重复创建窗体
  39. /// </summary>
  40. public static F_PM_1901 Instance
  41. {
  42. get
  43. {
  44. if (_instance == null)
  45. {
  46. _instance = new F_PM_1901();
  47. }
  48. return _instance;
  49. }
  50. }
  51. #endregion
  52. #region 事件
  53. private void F_PM_1901_Load(object sender, EventArgs e)
  54. {
  55. }
  56. private void btnSearch_Click(object sender, EventArgs e)
  57. {
  58. try
  59. {
  60. DataSet dsCount = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
  61. {
  62. return this.GetGroutingCount();
  63. }));
  64. if (dsCount != null)
  65. {
  66. if (dsCount.Tables.Count != Constant.INT_IS_ZERO)
  67. {
  68. this.dgvGroutingDaily.DataSource = ((DataSet)dsCount).Tables[Constant.INT_IS_ZERO];
  69. this.dgvGroutingDaily.ReadOnly = true;
  70. if (this.dgvGroutingDaily.Rows.Count == Constant.INT_IS_ZERO)
  71. {
  72. // 提示未查找到数据
  73. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  74. MessageBoxButtons.OK, MessageBoxIcon.Information);
  75. }
  76. }
  77. }
  78. else
  79. {
  80. // 提示未查找到数据
  81. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  82. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  83. }
  84. }
  85. catch (Exception ex)
  86. {
  87. // 对异常进行共通处理
  88. ExceptionManager.HandleEventException(this.ToString(),
  89. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  90. }
  91. }
  92. private void btnClearCondition_Click(object sender, EventArgs e)
  93. {
  94. this.txtGroutingLineCode.Text = string.Empty;
  95. this.txtGoodsCode.Text = string.Empty;
  96. this.txtUserCode.Text = string.Empty;
  97. this.scbGoodsType.ClearValue();
  98. }
  99. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  100. {
  101. this.dgvGroutingDaily.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  102. }
  103. private void tsbtnClose_Click(object sender, EventArgs e)
  104. {
  105. this.Close();
  106. }
  107. private void F_PM_1901_FormClosed(object sender, FormClosedEventArgs e)
  108. {
  109. _instance = null;
  110. }
  111. #endregion
  112. #region 私有方法
  113. /// <summary>
  114. /// 根据界面查询条件获取数据集
  115. /// </summary>
  116. private DataSet GetGroutingCount()
  117. {
  118. try
  119. {
  120. this.dgvGroutingDaily.AutoGenerateColumns = false;
  121. GroutingCountByUserEntity gcEntity = new GroutingCountByUserEntity();
  122. gcEntity.GroutingDateS = Convert.ToDateTime(this.txtGroutingDateStart.Text);
  123. gcEntity.GroutingDateE = Convert.ToDateTime(this.txtGroutingDateEnd.Text)
  124. .AddHours(23).AddMinutes(59).AddSeconds(59);
  125. gcEntity.GroutingLineCode = this.txtGroutingLineCode.Text.Trim();
  126. gcEntity.GoodsCode = this.txtGoodsCode.Text.Trim();
  127. gcEntity.UserCode = this.txtUserCode.Text.Trim();
  128. gcEntity.GoodsTypeCode = scbGoodsType.SearchedValue + "";
  129. return PMModuleProxy.Service.GetGroutingCountByUser(gcEntity);
  130. }
  131. catch (Exception ex)
  132. {
  133. throw ex;
  134. }
  135. }
  136. #endregion
  137. }
  138. }