frmRptLs.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Core.Mes.Client.Comm.Tool;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Infragistics.Win;
  15. using System.Net;
  16. using System.Collections;
  17. using CoreFS.SA06;
  18. namespace Core.StlMes.Client.BuyBillet
  19. {
  20. public partial class frmRptLs : FrmBase
  21. {
  22. public frmRptLs()
  23. {
  24. InitializeComponent();
  25. }
  26. private void frmRptLs_Load(object sender, EventArgs e)
  27. {
  28. initial_control();
  29. Query();
  30. }
  31. private void initial_control()
  32. {
  33. cb_year.Items.Add(2019);
  34. cb_year.Items.Add(2020);
  35. cb_year.Items.Add(2021);
  36. cb_year.Items.Add(2022);
  37. cb_year.Items.Add(2023);
  38. cb_year.SelectedIndex = 0;
  39. }
  40. public override void ToolBar_Click(object sender, string ToolbarKey)
  41. {
  42. base.ToolBar_Click(sender, ToolbarKey);
  43. switch (ToolbarKey)
  44. {
  45. case "Query":
  46. Query();
  47. break;
  48. case "Export":
  49. Export();
  50. break;
  51. case "Close":
  52. this.Close();
  53. break;
  54. }
  55. }
  56. private void Query()
  57. {
  58. string year = cb_year.Text;
  59. DataTable dtqry = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_Rpt_Ls_All", new object[] { year }, this.ob);
  60. this.ug1.DataSource = dtqry;
  61. ug1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "所属部门";
  62. ug1.DisplayLayout.Bands[0].Columns[1].Header.Caption = "产线";
  63. ug1.DisplayLayout.Bands[0].Columns[2].Hidden = true;
  64. ug1.DisplayLayout.Bands[0].Columns[3].Hidden = true;
  65. if(dtqry.Rows.Count ==0)
  66. ug1.DisplayLayout.Bands[0].Columns[4].Hidden = true;
  67. ug1.DisplayLayout.Bands[0].Columns[0].CellAppearance.BackColor = Color.Gray;
  68. ug1.DisplayLayout.Bands[0].Columns[0].MergedCellStyle = MergedCellStyle.Always;
  69. }
  70. private void ug1_InitializeRow(object sender, InitializeRowEventArgs e)
  71. {
  72. int count = e.Row.Cells.Count;
  73. if (count > 3)
  74. {
  75. for (int i = 4; i < count; i++)
  76. {
  77. if (e.Row.Cells[i].Value != null && !string.IsNullOrEmpty(e.Row.Cells[i].Value.ToString().Trim()))
  78. {
  79. e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
  80. e.Row.Cells[i].Appearance.BackColor = Color.Yellow;
  81. }
  82. }
  83. }
  84. }
  85. private void ug1_ClickCellButton(object sender, CellEventArgs e)
  86. {
  87. frmRptLsDeails frm = new frmRptLsDeails(this.ob);
  88. frm.P_DEPT = e.Cell.Row.Cells[0].Value.ToString();//所属部门
  89. frm.P_LINE = e.Cell.Row.Cells[1].Value.ToString();//产线
  90. frm.RPT_YM = e.Cell.Column.Header.Caption;//统计年月
  91. frm.StartPosition = FormStartPosition.CenterScreen;
  92. frm.Show();
  93. }
  94. private void Export()
  95. {
  96. if (ug1.Rows.Count == 0)
  97. {
  98. MessageUtil.ShowWarning("查询数据为空,无法导出!");
  99. }
  100. else
  101. {
  102. GridHelper.ulGridToExcel(ug1, "生产流速数据");
  103. }
  104. }
  105. }
  106. }