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; namespace Core.StlMes.Client.ZGMil.ResultConrtrol { public partial class FeedSaw : UserControl { private Infragistics.Win.UltraWinGrid.UltraGrid _grid = null; public FeedSaw() { InitializeComponent(); GridHelper.InitCardGrid(FeedDataSource, ultraGrid4); _grid = this.ultraGrid4; this.ultraGrid4.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False; } private FeedRowPlan _feedPlan = new FeedRowPlan(); [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public FeedRowPlan Value { get { return _feedPlan; } set { if (value != null) { _feedPlan = value; UpdateData(0); } } } public void UpdateData(double CutDZWeight) { if (_feedPlan != null) { //计划上料支数 FeedDataSource.Rows[0]["FeedNumPlan"] = _feedPlan.FeedNumPlan; //上料支数 if (!string.IsNullOrEmpty(_feedPlan.FeedNumPlan) && !string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { FeedDataSource.Rows[0]["FeedNum"] = (int.Parse(_feedPlan.FeedNumPlan) - int.Parse(_feedPlan.ScrapNumOld)).ToString(); } else { FeedDataSource.Rows[0]["FeedNum"] = _feedPlan.FeedNum; } //上料长度 FeedDataSource.Rows[0]["FeedLength"] = _feedPlan.FeedLength; //使用长度 FeedDataSource.Rows[0]["UseLength"] = _feedPlan.UseLength; //未使用长度 FeedDataSource.Rows[0]["NoUserLength"] = _feedPlan.NonUseLength; //切损去向 FeedDataSource.Rows[0]["WasterTarget"] = _feedPlan.CutTarget; //倍尺数 FeedDataSource.Rows[0]["DBNum"] = _feedPlan.DBNum; //单倍长度 FeedDataSource.Rows[0]["DBLength"] = _feedPlan.DBLength; //计划单倍总支数 if (!string.IsNullOrEmpty(_feedPlan.FeedNum) && !string.IsNullOrEmpty(_feedPlan.DBNum)) { FeedDataSource.Rows[0]["PlanDBTotalCount"] = (Convert.ToInt32(_feedPlan.FeedNum) * Convert.ToInt32(_feedPlan.DBNum)).ToString(); } else { FeedDataSource.Rows[0]["PlanDBTotalCount"] = "0"; } //上料剔除支数 if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { FeedDataSource.Rows[0]["ScrapFeedNum"] = _feedPlan.ScrapNumOld; } else { FeedDataSource.Rows[0]["ScrapFeedNum"] = "0"; } //单倍坯剔除支数 if (!string.IsNullOrEmpty(_feedPlan.ScrapNum)) { FeedDataSource.Rows[0]["ScrapDBNum"] = _feedPlan.ScrapNum; } else { FeedDataSource.Rows[0]["ScrapDBNum"] = "0"; } //单倍坯合格支数 if (!string.IsNullOrEmpty(_feedPlan.FeedNum) && !string.IsNullOrEmpty(_feedPlan.DBNum)) { int ScrapNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNum)) { ScrapNum = int.Parse(_feedPlan.ScrapNum); } FeedDataSource.Rows[0]["QualityDBNum"] = (Convert.ToInt32(FeedDataSource.Rows[0]["FeedNum"].ToString()) * Convert.ToInt32(FeedDataSource.Rows[0]["DBNum"].ToString()) - ScrapNum).ToString(); } else { FeedDataSource.Rows[0]["QualityDBNum"] = "0"; } //交接班总支数 FeedDataSource.Rows[0]["CHANGENUM"] = _feedPlan.ChangeNumTotal; //交接班支数 FeedDataSource.Rows[0]["ChangeGroupNum"] = _feedPlan.ChangeNum; //交接班支数 FeedDataSource.Rows[0]["FeedChangeNum"] = _feedPlan.ChangeNum; //交班取消 FeedDataSource.Rows[0]["CHANGENUMCANCEL"] ="交班取消"; //单倍坯合格总重量 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.DBHeight)) { FeedDataSource.Rows[0]["QualityDBHeight"] = (Convert.ToDouble(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) * Convert.ToDouble(_feedPlan.DBHeight)).ToString(); } else { FeedDataSource.Rows[0]["QualityDBHeight"] = "0"; } //单倍坯合格总长度 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["ScrapFeedNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.DBLength)) { FeedDataSource.Rows[0]["QualityDBLength"] = (Convert.ToInt32(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) * Convert.ToDouble(_feedPlan.DBLength)).ToString(); } else { FeedDataSource.Rows[0]["QualityDBLength"] = "0"; } //切损总长度 = (上料支数 - 切前剔除支数) * 未使用长度 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.FeedNum) && !string.IsNullOrEmpty(_feedPlan.NonUseLength)) { int ScrapFeedNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { ScrapFeedNum = int.Parse(_feedPlan.ScrapNumOld); } FeedDataSource.Rows[0]["WasterLength"] = ((Convert.ToInt32(_feedPlan.FeedNum) * Convert.ToDouble(_feedPlan.NonUseLength))).ToString(); } else { FeedDataSource.Rows[0]["WasterLength"] = "0"; } //切损总重量 = (上料支数 - 切前剔除支数)* 单支切损重 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.FeedNum)) { int ScrapFeedNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { ScrapFeedNum = int.Parse(_feedPlan.ScrapNumOld); } FeedDataSource.Rows[0]["WasterHeight"] = Convert.ToInt32(_feedPlan.FeedNum) * CutDZWeight; } else { FeedDataSource.Rows[0]["WasterHeight"] = "0"; } //开始时间 FeedDataSource.Rows[0]["StartTime"] = _feedPlan.StartTime; //结束时间 FeedDataSource.Rows[0]["EndTime"] = _feedPlan.EndTime; FeedDataSource.Rows[0]["Remark"] = _feedPlan.ReMark; } } public void UpdateDataForRack(double CutDZWeight) { if (_feedPlan != null) { //上料剔除支数 if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { FeedDataSource.Rows[0]["ScrapFeedNum"] = _feedPlan.ScrapNumOld; } else { FeedDataSource.Rows[0]["ScrapFeedNum"] = "0"; } //单倍坯剔除支数 if (!string.IsNullOrEmpty(_feedPlan.ScrapNum)) { FeedDataSource.Rows[0]["ScrapDBNum"] = _feedPlan.ScrapNum; } else { FeedDataSource.Rows[0]["ScrapDBNum"] = "0"; } //单倍坯合格支数 if (!string.IsNullOrEmpty(_feedPlan.FeedNum) && !string.IsNullOrEmpty(_feedPlan.DBNum)) { int ScrapNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNum)) { ScrapNum = int.Parse(_feedPlan.ScrapNum); } FeedDataSource.Rows[0]["QualityDBNum"] = (Convert.ToInt32(FeedDataSource.Rows[0]["FeedNum"].ToString()) * Convert.ToInt32(FeedDataSource.Rows[0]["DBNum"].ToString()) - ScrapNum).ToString(); } else { FeedDataSource.Rows[0]["QualityDBNum"] = "0"; } //实际上料支数 FeedDataSource.Rows[0]["FeedNum"] = _feedPlan.FeedNum; //交接班支数 FeedDataSource.Rows[0]["ChangeGroupNum"] = _feedPlan.ChangeNum; //交接班支数 FeedDataSource.Rows[0]["FeedChangeNum"] = _feedPlan.ChangeNum; //交接班总支数 FeedDataSource.Rows[0]["CHANGENUM"] = _feedPlan.ChangeNumTotal; //单倍坯合格总重量 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.DBHeight)) { FeedDataSource.Rows[0]["QualityDBHeight"] = (Convert.ToDouble(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) * Convert.ToDouble(_feedPlan.DBHeight)).ToString(); } else { FeedDataSource.Rows[0]["QualityDBHeight"] = "0"; } //单倍坯合格总长度 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["ScrapFeedNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.DBLength)) { FeedDataSource.Rows[0]["QualityDBLength"] = (Convert.ToInt32(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) * Convert.ToDouble(_feedPlan.DBLength)).ToString(); } else { FeedDataSource.Rows[0]["QualityDBLength"] = "0"; } //切损总长度 = (上料支数 - 切前剔除支数) * 未使用长度 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.FeedNum) && !string.IsNullOrEmpty(_feedPlan.NonUseLength)) { int ScrapFeedNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { ScrapFeedNum = int.Parse(_feedPlan.ScrapNumOld); } FeedDataSource.Rows[0]["WasterLength"] = (((Convert.ToDouble(_feedPlan.FeedNum) - ScrapFeedNum) * Convert.ToDouble(_feedPlan.NonUseLength)) / 1000).ToString(); } else { FeedDataSource.Rows[0]["WasterLength"] = "0"; } //切损总重量 = (上料支数 - 切前剔除支数) * 上料坯重量 - 合格单倍坯支数 * 单倍重 //切损总重量 = (上料支数 - 切前剔除支数)* 单支切损重 if (!string.IsNullOrEmpty(FeedDataSource.Rows[0]["QualityDBNum"].ToString()) && !string.IsNullOrEmpty(_feedPlan.FeedNum)) { int ScrapFeedNum = 0; if (!string.IsNullOrEmpty(_feedPlan.ScrapNumOld)) { ScrapFeedNum = int.Parse(_feedPlan.ScrapNumOld); } FeedDataSource.Rows[0]["WasterHeight"] = (Convert.ToInt32(_feedPlan.FeedNum) - ScrapFeedNum) * CutDZWeight; } else { FeedDataSource.Rows[0]["WasterHeight"] = "0"; } } } public void DataClear() { //计划上料支数 FeedDataSource.Rows[0]["FeedNumPlan"] = ""; //上料支数 FeedDataSource.Rows[0]["FeedNum"] = ""; //上料长度 FeedDataSource.Rows[0]["FeedLength"] = ""; //使用长度 FeedDataSource.Rows[0]["UseLength"] = ""; //未使用长度 FeedDataSource.Rows[0]["NoUserLength"] = ""; //切损去向 FeedDataSource.Rows[0]["WasterTarget"] = ""; //倍尺数 FeedDataSource.Rows[0]["DBNum"] = ""; //单倍长度 FeedDataSource.Rows[0]["DBLength"] = ""; //计划单倍总支数 FeedDataSource.Rows[0]["PlanDBTotalCount"] = ""; FeedDataSource.Rows[0]["ScrapFeedNum"] = ""; FeedDataSource.Rows[0]["ScrapDBNum"] = ""; FeedDataSource.Rows[0]["QualityDBNum"] = ""; FeedDataSource.Rows[0]["QualityDBHeight"] = ""; FeedDataSource.Rows[0]["QualityDBLength"] = ""; FeedDataSource.Rows[0]["WasterLength"] = ""; FeedDataSource.Rows[0]["WasterHeight"] = ""; //开始时间 FeedDataSource.Rows[0]["StartTime"] = DBNull.Value; //结束时间 FeedDataSource.Rows[0]["EndTime"] = DBNull.Value; FeedDataSource.Rows[0]["Remark"] = ""; } private void FeedDataSource_CellDataRequested(object sender, Infragistics.Win.UltraWinDataSource.CellDataRequestedEventArgs e) { } private void ultraGrid4_Error(object sender, ErrorEventArgs e) { e.Cancel = true; if (ultraGrid4.ActiveCell.Column.Key == "StartTime" || ultraGrid4.ActiveCell.Column.Key == "EndTime") { MessageBox.Show("请输入完整的时间"); } } } }