F_RPT_040109.cs 25 KB

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