| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- 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);
- }
- /// <summary>
- /// 禁止排序
- /// </summary>
- /// <param name="ugr"></param>
- public void ForbidSort(UltraGrid ugr)
- {
- foreach (UltraGridColumn ugc in ugr.DisplayLayout.Bands[0].Columns)
- {
- ugc.SortIndicator = SortIndicator.Disabled;
- ugc.AllowRowFiltering = DefaultableBoolean.False;
- }
- }
- /// <summary>
- /// 刷新Grid数据并根据数据调整Grid列宽
- /// </summary>
- /// <param name="ultraGrid">需要处理的Grid</param>
- 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";
- }
- }
- }
- }
- }
|