using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using System.Collections; using Core.LgMes.Client.Comm; namespace Core.LgMes.Client.LgJobMgt { public partial class ucLfsTimeInfo : UserControl { public ucLfsTimeInfo() { InitializeComponent(); CStaticMethod.SetUltraGridStyle(ultraGrid1, 1); //设置样式 } private void ucLfsTimeInfo_Load(object sender, EventArgs e) { ultraDataSource1.Rows.Add(new object[] { null, null, null, null, "", "" }); } public void ResetData() { try { for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++) { if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } } catch { } } public void SetData(Hashtable ar) { if (ar == null || ar.Count == 0) return; int count = this.ultraDataSource1.Band.Columns.Count; string strKey = ""; for (int i = 0; i < count; i++) { try { strKey = this.ultraDataSource1.Band.Columns[i].Key; if (ar.Contains(strKey)) { if(!string.IsNullOrEmpty(ar[strKey].ToString())) this.ultraDataSource1.Rows[0][i] = ar[strKey]; else if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } else { if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime)) this.ultraDataSource1.Rows[0][i] = null; else this.ultraDataSource1.Rows[0][i] = ""; } } catch { } try { // 在站时间 if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ARRIVETIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["LEAVETIME"].ToString())) this.ultraDataSource1.Rows[0]["REFINETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["LEAVETIME"])); else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ARRIVETIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["LEAVETIME"].ToString())) this.ultraDataSource1.Rows[0]["REFINETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]), DateTime.Now); // 吹氩时间 if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BEGINBLOWAR"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ENDBLOWAR"].ToString())) this.ultraDataSource1.Rows[0]["BLOWARTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BEGINBLOWAR"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ENDBLOWAR"])); else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BEGINBLOWAR"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ENDBLOWAR"].ToString())) this.ultraDataSource1.Rows[0]["BLOWARTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BEGINBLOWAR"]), DateTime.Now); // 处理时间 if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["REPOSEBEGINTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["REPOSECLOSETIME"].ToString())) this.ultraDataSource1.Rows[0]["REPOSETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["REPOSEBEGINTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["REPOSECLOSETIME"])); else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["REPOSEBEGINTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["REPOSECLOSETIME"].ToString())) this.ultraDataSource1.Rows[0]["REPOSETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["REPOSEBEGINTIME"]), DateTime.Now); // 喂丝时间 if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"].ToString())) this.ultraDataSource1.Rows[0]["FEED_TIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"])); else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"].ToString())) this.ultraDataSource1.Rows[0]["FEED_TIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]), DateTime.Now); } catch { } } } } }