| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using System.Diagnostics;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Core.Mes.Client.Comm.Control;
- namespace Core.StlMes.Client.SaleOrder.Control
- {
- public partial class ctrlOrderLineDesign : UserControl
- {
- private DataTable designDt;
- public DataTable DesignDt
- {
- get { return designDt; }
- set { designDt = value; }
- }
- private DataTable designDtNPass;
- public DataTable DesignDtNPass
- {
- get { return designDtNPass; }
- set { designDtNPass = value; }
- }
-
- public ctrlOrderLineDesign()
- {
- InitializeComponent();
- }
- private void ctrlOrderLineDesign_Load(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 绑定设计状态表数据源。
- /// </summary>
- public void binUltraGrid()
- {
- if (designDt.Rows.Count > 0)
- {
- //为UltraGrid控件绑定数据源。
- DataSet ds = new DataSet();
- ds.Tables.Add(designDt);
- ultraGirdDelivery.DataSource = ds;
- ultraGirdDelivery.DataBind();
- //隐藏设计状态明细列。
- for (int i = 1; i < ultraGirdDelivery.DisplayLayout.Bands[0].Columns.Count; i++)
- {
- //i=0,是设计状态主信息,因此从1开始。单项展示,双项隐藏。
- if (i % 2 == 0)
- {
- ultraGirdDelivery.DisplayLayout.Bands[0].Columns[i].Hidden = true;
- }
- else
- {
- //单项展示,同时为单项指定ToolTipText为他下一列的Text,设计状态明细。
- if (i + 1 < ultraGirdDelivery.Rows[1].Cells.Count)
- {
- ultraGirdDelivery.Rows[1].Cells[i].ToolTipText = ultraGirdDelivery.Rows[1].Cells[i + 1].Text.ToString();
- }
- }
- }
- //隐藏列头,动态构建UltraGrid,因此第一行就是列头。
- ultraGirdDelivery.DisplayLayout.Bands[0].ColHeadersVisible = false;
- //列自适应
- GridHelper.RefreshAndAutoSizeExceptRows(ultraGirdDelivery, new UltraGridColumn[] {
- //ultraGridDesignStd.DisplayLayout.Bands[0].Columns["CHK"]
- });
- //第一列合并
- //ultraGirdDelivery.DisplayLayout.Bands[0].Columns["columns"].MergedCellStyle = MergedCellStyle.Always;
- if (ultraGirdDelivery.Rows.Count >= 2)
- {
- ultraGirdDelivery.Rows[0].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
- }
- }
- }
- /// <summary>
- /// 不通过项目数据源绑定。
- /// </summary>
- public void binUltraGridNPass()
- {
- if (designDtNPass.Rows.Count > 0)
- {
- DataSet ds = new DataSet();
- ds.Tables.Add(designDtNPass);
- ultraGridD.DataSource = ds;
- ultraGridD.DataBind();
- for (int i = 1; i < ultraGridD.DisplayLayout.Bands[0].Columns.Count; i++)
- {
- //项目名称转变为button。
- ultraGridD.DisplayLayout.Rows[0].Cells[i].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
- ultraGridD.DisplayLayout.Rows[0].Cells[i].Column.ButtonDisplayStyle = ButtonDisplayStyle.Always;
- //Tag存储下一行的Text值,也就是管理科室名称。
- ultraGridD.DisplayLayout.Rows[0].Cells[i].Tag = ultraGridD.DisplayLayout.Rows[2].Cells[i].Text.ToString();
- }
- ultraGridD.DisplayLayout.Rows[2].Hidden = true;
- //列头隐藏,第1行即为列头。
- ultraGridD.DisplayLayout.Bands[0].ColHeadersVisible = false;
- //列自适应
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGridD, new UltraGridColumn[] {
- // //ultraGridDesignStd.DisplayLayout.Bands[0].Columns["CHK"]
- //});
- //第一列合并
- //ultraGridD.DisplayLayout.Bands[0].Columns["columns"].MergedCellStyle = MergedCellStyle.Always;
- if (ultraGridD.Rows.Count >= 2)
- {
- ultraGridD.Rows[0].Appearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
- }
- }
- }
- private void ultraGridD_ClickCellButton(object sender, CellEventArgs e)
- {
- //ultraGridD.ActiveCell.Text
- //string[] design_Obj = e.Cell.Tag.ToString().Split('|');
- //string key = abc[0];
- //现在除了失败原因和管理科室,还需要传入钢种。
- DesignCellText(e.Cell.Text, e.Cell.Tag.ToString());
- //for (int i = 0; i < ultraGridD.DisplayLayout.Bands[0].Columns; i++ )
- //{
- // if (e.Cell.Column.Key == ultraGridD.DisplayLayout.Bands[0].Columns[i].Key)
- // {
- // if (e.Cell.Row.Cells.Count > i + 1)
- // {
- // UltraGridCell cell = e.Cell.Row.Cells[i + 1];
- // }
- // }
- //}
-
-
- //ultraGirdDelivery.Rows[1].Cells[i].ToolTipText = ultraGirdDelivery.Rows[1].Cells[i + 1].Text.ToString();
- }
- public delegate void HDesignCellText(string lstItem, string designObj);
- public event HDesignCellText DesignCellText;
- //private void ctrlOrderLineDesign_Load(object sender, EventArgs e)
- //{
- // //if (designDt.Rows.Count > 0)
- // //{
- // // ultraGirdDelivery.DataSource = designDt;
- // // ultraGirdDelivery.DataBind();
- // //}
- //}
- }
- }
|