| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- using System;
- using System.Windows.Forms;
- using System.Collections;
- using Core.LgMes.Client.Comm;
- namespace Core.LgMes.Client.LgJobMgt
- {
- public partial class ucBaseInfo : UserControl
- {
- public ucBaseInfo()
- {
- InitializeComponent();
- CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
- }
- private void ucBaseInfo_Load(object sender, EventArgs e)
- {
- ultraDataSource1.Rows.Add(new object[] { "", "", "", "" });
- }
- 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] = "";
- }
- ultraGrid1.Rows[0].Cells["ProcessDur"].Value = "";
- }
- 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 (strKey == "SHIFTCODE")
- {
- string strBc = ar[strKey].ToString().Substring(0,1);
- this.ultraDataSource1.Rows[0][i] = strBc == "1" ? "早" : (strBc == "2" ? "中" : "晚");
- this.ultraDataSource1.Rows[0]["BB"] = CStaticMethod.ClassConvert(ar[strKey].ToString());
- }
- else if (strKey == "EQUIPMENTNO")
- this.ultraDataSource1.Rows[0][i] = ar[strKey].ToString().Substring(1, 1) + "#脱硫";
- else
- this.ultraDataSource1.Rows[0][i] = ar[strKey];
- }
- else
- {
- if (strKey != "BB")
- {
- if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
- this.ultraDataSource1.Rows[0][i] = null;
- else
- this.ultraDataSource1.Rows[0][i] = "";
- }
- }
- }
- catch { }
- }
- // 计算在站时间
- DateTime dt1, dt2;
- try
- {
- if (!string.IsNullOrEmpty(ar["ARRIVETIME"].ToString()) && !string.IsNullOrEmpty(ar["LEAVETIME"].ToString()))
- ultraGrid1.Rows[0].Cells["ProcessDur"].Value = CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(ar["ARRIVETIME"]), Convert.ToDateTime(ar["LEAVETIME"]));
- else if (!string.IsNullOrEmpty(ar["ARRIVETIME"].ToString()) && string.IsNullOrEmpty(ar["LEAVETIME"].ToString()))
- ultraGrid1.Rows[0].Cells["ProcessDur"].Value = CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(ar["ARRIVETIME"]), DateTime.Now);
- }
- catch { }
-
- }
- }
- }
|