F_RPT_040113.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. 
  2. /*******************************************************************************
  3. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  4. * 类的信息:
  5. * 1.程序名称:F_RPT_040113.cs
  6. * 2.功能描述:成品工艺质量表
  7. * 编辑履历:
  8. * 作者 日期 版本 修改内容
  9. * 陈晓野 2019/07/16 1.00 新建
  10. *******************************************************************************/
  11. using System;
  12. using System.Data;
  13. using System.Windows.Forms;
  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.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_040113 : DKDockPanelBase
  26. {
  27. #region 成员变量
  28. // 窗体的单例模式
  29. private static F_RPT_040113 _instance;
  30. private ClientRequestEntity _cre = null;
  31. private bool _init = false;
  32. #endregion
  33. #region 构造函数
  34. public F_RPT_040113()
  35. {
  36. InitializeComponent();
  37. // 窗体显示的Title
  38. this.Text = "成品工艺质量表";
  39. this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
  40. this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
  41. this.btnSearch.Text = ButtonText.BTN_SEARCH;
  42. this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
  43. this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
  44. }
  45. #endregion
  46. #region 单例模式
  47. /// <summary>
  48. /// 单例模式,防止重复创建窗体
  49. /// </summary>
  50. public static F_RPT_040113 Instance
  51. {
  52. get
  53. {
  54. if (_instance == null || _instance.IsDisposed)
  55. {
  56. _instance = new F_RPT_040113();
  57. }
  58. return _instance;
  59. }
  60. }
  61. #endregion
  62. #region 事件处理
  63. /// <summary>
  64. /// 窗体加载事件
  65. /// </summary>
  66. /// <param name="sender"></param>
  67. /// <param name="e"></param>
  68. private void F_RPT_040113_Load(object sender, EventArgs e)
  69. {
  70. try
  71. {
  72. // 加载权限
  73. FormPermissionManager.FormPermissionControl(this.Name, this,
  74. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  75. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  76. // 设置表格不自动创建列
  77. this.dgvRpt.AutoGenerateColumns = false;
  78. this.dgvD.AutoGenerateColumns = false;
  79. // 初始化时间控件为当前日期
  80. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  81. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  82. this.cmbGoodsType2.SelectedIndex = 0;
  83. this.chkTestMouldFlag.AllItemCheck();
  84. //绑定窑炉下来列表
  85. byte byFlage = Convert.ToByte(Constant.ValueFlag.Invalid);
  86. DataTable dtKilnInfo = ReportModuleProxy.Service.GetKilnData(byFlage).Data.Tables[Constant.INT_IS_ZERO];
  87. //xuwei modify 2021-03-13 启用梭式窑搜索
  88. //dtKilnInfo.DefaultView.RowFilter = "KilnCode not like 'S%'";
  89. //DataTable dtKilnInfo = sre2.Data.Tables[Constant.INT_IS_ZERO];
  90. DataRow newRowDic = dtKilnInfo.NewRow();
  91. newRowDic["KilnID"] = Constant.CBO_SELECT_ALL_VALUE;
  92. newRowDic["KilnCode"] = Constant.CBO_SELECT_ALL_NAME;
  93. dtKilnInfo.Rows.InsertAt(newRowDic, Constant.INT_IS_ZERO);
  94. this.dropKilnCode.DataSource = dtKilnInfo;
  95. this.dropKilnCode.ValueMember = "KilnID";
  96. this.dropKilnCode.DisplayMember = "KilnCode";
  97. }
  98. catch (Exception ex)
  99. {
  100. // 对异常进行共通处理
  101. ExceptionManager.HandleEventException(this.ToString(),
  102. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  103. }
  104. }
  105. /// <summary>
  106. /// 自动适应列宽
  107. /// </summary>
  108. /// <param name="sender"></param>
  109. /// <param name="e"></param>
  110. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  111. {
  112. this.dgvRpt.AutoResizeColumns();
  113. this.dgvD.AutoResizeColumns();
  114. }
  115. /// <summary>
  116. /// 窗体关闭事件
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void F_RPT_040113_FormClosed(object sender, FormClosedEventArgs e)
  121. {
  122. _instance = null;
  123. }
  124. /// <summary>
  125. /// 关闭按钮
  126. /// </summary>
  127. /// <param name="sender"></param>
  128. /// <param name="e"></param>
  129. private void tsbtnClose_Click(object sender, EventArgs e)
  130. {
  131. this.Close();
  132. }
  133. /// <summary>
  134. /// 查询按钮事件
  135. /// </summary>
  136. /// <param name="sender"></param>
  137. /// <param name="e"></param>
  138. private void btnSearch_Click(object sender, EventArgs e)
  139. {
  140. try
  141. {
  142. _init = true;
  143. this.dgvRpt.DataSource = null;
  144. this.dgvD.DataSource = null;
  145. _cre = new ClientRequestEntity();
  146. _cre.NameSpace = "R04";
  147. _cre.Name = "R040113";
  148. _cre.Properties["timebegin"] = this.dtpAccountDateStart.Value.Date;
  149. _cre.Properties["timeend"] = this.dtpAccountDateEnd.Value.Date.AddDays(1);
  150. if (this.cmbGoodsType2.Text == "大件")
  151. {
  152. _cre.Properties["gtcode2"] = "001001";
  153. }
  154. else if (this.cmbGoodsType2.Text == "小件")
  155. {
  156. _cre.Properties["gtcode2"] = "001002";
  157. }
  158. else
  159. {
  160. _cre.Properties["gtcode2"] = "[ALL]";
  161. }
  162. _cre.Properties["GoodsIDS"] = scbGoods.CheckedPKMember;
  163. if (!this.dropKilnCode.Text.Equals(Constant.CBO_SELECT_ALL_NAME))
  164. {
  165. _cre.Properties["KilnID"] = Convert.ToInt32(this.dropKilnCode.SelectedValue);
  166. }
  167. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  168. if (testMouldFlags.Length == 1)
  169. {
  170. _cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  171. }
  172. ServiceResultEntity resultEntity = DoAsync<ServiceResultEntity>(() =>
  173. {
  174. return ReportModuleProxy.Service.DoRequest(_cre);
  175. });
  176. if (resultEntity != null && resultEntity.Data != null &&
  177. resultEntity.Data.Tables.Count > 0)
  178. {
  179. this.dgvRpt.DataSource = resultEntity.Data.Tables[0];
  180. if (resultEntity.Data.Tables.Count > 1)
  181. {
  182. this.dgvD.DataSource = resultEntity.Data.Tables[1];
  183. }
  184. }
  185. }
  186. catch (Exception ex)
  187. {
  188. this.btnSearch.Enabled = true;
  189. this.btnClearCondition.Enabled = true;
  190. // 对异常进行共通处理
  191. ExceptionManager.HandleEventException(this.ToString(),
  192. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  193. }
  194. finally
  195. {
  196. _init = false;
  197. }
  198. }
  199. /// <summary>
  200. /// 清空条件按钮事件
  201. /// </summary>
  202. /// <param name="sender"></param>
  203. /// <param name="e"></param>
  204. private void btnClearCondition_Click(object sender, EventArgs e)
  205. {
  206. this.dtpAccountDateStart.Value = DateTime.Now.Date;
  207. this.dtpAccountDateEnd.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
  208. this.cmbGoodsType2.SelectedIndex = 0;
  209. this.dropKilnCode.SelectedIndex = 0;
  210. this.scbGoods.ClearValue();
  211. this.chkTestMouldFlag.AllItemCheck();
  212. }
  213. private void dgvRpt_SelectionChanged(object sender, EventArgs e)
  214. {
  215. if (_init || this.dgvRpt.CurrentRow == null)
  216. {
  217. return;
  218. }
  219. try
  220. {
  221. string pcode = this.dgvRpt.CurrentRow.Cells["g1pcode"].Value + "";
  222. if (pcode == "99")
  223. {
  224. this.dgvD.DataSource = null;
  225. return;
  226. }
  227. ClientRequestEntity cre = new ClientRequestEntity();
  228. cre.NameSpace = "R04";
  229. cre.Name = "R040113D";
  230. if (_cre != null)
  231. {
  232. cre.Properties["timebegin"] = _cre.Properties["timebegin"];
  233. cre.Properties["timeend"] = _cre.Properties["timeend"];
  234. cre.Properties["GoodsIDS"] = _cre.Properties["GoodsIDS"];
  235. cre.Properties["KilnID"] = _cre.Properties["KilnID"];
  236. cre.Properties["TestMouldFlag"] = _cre.Properties["TestMouldFlag"];
  237. }
  238. else
  239. {
  240. cre.Properties["timebegin"] = this.dtpAccountDateStart.Value.Date;
  241. cre.Properties["timeend"] = this.dtpAccountDateEnd.Value.Date.AddDays(1);
  242. object[] testMouldFlags = this.chkTestMouldFlag.SelectedValues;
  243. if (testMouldFlags.Length == 1)
  244. {
  245. _cre.Properties["TestMouldFlag"] = testMouldFlags[0].ToString();
  246. }
  247. }
  248. cre.Properties["pcode"] = this.dgvRpt.CurrentRow.Cells["g1pcode"].Value;
  249. cre.Properties["pname"] = this.dgvRpt.CurrentRow.Cells["g1pname"].Value;
  250. cre.Properties["gtcode2"] = this.dgvRpt.CurrentRow.Cells["g1gtcode2"].Value;
  251. ServiceResultEntity resultEntity = ReportModuleProxy.Service.DoRequest(cre);
  252. this.dgvD.DataSource = null;
  253. if (resultEntity != null || resultEntity.Data != null ||
  254. resultEntity.Data.Tables.Count > 0)
  255. {
  256. this.dgvD.DataSource = resultEntity.Data.Tables[0];
  257. }
  258. }
  259. catch (Exception ex)
  260. {
  261. this.btnSearch.Enabled = true;
  262. this.btnClearCondition.Enabled = true;
  263. // 对异常进行共通处理
  264. ExceptionManager.HandleEventException(this.ToString(),
  265. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  266. }
  267. }
  268. #endregion
  269. #region 私有方法
  270. #endregion
  271. }
  272. }