F_RPT_040109.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. /*******************************************************************************
  2. * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_RPT_040109.cs
  5. * 2.功能描述:整体质量分析表
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2016/11/09 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Data;
  13. using System.Text;
  14. using System.Windows.Forms;
  15. using Dongke.IBOSS.PRD.Basics.BaseResources;
  16. using Dongke.IBOSS.PRD.Basics.DockPanel;
  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.ReportModule
  23. {
  24. public partial class F_RPT_040109 : DKDockPanelBase
  25. {
  26. #region 成员变量
  27. // 窗体的单例模式
  28. private static F_RPT_040109 _instance;
  29. private DataTable g2DataTable = new DataTable();
  30. private DataTable g3DataTable = new DataTable();
  31. private int _minimumWidth = 40;
  32. #endregion
  33. #region 构造函数
  34. public F_RPT_040109()
  35. {
  36. InitializeComponent();
  37. // 窗体显示的Title
  38. //this.Text = FormTitles.F_RPT_040105;
  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. g2DataTable.Columns.Add("goodstypename2");
  45. g3DataTable.Columns.Add("goodstypename2");
  46. g2DataTable.Rows.Add(new object[] { "成品率(%)" });
  47. g3DataTable.Rows.Add(new object[] { "缺陷率(%)" });
  48. // 缺陷位置 id:29 code:50 连体盖 一厂【5010】除生控工号【102】外不统计
  49. this.chkDP50.Visible = false;
  50. this.chkDP50.Checked = true;
  51. if (ProxySettings.LoginUserInfo.TAG_CODE == "HEGII" && ProxySettings.LoginUserInfo.WORK_CODE == "5010")
  52. {
  53. this.chkDP50.Visible = true;
  54. this.chkDP50.Checked = false;
  55. if (ProxySettings.LoginUserInfo.UserCode == "102")
  56. {
  57. this.chkDP50.Checked = true;
  58. }
  59. }
  60. }
  61. #endregion
  62. #region 单例模式
  63. /// <summary>
  64. /// 单例模式,防止重复创建窗体
  65. /// </summary>
  66. public static F_RPT_040109 Instance
  67. {
  68. get
  69. {
  70. if (_instance == null || _instance.IsDisposed)
  71. {
  72. _instance = new F_RPT_040109();
  73. }
  74. return _instance;
  75. }
  76. }
  77. #endregion
  78. #region 事件处理
  79. /// <summary>
  80. /// 窗体加载事件
  81. /// </summary>
  82. /// <param name="sender"></param>
  83. /// <param name="e"></param>
  84. private void F_RPT_040104_Load(object sender, EventArgs e)
  85. {
  86. try
  87. {
  88. // 加载权限
  89. FormPermissionManager.FormPermissionControl(this.Name, this,
  90. LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
  91. LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
  92. //绑定下了列表
  93. BindPage();
  94. // 设置表格不自动创建列
  95. this.dgvTQ.AutoGenerateColumns = false;
  96. this.dgvTQ1.AutoGenerateColumns = false;
  97. this.dgvFR.AutoGenerateColumns = false;
  98. this.dgvDR.AutoGenerateColumns = false;
  99. this.dgvDL.AutoGenerateColumns = false;
  100. this.dropRptProcedure.Focus();
  101. // 初始化时间控件为当前日期
  102. DateTime now = DateTime.Now.Date;
  103. this.dtpAccountDateStart.Value = now;
  104. this.dtpAccountDateEnd.Value = now.AddDays(1).AddSeconds(-1);
  105. //getPurviewLine();
  106. this.dgvFR.DataSource = this.g2DataTable;
  107. this.dgvDR.DataSource = this.g3DataTable;
  108. }
  109. catch (Exception ex)
  110. {
  111. // 对异常进行共通处理
  112. ExceptionManager.HandleEventException(this.ToString(),
  113. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  114. }
  115. }
  116. /// <summary>
  117. /// 自动适应列宽
  118. /// </summary>
  119. /// <param name="sender"></param>
  120. /// <param name="e"></param>
  121. private void tsbtnAdaptive_Click(object sender, EventArgs e)
  122. {
  123. this.dgvTQ.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  124. this.dgvTQ1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  125. this.dgvFR.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  126. this.dgvDR.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  127. this.dgvDL.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
  128. }
  129. /// <summary>
  130. /// 窗体关闭事件
  131. /// </summary>
  132. /// <param name="sender"></param>
  133. /// <param name="e"></param>
  134. private void F_RPT_040104_FormClosed(object sender, FormClosedEventArgs e)
  135. {
  136. _instance = null;
  137. }
  138. /// <summary>
  139. /// 关闭按钮
  140. /// </summary>
  141. /// <param name="sender"></param>
  142. /// <param name="e"></param>
  143. private void tsbtnClose_Click(object sender, EventArgs e)
  144. {
  145. this.Close();
  146. }
  147. /// <summary>
  148. /// 查询按钮事件
  149. /// </summary>
  150. /// <param name="sender"></param>
  151. /// <param name="e"></param>
  152. private void btnSearch_Click(object sender, EventArgs e)
  153. {
  154. try
  155. {
  156. //this.tabcData.SelectedIndex = 0;
  157. //this.tabcData.Enabled = false;
  158. this.dgvFR.HorizontalMergeColumn = null;
  159. this.dgvTQ.DataSource = null;
  160. this.dgvTQ1.DataSource = null;
  161. this.dgvFR.DataSource = this.g2DataTable;
  162. this.dgvDR.DataSource = this.g3DataTable;
  163. this.dgvDL.DataSource = null;
  164. List<string> removeAt = new List<string>();
  165. foreach (DataGridViewColumn item in this.dgvFR.Columns)
  166. {
  167. if (!item.Name.StartsWith("g"))
  168. {
  169. removeAt.Add(item.Name);
  170. }
  171. }
  172. foreach (string item in removeAt)
  173. {
  174. this.dgvFR.Columns.Remove(item);
  175. }
  176. removeAt.Clear();
  177. TreeNode top = this.g2TV.Nodes[0];
  178. this.g2TV.Nodes.Clear();
  179. this.g2TV.Nodes.Add(top);
  180. top = this.g3TV.Nodes[0];
  181. this.g3TV.Nodes.Clear();
  182. this.g3TV.Nodes.Add(top);
  183. foreach (DataGridViewColumn item in this.dgvDR.Columns)
  184. {
  185. if (!item.Name.StartsWith("g"))
  186. {
  187. removeAt.Add(item.Name);
  188. }
  189. }
  190. foreach (string item in removeAt)
  191. {
  192. this.dgvDR.Columns.Remove(item);
  193. }
  194. removeAt.Clear();
  195. foreach (DataGridViewColumn item in this.dgvDL.Columns)
  196. {
  197. if (!item.Name.StartsWith("g"))
  198. {
  199. removeAt.Add(item.Name);
  200. }
  201. }
  202. foreach (string item in removeAt)
  203. {
  204. this.dgvDL.Columns.Remove(item);
  205. }
  206. removeAt.Clear();
  207. DataSet dataSet = this.GetSearchData();
  208. if (dataSet == null)
  209. {
  210. return;
  211. }
  212. List<string> colHB = new List<string>();
  213. foreach (DataRow item in dataSet.Tables["DT"].Rows)
  214. {
  215. List<int> colHBCell = new List<int>();
  216. string dtID = "T" + item["defecttypeid"].ToString();
  217. string dtName = item["defecttypeName"].ToString();
  218. // 缺陷排行
  219. DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
  220. col.Name = "a4" + dtID;
  221. col.HeaderText = dtName;
  222. col.DataPropertyName = dtID;
  223. DataGridViewCellStyle dgvcs = new System.Windows.Forms.DataGridViewCellStyle();
  224. dgvcs.Alignment = DataGridViewContentAlignment.MiddleRight;
  225. dgvcs.NullValue = "0";
  226. dgvcs.Format = "N0";
  227. col.DefaultCellStyle = dgvcs;
  228. col.ReadOnly = true;
  229. this.dgvDL.Columns.Add(col);
  230. // 成品率
  231. #region 成品率
  232. TreeNode tnDTA2 = new TreeNode(dtName);
  233. tnDTA2.Name = "a2" + dtID;
  234. DataRow[] wgs = dataSet.Tables["WG"].Select("defecttypeid = " + item["defecttypeid"]);
  235. if (wgs == null || wgs.Length == 0)
  236. {
  237. foreach (DataRow drDF in dataSet.Tables["DF"].Rows)
  238. {
  239. string dfID = "F" + drDF["defectfineid"];
  240. string dfName = drDF["defectfinecode"].ToString();
  241. TreeNode tnDF = new TreeNode(dfName);
  242. tnDF.Name = tnDTA2.Name + "W" + dfID;
  243. tnDTA2.Nodes.Add(tnDF);
  244. DataGridViewTextBoxColumn colDF = new DataGridViewTextBoxColumn();
  245. colDF.Name = tnDF.Name;
  246. colDF.MinimumWidth = this._minimumWidth;
  247. colDF.HeaderText = tnDF.Text;
  248. colDF.DataPropertyName = dtID + "W" + dfID;
  249. DataGridViewCellStyle dgvcsDF = new System.Windows.Forms.DataGridViewCellStyle();
  250. dgvcsDF.Alignment = DataGridViewContentAlignment.MiddleRight;
  251. colDF.DefaultCellStyle = dgvcsDF;
  252. colDF.SortMode = DataGridViewColumnSortMode.NotSortable;
  253. colDF.ReadOnly = true;
  254. this.dgvFR.Columns.Add(colDF);
  255. colHBCell.Add(colDF.Index);
  256. }
  257. }
  258. else
  259. {
  260. foreach (DataRow drWG in wgs)
  261. {
  262. string wgID = "W" + drWG["workergroupid"];
  263. string wgName = drWG["workergroupName"].ToString();
  264. TreeNode tnWG = new TreeNode(wgName);
  265. tnWG.Name = tnDTA2.Name + wgID;
  266. tnDTA2.Nodes.Add(tnWG);
  267. foreach (DataRow drDF in dataSet.Tables["DF"].Rows)
  268. {
  269. string dfID = "F" + drDF["defectfineid"];
  270. string dfName = drDF["defectfinecode"].ToString();
  271. TreeNode tnDF = new TreeNode(dfName);
  272. tnDF.Name = tnWG.Name + dfID;
  273. tnWG.Nodes.Add(tnDF);
  274. DataGridViewTextBoxColumn colDF = new DataGridViewTextBoxColumn();
  275. colDF.Name = tnDF.Name;
  276. colDF.HeaderText = tnDF.Text;
  277. colDF.MinimumWidth = this._minimumWidth;
  278. colDF.DataPropertyName = dtID + wgID + dfID;
  279. DataGridViewCellStyle dgvcsDF = new System.Windows.Forms.DataGridViewCellStyle();
  280. dgvcsDF.Alignment = DataGridViewContentAlignment.MiddleRight;
  281. colDF.DefaultCellStyle = dgvcsDF;
  282. colDF.ReadOnly = true;
  283. colDF.SortMode = DataGridViewColumnSortMode.NotSortable;
  284. this.dgvFR.Columns.Add(colDF);
  285. colHBCell.Add(colDF.Index);
  286. }
  287. }
  288. }
  289. this.g2TV.Nodes.Add(tnDTA2);
  290. colHB.Add(string.Join(",", colHBCell.ToArray()));
  291. #endregion
  292. // 缺陷率
  293. #region 缺陷率
  294. DataRow[] tdr = dataSet.Tables["DR1"].Select("tid = '" + dtID + "'");
  295. string dta3Name = dtName;
  296. if (tdr != null && tdr.Length > 0)
  297. {
  298. //dta3Name += Convert.ToDecimal(tdr[0]["DefectRate"]).ToString("(#,##0.00%)");
  299. dta3Name += (tdr[0]["DefectRate"] == DBNull.Value ? "(" + Constant.DIV0 + ")" : Convert.ToDecimal(tdr[0]["DefectRate"]).ToString("(#,##0.00%)"));
  300. }
  301. else
  302. {
  303. dta3Name += "(0.00%)";
  304. }
  305. TreeNode tnDTA3 = new TreeNode(dta3Name);
  306. tnDTA3.Name = "a3" + dtID;
  307. DataRow[] ds = dataSet.Tables["D"].Select("defectid is not null and defecttypeid = " + item["defecttypeid"], "displayno");
  308. if (ds == null || ds.Length == 0)
  309. {
  310. foreach (DataRow drDF in dataSet.Tables["DF"].Rows)
  311. {
  312. string dfID = "F" + drDF["defectfineid"];
  313. string dfName = drDF["defectfinecode"].ToString();
  314. TreeNode tnDF = new TreeNode(dfName);
  315. tnDF.Name = tnDTA3.Name + "D" + dfID;
  316. tnDTA3.Nodes.Add(tnDF);
  317. DataGridViewTextBoxColumn colDF = new DataGridViewTextBoxColumn();
  318. colDF.Name = tnDF.Name;
  319. colDF.HeaderText = tnDF.Text;
  320. colDF.MinimumWidth = this._minimumWidth;
  321. colDF.DataPropertyName = dtID + "D" + dfID;
  322. DataGridViewCellStyle dgvcsDF = new System.Windows.Forms.DataGridViewCellStyle();
  323. dgvcsDF.Alignment = DataGridViewContentAlignment.MiddleRight;
  324. colDF.DefaultCellStyle = dgvcsDF;
  325. colDF.SortMode = DataGridViewColumnSortMode.NotSortable;
  326. colDF.ReadOnly = true;
  327. this.dgvDR.Columns.Add(colDF);
  328. }
  329. }
  330. else
  331. {
  332. foreach (DataRow drD in ds)
  333. {
  334. string dID = "D" + drD["defectid"];
  335. string dName = drD["defectname"].ToString();
  336. TreeNode tnD = new TreeNode(dName);
  337. tnD.Name = tnDTA3.Name + dID;
  338. tnDTA3.Nodes.Add(tnD);
  339. foreach (DataRow drDF in dataSet.Tables["DF"].Rows)
  340. {
  341. string dfID = "F" + drDF["defectfineid"];
  342. string dfName = drDF["defectfinecode"].ToString();
  343. TreeNode tnDF = new TreeNode(dfName);
  344. tnDF.Name = tnD.Name + dfID;
  345. tnD.Nodes.Add(tnDF);
  346. DataGridViewTextBoxColumn colDF = new DataGridViewTextBoxColumn();
  347. colDF.Name = tnDF.Name;
  348. colDF.HeaderText = tnDF.Text;
  349. colDF.MinimumWidth = this._minimumWidth;
  350. colDF.DataPropertyName = dtID + dID + dfID;
  351. DataGridViewCellStyle dgvcsDF = new System.Windows.Forms.DataGridViewCellStyle();
  352. dgvcsDF.Alignment = DataGridViewContentAlignment.MiddleRight;
  353. colDF.DefaultCellStyle = dgvcsDF;
  354. colDF.SortMode = DataGridViewColumnSortMode.NotSortable;
  355. colDF.ReadOnly = true;
  356. this.dgvDR.Columns.Add(colDF);
  357. }
  358. }
  359. }
  360. this.g3TV.Nodes.Add(tnDTA3);
  361. #endregion
  362. }
  363. this.dgvTQ.DataSource = dataSet.Tables["TQ"];
  364. this.dgvTQ1.DataSource = dataSet.Tables["TQ1"];
  365. this.dgvFR.DataSource = dataSet.Tables["FR"];
  366. this.dgvDR.DataSource = dataSet.Tables["DR"];
  367. this.dgvDL.DataSource = dataSet.Tables["DL"];
  368. this.dgvFR.HorizontalMergeColumn = new Dictionary<int, List<string>>();
  369. //colHB.Insert(0, "0");
  370. //this.dgvFR.HorizontalMergeColumn.Add(this.dgvFR.RowCount - 1, colHB);
  371. int index = (this.dgvFR.RowCount - 1) / 2;
  372. if (index < 0)
  373. {
  374. index = 0;
  375. }
  376. for (int i = index; i < this.dgvFR.RowCount; i++)
  377. {
  378. this.dgvFR.HorizontalMergeColumn.Add(i, colHB);
  379. }
  380. this.tsbtnAdaptive_Click(null, null);
  381. }
  382. catch (Exception ex)
  383. {
  384. this.btnSearch.Enabled = true;
  385. this.btnClearCondition.Enabled = true;
  386. // 对异常进行共通处理
  387. ExceptionManager.HandleEventException(this.ToString(),
  388. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  389. }
  390. finally
  391. {
  392. this.btnSearch.Enabled = true;
  393. this.btnClearCondition.Enabled = true;
  394. this.tabcData.Enabled = true;
  395. this.dgvTQ.Enabled = true;
  396. this.dgvTQ1.Enabled = true;
  397. this.dgvFR.Enabled = true;
  398. this.dgvDR.Enabled = true;
  399. this.dgvDL.Enabled = true;
  400. }
  401. }
  402. /// <summary>
  403. /// 清空条件按钮事件
  404. /// </summary>
  405. /// <param name="sender"></param>
  406. /// <param name="e"></param>
  407. private void btnClearCondition_Click(object sender, EventArgs e)
  408. {
  409. this.dropKilnCode.SelectedIndex = 0;
  410. DateTime now = DateTime.Now.Date;
  411. this.dtpAccountDateStart.Value = now;
  412. this.dtpAccountDateEnd.Value = now.AddDays(1).AddSeconds(-1);
  413. this.txtKilncarbatchno.Clear();
  414. }
  415. #endregion
  416. #region 私有方法
  417. /// <summary>
  418. /// 根据界面查询条件获取数据集
  419. /// </summary>
  420. private DataSet GetSearchData()
  421. {
  422. try
  423. {
  424. RPT040109_SE se = new RPT040109_SE();
  425. if (string.IsNullOrEmpty(this.dropRptProcedure.Text))
  426. {
  427. this.dropRptProcedure.Focus();
  428. return null;
  429. }
  430. se.RptProcedureID = Convert.ToInt32(this.dropRptProcedure.SelectedValue);
  431. se.Kilncarbatchno = this.txtKilncarbatchno.Text.Trim();
  432. //获取数据来源工序Id
  433. ServiceResultEntity sre0 = this.DoAsync<ServiceResultEntity>(() =>
  434. {
  435. return ReportModuleProxy.Service.GetRptSourceProcedureModule(se.RptProcedureID);
  436. }
  437. );
  438. if (sre0.Data != null && sre0.Data.Tables.Count > 0)
  439. {
  440. se.RptSProcedureID = int.Parse(sre0.Data.Tables[0].Rows[Constant.INT_IS_ZERO]["Procedureid"].ToString());
  441. }
  442. //获取数据来源工序Id
  443. if (!this.dropKilnCode.Text.Equals(Constant.CBO_SELECT_ALL_NAME))
  444. {
  445. se.KilnID = Convert.ToInt32(this.dropKilnCode.SelectedValue);
  446. }
  447. //se.CreateTimeStart = DateTime.Parse(this.dtpAccountDateStart.Value.ToString("yyyy-MM-dd") + " 00:00:00");
  448. //se.CreateTimeEnd = DateTime.Parse(this.dtpAccountDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59");
  449. se.CreateTimeStart = this.dtpAccountDateStart.Value;
  450. se.CreateTimeEnd = this.dtpAccountDateEnd.Value;
  451. se.HasUserGroup = this.chkUserGroup.Checked;
  452. se.NOTDP50 = !this.chkDP50.Checked;
  453. // 调用服务器端获取数据集
  454. ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
  455. {
  456. return ReportModuleProxy.Service.GetRPT040109SData(se);
  457. }
  458. );
  459. if (sre.Status == Constant.ServiceResultStatus.Success)
  460. {
  461. if (sre.Data.Tables[0].Rows.Count <= Constant.INT_IS_ZERO)
  462. {
  463. // 提示未查找到数据
  464. MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
  465. MessageBoxButtons.OK, MessageBoxIcon.Warning);
  466. //清空数据
  467. return null;
  468. }
  469. return sre.Data;
  470. }
  471. return null;
  472. }
  473. catch (Exception ex)
  474. {
  475. throw ex;
  476. }
  477. }
  478. /// <summary>
  479. /// 绑定下拉列表值
  480. /// </summary>
  481. /// <returns></returns>
  482. private void BindPage()
  483. {
  484. //绑定数据来源下拉列表
  485. ServiceResultEntity sre1 = DoAsync<ServiceResultEntity>(() =>
  486. {
  487. return ReportModuleProxy.Service.GetRptProcedureModule();
  488. }
  489. );
  490. this.dropRptProcedure.DataSource = sre1.Data.Tables[Constant.INT_IS_ZERO];
  491. this.dropRptProcedure.ValueMember = "Rptprocedureid";
  492. this.dropRptProcedure.DisplayMember = "Rptprocedurename";
  493. //绑定窑炉下来列表
  494. ServiceResultEntity sre2 = DoAsync<ServiceResultEntity>(() =>
  495. {
  496. byte byFlage = Convert.ToByte(Constant.ValueFlag.Invalid);
  497. return ReportModuleProxy.Service.GetKilnData(byFlage);
  498. }
  499. );
  500. DataTable dtKilnInfo = sre2.Data.Tables[Constant.INT_IS_ZERO];
  501. DataRow newRowDic = dtKilnInfo.NewRow();
  502. newRowDic["KilnID"] = Constant.CBO_SELECT_ALL_VALUE;
  503. newRowDic["KilnCode"] = Constant.CBO_SELECT_ALL_NAME;
  504. dtKilnInfo.Rows.InsertAt(newRowDic, Constant.INT_IS_ZERO);
  505. this.dropKilnCode.DataSource = dtKilnInfo;
  506. this.dropKilnCode.ValueMember = "KilnID";
  507. this.dropKilnCode.DisplayMember = "KilnCode";
  508. }
  509. #endregion
  510. /// <summary>
  511. /// 导出
  512. /// </summary>
  513. /// <param name="sender"></param>
  514. /// <param name="e"></param>
  515. private void tsbtnExport_Click(object sender, EventArgs e)
  516. {
  517. try
  518. {
  519. int si = this.tabcData.SelectedIndex;
  520. this.tabcData.SelectedIndex = 0;
  521. this.tabcData.SelectedIndex = 1;
  522. this.tabcData.SelectedIndex = 2;
  523. this.tabcData.SelectedIndex = 3;
  524. this.tabcData.SelectedIndex = 4;
  525. this.tabcData.SelectedIndex = si;
  526. // 多个sheet页
  527. List<DataGridView> dgvList = new List<DataGridView>();
  528. List<TreeView> tvList = new List<TreeView>();
  529. List<string> sheetList = new List<string>();
  530. dgvList.Add(this.dgvTQ);
  531. dgvList.Add(this.dgvFR);
  532. dgvList.Add(this.dgvDR);
  533. dgvList.Add(this.dgvDL);
  534. dgvList.Add(this.dgvTQ1);
  535. tvList.Add(null);
  536. tvList.Add(this.dgvFR.ColumnTreeView[0]);
  537. tvList.Add(this.dgvDR.ColumnTreeView[0]);
  538. tvList.Add(null);
  539. tvList.Add(null);
  540. sheetList.Add(this.tabcData.TabPages[0].Text);
  541. sheetList.Add(this.tabcData.TabPages[1].Text);
  542. sheetList.Add(this.tabcData.TabPages[2].Text);
  543. sheetList.Add(this.tabcData.TabPages[3].Text);
  544. sheetList.Add(this.tabcData.TabPages[4].Text);
  545. ExportExcel.Common.Instance.ExportExcel(dgvList, tvList, null, this.Text, this.Text, this.Font, "", this.Font, "", sheetList, true, true, true, this.dgvFR.IsTopDeep);
  546. //ExportExcel.Common.Instance.ExportExcelOneSheet(dgvList, tvList, null, this.Text, this.Text, this.Font, "", this.Font, "", sheetList, true, true, this.dgvFR.IsTopDeep);
  547. }
  548. catch (Exception ex)
  549. {
  550. // 对异常进行共通处理
  551. ExceptionManager.HandleEventException(this.ToString(),
  552. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  553. }
  554. }
  555. }
  556. }