F_RPT_030114.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*******************************************************************************
  2. * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_030114.cs
  5. * 2.功能描述:废弃产品汇总表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/12/26 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.BaseResources;
  16. using Dongke.IBOSS.PRD.Client.CommonModule;
  17. using Dongke.IBOSS.PRD.Client.Controls;
  18. using Dongke.IBOSS.PRD.Client.DataModels;
  19. using Dongke.IBOSS.PRD.WCF.DataModels;
  20. using Dongke.IBOSS.PRD.WCF.Proxys;
  21. namespace Dongke.IBOSS.PRD.Client.ReportModule
  22. {
  23. /// <summary>
  24. /// 废弃产品汇总表
  25. /// </summary>
  26. public partial class F_RPT_030114 : DKDockPanelBase
  27. {
  28. #region 成员变量
  29. private static F_RPT_030114 _instance = null;
  30. #endregion
  31. #region 单例模式
  32. /// <summary>
  33. /// 单例模式,防止重复创建窗体
  34. /// </summary>
  35. public static F_RPT_030114 Instance
  36. {
  37. get
  38. {
  39. if (_instance == null)
  40. {
  41. _instance = new F_RPT_030114();
  42. }
  43. return _instance;
  44. }
  45. }
  46. #endregion
  47. #region 构造函数
  48. /// <summary>
  49. ///
  50. /// </summary>
  51. public F_RPT_030114()
  52. {
  53. InitializeComponent();
  54. this.Text = "废弃产品汇总表";
  55. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  56. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  57. this.dgvSum.AutoGenerateColumns = false;
  58. }
  59. #endregion
  60. #region 控件事件
  61. /// <summary>
  62. /// 关闭
  63. /// </summary>
  64. /// <param name="sender"></param>
  65. /// <param name="e"></param>
  66. private void F_PC_1001_FormClosed(object sender, FormClosedEventArgs e)
  67. {
  68. _instance = null;
  69. }
  70. /// <summary>
  71. /// 画面加载
  72. /// </summary>
  73. /// <param name="sender"></param>
  74. /// <param name="e"></param>
  75. private void F_PC_1001_Load(object sender, System.EventArgs e)
  76. {
  77. try
  78. {
  79. this.dtpMonth1.Value = DateTime.Now.AddMonths(-1);
  80. this.dtpMonth2.Value = DateTime.Now;
  81. DataTable dtSumType = new DataTable();
  82. dtSumType.Columns.Add("TypeID");
  83. dtSumType.Columns.Add("TypeName");
  84. dtSumType.Rows.Add(" ", "成型损坯");
  85. dtSumType.Rows.Add("0", "损坯");
  86. dtSumType.Rows.Add("1", "次品");
  87. dtSumType.Rows.Add("2", "半检不合格");
  88. dtSumType.Rows.Add("3", "复检不合格");
  89. dtSumType.Rows.Add("A", "干补");
  90. dtSumType.Rows.Add("B", "回收");
  91. this.ckcSumType.DataSource = dtSumType;
  92. this.ckcSumType.DisplayMember = "TypeName";
  93. this.ckcSumType.ValueMember = "TypeID";
  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 tsbtnSearch_Click(object sender, EventArgs e)
  108. {
  109. try
  110. {
  111. this.dgvSum.DataSource = null;
  112. this.QueryDataFromOther();
  113. }
  114. catch (Exception ex)
  115. {
  116. // 对异常进行共通处理
  117. ExceptionManager.HandleEventException(this.ToString(),
  118. MethodBase.GetCurrentMethod().Name, this.Text, ex);
  119. }
  120. }
  121. /// <summary>
  122. /// 清除条件
  123. /// </summary>
  124. /// <param name="sender"></param>
  125. /// <param name="e"></param>
  126. private void tsbtnClearCondition_Click(object sender, EventArgs e)
  127. {
  128. this.dtpMonth1.Value = DateTime.Now.AddMonths(-1);
  129. this.dtpMonth2.Value = DateTime.Now;
  130. this.scbGoods.ClearValue();
  131. this.scbGoodsType.ClearValue();
  132. this.ckcSumType.ClearValue();
  133. this.dkCProcedureSearchBox.Text = null;
  134. this.dkCProcedureSearchBox.ProcedureID = null;
  135. this.dkCProcedureSearchBox.ProcedureIDS = null;
  136. this.dkCProcedureSearchBox.ProcedureName = null;
  137. }
  138. /// <summary>
  139. /// 自适应列宽
  140. /// </summary>
  141. /// <param name="sender"></param>
  142. /// <param name="e"></param>
  143. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  144. {
  145. this.dgvSum.AutoResizeColumns();
  146. }
  147. /// <summary>
  148. /// 关闭画面
  149. /// </summary>
  150. /// <param name="sender"></param>
  151. /// <param name="e"></param>
  152. private void tsbtnClose_Click(object sender, EventArgs e)
  153. {
  154. this.Close();
  155. }
  156. #endregion
  157. #region 私有方法
  158. /// <summary>
  159. /// 查询数据
  160. /// </summary>
  161. private void QueryDataFromOther()
  162. {
  163. try
  164. {
  165. this.tsrToolStrip1.Focus();
  166. ClientRequestEntity cre = new ClientRequestEntity();
  167. cre.NameSpace = "R03";
  168. cre.Name = "R030114";
  169. cre.Properties["DateBegin"] = this.dtpMonth1.Value.Value;
  170. cre.Properties["DateEnd"] = this.dtpMonth2.Value.Value.AddMonths(1).AddSeconds(-1);
  171. cre.Properties["GoodsTypeCode"] = scbGoodsType.SearchedValue + "";
  172. if (!string.IsNullOrWhiteSpace(this.scbGoods.Text))
  173. {
  174. if (this.scbGoods.CheckedPKMember.Contains(","))
  175. {
  176. cre.Properties["GoodsIDs"] = scbGoods.CheckedPKMember;
  177. }
  178. else
  179. {
  180. cre.Properties["GoodsID"] = scbGoods.SearchedPKMember;
  181. }
  182. }
  183. //if (!string.IsNullOrWhiteSpace(this.dkCProcedureSearchBox.ProcedureIDS))
  184. //{
  185. // if (this.dkCProcedureSearchBox.ProcedureIDS.Contains(","))
  186. // {
  187. // cre.Properties["ProcedureIDs"] = this.dkCProcedureSearchBox.ProcedureIDS;
  188. // }
  189. // else
  190. // {
  191. // cre.Properties["ProcedureID"] = Convert.ToInt32(dkCProcedureSearchBox.ProcedureIDS);
  192. // }
  193. //}
  194. cre.Properties["ProcedureIDs"] = this.dkCProcedureSearchBox.ProcedureIDS;
  195. if (this.ckcSumType.CheckedState == CheckState.Indeterminate)
  196. {
  197. cre.Properties["ScrapTypes"] = this.ckcSumType.CheckedValue;
  198. }
  199. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  200. {
  201. return ReportModuleProxy.Service.DoRequest(cre);
  202. }
  203. );
  204. if (sre.Status == Constant.ServiceResultStatus.Success)
  205. {
  206. // 查询成功
  207. this.dgvSum.DataSource = sre.Data.Tables[0];
  208. }
  209. }
  210. catch (Exception ex)
  211. {
  212. throw ex;
  213. }
  214. }
  215. #endregion
  216. }
  217. }