| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- 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 frmRptSalesAll : FrmBase
- {
- public frmRptSalesAll()
- {
- InitializeComponent();
- }
- private void frmRptSalesAll_Load(object sender, EventArgs e)
- {
- //this.ug1.DisplayLayout.Bands[0].Columns["GM1_SALES_WEIGHT"].AllowRowSummaries = AllowRowSummaries.True;
- //this.ug1.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Minimum, null,
- //this.ug1.DisplayLayout.Bands[0].Columns["GM1_SALES_WEIGHT"], SummaryPosition.Left,
- //null);
- //this.ug1.DisplayLayout.Bands[0].SummaryFooterCaption = "My Sums";
- 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_Sales_All", new object[] { year }, this.ob);
- GridHelper.CopyDataToDatatable(ref dtqry, ref dt, true);
- //ug1.DataSource = dt;
- //RefreshAndAutoSize(ug1);
- 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("GM1_SALES_WEIGHT");
- alist.Add("GM2_SALES_WEIGHT");
- alist.Add("XS_SALES_WEIGHT");
- alist.Add("TOTAL_SALES_WEIGHT");
- //排产量
- alist.Add("GM1_PC_WEIGHT");
- alist.Add("GM2_PC_WEIGHT");
- alist.Add("XS_PC_WEIGHT");
- alist.Add("TOTAL_PC_WEIGHT");
- //库存量
- alist.Add("GM1_STOCK_WEIGHT");
- alist.Add("GM2_STOCK_WEIGHT");
- alist.Add("XS_STOCK_WEIGHT");
- alist.Add("TOTAL_STOCK_WEIGHT");
- //入库量
- alist.Add("GM1_STOCKIN_WEIGHT");
- alist.Add("GM2_STOCKIN_WEIGHT");
- alist.Add("XS_STOCKIN_WEIGHT");
- alist.Add("TOTAL_STOCKIN_WEIGHT");
- //出库量(发运量)
- alist.Add("GM1_STOCKOUT_WEIGHT");
- alist.Add("GM2_STOCKOUT_WEIGHT");
- alist.Add("XS_STOCKOUT_WEIGHT");
- alist.Add("TOTAL_STOCKOUT_WEIGHT");
- //处理前期无合同库存
- alist.Add("GM1_QQ_STOCK");
- alist.Add("GM2_QQ_STOCK");
- alist.Add("XS_QQ_STOCK");
- alist.Add("TOTAL_QQ_STOCK");
- //无合同库存余额
- alist.Add("GM1_NODER_WEIGHT");
- alist.Add("GM2_NODER_WEIGHT");
- alist.Add("XS_NODER_WEIGHT");
- alist.Add("TOTAL_NODER_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["GM1_STOCK_WEIGHT"].CellAppearance.TextHAlign = HAlign.Right;
- e.Layout.Bands[0].Columns["GM2_STOCK_WEIGHT"].CellAppearance.TextHAlign = HAlign.Right;
- e.Layout.Bands[0].Columns["XS_STOCK_WEIGHT"].CellAppearance.TextHAlign = HAlign.Right;
- e.Layout.Bands[0].Columns["TOTAL_STOCK_WEIGHT"].CellAppearance.TextHAlign = HAlign.Right;
- //e.Layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
- foreach (var col in e.Layout.Bands[0].Columns)
- {
- if (col.Key.ToLower() == "rpt_ym")
- {
- }
- else
- {
- col.MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiterals;
- col.MaskInput = "{LOC}-nn,nnn,nnn.nnn";
- }
- }
- }
- }
- }
|