F_RPT_040109.cs 25 KB

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