using System; using System.Collections; 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.StlMes.Client.ZGMil; using com.steering.mes.zgmil.entity; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; namespace Core.StlMes.Client.ZGMil.ResultConrtrol { public partial class PipeSawResult : UserControl { private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null; public PipeSawResult() { InitializeComponent(); GridHelper.InitCardGrid(PipeSawDataSource, ultraGrid2); _grid = this.ultraGrid2; this.ultraGrid2.Rows[0].Cells["btnCUT_REV1"].Value = "来料确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_REV2"].Value = "来料确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_END1"].Value = "锯切完成"; this.ultraGrid2.Rows[0].Cells["btnCUT_END2"].Value = "锯切完成"; this.ultraGrid2.Rows[0].Cells["btnCUT_TRAIL1"].Value = "切尾确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_TRAIL2"].Value = "切尾确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_Length1"].Value = "切定长确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_Length2"].Value = "切定长确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_HEAD1"].Value = "切头确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_HEAD2"].Value = "切头确认"; this.ultraGrid2.Rows[0].Cells["btnCUT_BACK1"].Value = "上料回退"; this.ultraGrid2.Rows[0].Cells["btnCUT_BACK2"].Value = "上料回退"; ValueList va = new ValueList(); va.ValueListItems.Add("1#台"); va.ValueListItems.Add("2#台"); va.ValueListItems.Add("3#台"); this.ultraGrid2.Rows[0].Cells["COL_NO1"].ValueList = va; this.ultraGrid2.Rows[0].Cells["COL_NO2"].ValueList = va; this.ultraGrid2.Rows[0].Cells["COL_NO1"].Value = "1#台"; this.ultraGrid2.Rows[0].Cells["COL_NO2"].Value = "1#台"; } private MilSawResultEntity _sawResult = new MilSawResultEntity(); private MilPlan _milplan = new MilPlan(); [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public MilSawResultEntity MilSawResult { get { return _sawResult; } set { if (value != null) { _sawResult = value; UpdateDate_sawResult(); } } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public MilPlan MilPlan { get { return _milplan; } set { if (value != null) { _milplan = value; UpdateDate_milplan(); } } } private bool isCellSelect = false; public bool IsCellSelect { get { return isCellSelect; } set { isCellSelect = value; } } public void Clear() { //清空DataSource数据 for (int i = 0; i < this.ultraGrid2.DisplayLayout.Bands[0].Columns.Count; i++) { this.ultraGrid2.Rows[0].Cells[i].Value = ""; } } public void UpdateDate_milplan() { PipeSawDataSource.Rows[0]["CUT_HEAD_LENGTHP"] = _milplan.CutHeadLengthp; PipeSawDataSource.Rows[0]["CUT_TRAIL_LENGTHP"] = _milplan.CutTrailLengthp; PipeSawDataSource.Rows[0]["CONTROL_THICKP"] = _milplan.ControlThickp; PipeSawDataSource.Rows[0]["LengthRangeP"] = _milplan.LengthRange.ToString(); PipeSawDataSource.Rows[0]["SAW_MUMP"] = _milplan.SawNum; PipeSawDataSource.Rows[0]["TARGET_LENGTHP"] = _milplan.TargetLength; // PipeSawDataSource.Rows[0]["CUT_TYPEA"] = _milplan.LengthRange; } public void UpdateDate_sawResult() { //切头长度 PipeSawDataSource.Rows[0]["CUT_HEAD_LENGTH"] = string.IsNullOrEmpty(_sawResult.CutHeadLength.ToString()) ? "0" : _sawResult.CutHeadLength.ToString(); //切尾长度 PipeSawDataSource.Rows[0]["CUT_TRAIL_LENGTH"] = string.IsNullOrEmpty(_sawResult.CutTrailLength.ToString()) ? "0" : _sawResult.CutTrailLength.ToString(); PipeSawDataSource.Rows[0]["TARGET_LENGTH"] = string.IsNullOrEmpty(_sawResult.OrderLength.ToString()) ? "0" : _sawResult.OrderLength.ToString(); PipeSawDataSource.Rows[0]["SAW_NUM"] = string.IsNullOrEmpty(_sawResult.SawNum.ToString()) ? "0" : _sawResult.SawNum.ToString(); //控制壁厚 PipeSawDataSource.Rows[0]["COL_THICK"] = string.IsNullOrEmpty(_sawResult.ColThick.ToString())?"0":_sawResult.ColThick; //分切数 PipeSawDataSource.Rows[0]["CUT_NUM"] = _sawResult.CutNum ; //目标长度 //PipeSawDataSource.Rows[0]["TARGET_LENGTH"] = _sawResult.TargetLength ; //切尾类型 PipeSawDataSource.Rows[0]["CUT_TYPE"] = _sawResult.CutType ; //切前剔除支数 PipeSawDataSource.Rows[0]["SCRAP_NUM"] = _sawResult.ScrapNum ; //切后剔除支数 PipeSawDataSource.Rows[0]["SCRAP_DBNUM"] = _sawResult.ScrapDbnum ; //合格支数 PipeSawDataSource.Rows[0]["CUT_NUM"] = _sawResult.CutNum ; //交接班支数 PipeSawDataSource.Rows[0]["CHANGE_NUM"] = _sawResult.ChangeNum ; //备注 PipeSawDataSource.Rows[0]["REMARK"] = _sawResult.Remark; //开始时间 PipeSawDataSource.Rows[0]["START_TIME"] = _sawResult.StartTime; //结束时间 PipeSawDataSource.Rows[0]["END_TIME"] = _sawResult.EndTime; } private void ultraGrid2_CellChange(object sender, CellEventArgs e) { this.IsCellSelect = true; } private void ultraGrid2_CellDataError(object sender, CellDataErrorEventArgs e) { e.RaiseErrorEvent = false; //e.StayInEditMode = true; bool result = false; try { DateTime.Parse(this.ultraGrid2.Rows[0].Cells["START_TIME"].ToString()); result = true; } catch { } //if (!result) //{ // MessageBox.Show("您输入的开始时间格式不正确,请重新输入。", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); //} } } }