using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using System.Net; using System.Collections; using CoreFS.SA06; namespace Core.StlMes.Client.BuyBillet { public partial class frmRptLs : FrmBase { public frmRptLs() { InitializeComponent(); } private void frmRptLs_Load(object sender, EventArgs e) { initial_control(); Query(); } private void initial_control() { cb_year.Items.Add(2019); cb_year.Items.Add(2020); cb_year.Items.Add(2021); cb_year.Items.Add(2022); cb_year.Items.Add(2023); cb_year.SelectedIndex = 0; } public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "Query": Query(); break; case "Export": Export(); break; case "Close": this.Close(); break; } } private void Query() { string year = cb_year.Text; DataTable dtqry = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_Rpt_Ls_All", new object[] { year }, this.ob); this.ug1.DataSource = dtqry; ug1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "所属部门"; ug1.DisplayLayout.Bands[0].Columns[1].Header.Caption = "产线"; ug1.DisplayLayout.Bands[0].Columns[2].Hidden = true; ug1.DisplayLayout.Bands[0].Columns[3].Hidden = true; if(dtqry.Rows.Count ==0) ug1.DisplayLayout.Bands[0].Columns[4].Hidden = true; ug1.DisplayLayout.Bands[0].Columns[0].CellAppearance.BackColor = Color.Gray; ug1.DisplayLayout.Bands[0].Columns[0].MergedCellStyle = MergedCellStyle.Always; } private void ug1_InitializeRow(object sender, InitializeRowEventArgs e) { int count = e.Row.Cells.Count; if (count > 3) { for (int i = 4; i < count; i++) { if (e.Row.Cells[i].Value != null && !string.IsNullOrEmpty(e.Row.Cells[i].Value.ToString().Trim())) { e.Row.Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button; e.Row.Cells[i].Appearance.BackColor = Color.Yellow; } } } } private void ug1_ClickCellButton(object sender, CellEventArgs e) { frmRptLsDeails frm = new frmRptLsDeails(this.ob); frm.P_DEPT = e.Cell.Row.Cells[0].Value.ToString();//所属部门 frm.P_LINE = e.Cell.Row.Cells[1].Value.ToString();//产线 frm.RPT_YM = e.Cell.Column.Header.Caption;//统计年月 frm.StartPosition = FormStartPosition.CenterScreen; frm.Show(); } private void Export() { if (ug1.Rows.Count == 0) { MessageUtil.ShowWarning("查询数据为空,无法导出!"); } else { GridHelper.ulGridToExcel(ug1, "生产流速数据"); } } } }