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 frmRptPlineJudgeAll : FrmBase { private UltraGrid[] ugs ; public frmRptPlineJudgeAll() { InitializeComponent(); ugs = new UltraGrid[] { ug1,ug2,ug3,ug4,ug5,ug6,ug7,ug8,ug9,ug10,ug11,ug12 }; foreach (UltraGrid ug in ugs) { ug.InitializeLayout += ug_InitializeLayout; } } void ug_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Override.CellAppearance.TextHAlign = HAlign.Right; e.Layout.Bands[0].Columns["RPT_YM"].CellAppearance.TextHAlign = HAlign.Left; e.Layout.Bands[0].Columns["DEPARTMENT_DESC_P"].CellAppearance.TextHAlign = HAlign.Left; e.Layout.Bands[0].Columns["PLINE_NAME"].CellAppearance.TextHAlign = HAlign.Left; e.Layout.Bands[0].Columns["CCL"].CellAppearance.TextHAlign = HAlign.Left; e.Layout.Bands[0].Columns["ZYL"].CellAppearance.TextHAlign = HAlign.Left; e.Layout.Bands[0].Columns["YCHGRATE"].CellAppearance.TextHAlign = HAlign.Left; foreach (var col in e.Layout.Bands[0].Columns) { if (col.Key.ToUpper() == "RPT_YM" || col.Key.ToUpper() == "DEPARTMENT_DESC_P" || col.Key.ToUpper() == "PLINE_NAME" || col.Key.ToUpper() == "CCL" || col.Key.ToUpper() == "ZYL" || col.Key.ToUpper() == "YCHGRATE") { } else { col.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals; col.MaskInput = "{LOC}-nn,nnn,nnn.nnn"; } } } private void frmRptPlineJudgeAll_Load(object sender, EventArgs e) { HideTabs(); } private void HideTabs() { //首先判断年份 int selectedYear = int.Parse(cb_year.Text); //如果大于当前年份 则隐藏tab控件 if (selectedYear > DateTime.Now.Year) { tabC.Visible = false; } //如果是当前年份则,当前月份被选中 if (selectedYear == DateTime.Now.Year) { int month = DateTime.Now.Month; for (int i = 11; i > month - 1; i--) { tabC.Tabs[i].Visible = false; } tabC.Tabs[month - 1].Selected = true; } //小于当前年份,则默认1月份被选中 if (selectedYear < DateTime.Now.Year) { tabC.Tabs[0].Selected = true; } } private void InitialTabs() { tabC.Visible = true; int count = tabC.Tabs.Count; for (int i = 0; i < count; i++) { tabC.Tabs[i].Visible = true; } } 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 Export() { int month =tabC.SelectedTab.Index+1; string strmonth = month <10 ?"0"+month.ToString():month.ToString(); string yearMonth = cb_year.Text + strmonth; UltraGrid ug = ugs[month-1]; if (ug.Rows.Count == 0) { MessageUtil.ShowWarning("查询数据为空,无法导出!"); } else { GridHelper.ulGridToExcel(ug, yearMonth+"产量判定数据"); } } private void Query() { int month =tabC.SelectedTab.Index+1; string strmonth = month <10 ?"0"+month.ToString():month.ToString(); string yearMonth = cb_year.Text + strmonth; DataTable dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_Rpt_Pline_Judge_All", new object[] { yearMonth }, this.ob); UltraGrid ug = ugs[month-1]; ug.DataSource = dt; ug.DisplayLayout.Bands[0].Columns["RPT_YM"].CellAppearance.BackColor = Color.Gray; ug.DisplayLayout.Bands[0].Columns["RPT_YM"].MergedCellStyle = MergedCellStyle.Always; ug.DisplayLayout.Bands[0].Columns["DEPARTMENT_DESC_P"].MergedCellStyle = MergedCellStyle.Always; } private void cb_year_SelectionChanged(object sender, EventArgs e) { //Tabs 控件初始化 InitialTabs(); HideTabs(); } } }