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 frmRptManagementAll : FrmBase { public frmRptManagementAll() { InitializeComponent(); } private void frmRptManagementAll_Load(object sender, EventArgs e) { ForbidSort(ug1); Query(); } 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() { if (ug1.Rows.Count == 0) { MessageUtil.ShowWarning("查询数据为空,无法导出!"); } else { GridHelper.ulGridToExcel(ug1, "管理报表数据"); } } private void Query() { string year = cb_year.Text; DataTable dtqry = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_Rpt_Management_All", new object[] { year }, this.ob); GridHelper.CopyDataToDatatable(ref dtqry, ref dt, true); SetStaticsInfo(); CommonMethod.SetGridSumArea(this.ug1); } /// /// 禁止排序 /// /// public void ForbidSort(UltraGrid ugr) { foreach (UltraGridColumn ugc in ugr.DisplayLayout.Bands[0].Columns) { ugc.SortIndicator = SortIndicator.Disabled; ugc.AllowRowFiltering = DefaultableBoolean.False; } } /// /// 刷新Grid数据并根据数据调整Grid列宽 /// /// 需要处理的Grid public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid) { try { ultraGrid.DataBind(); foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in ultraGrid.DisplayLayout.Bands) { foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in band.Columns) { column.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand); } } ultraGrid.Refresh(); } catch { } } private void SetStaticsInfo() { try { if (this.ug1.Rows.Count == 0) { this.ug1.DisplayLayout.Bands[0].Summaries.Clear(); } else { ArrayList alist = new ArrayList(); //半成品 alist.Add("BCP"); alist.Add("BCP_ZT"); alist.Add("TOTAL_BCP"); //管坯 alist.Add("GP"); alist.Add("GP_ZT"); alist.Add("TOTAL_GP"); //管坯加半成品合计 alist.Add("TOTAL_GP_BCP"); //外购坯量 alist.Add("WGP_WEIGHT"); CommonMethod.SetStaticsInfoSum(ref this.ug1, alist, true); } } catch { } } private void ug1_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["WGP_RATE"].CellAppearance.TextHAlign = HAlign.Left; foreach (var col in e.Layout.Bands[0].Columns) { if (col.Key.ToLower() == "rpt_ym" || col.Key.ToLower() == "wgp_rate") { } else { col.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals; col.MaskInput = "{LOC}-nn,nnn,nnn.nnn"; } } } } }