using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using CoreFS.CA06;
using System.Collections;
using Core.LgMes.Client.Comm;
using Core.Mes.Client.Common;
namespace Core.LgMes.Client.LgResMgt
{
public partial class ucTempSampling : UserControl
{
public OpeBase ob = null;
private DataTable _dtSample = null; // 温度采样数据表
private DataTable _dtTemperature = null; // 温度
private DataTable _dtCraftStdVal = null; // 标准值
private string _stationId = ""; //岗位编码
public ucTempSampling()
{
InitializeComponent();
}
///
/// 获取温度采样数据
///
/// 熔炼号
/// 岗位编码(例C01)
/// 处理次数(例01)
public void GetSampleData(string _smeltingID, string _stationCode, string _dealTime)
{
string szOut = "", szWhere = " WHERE HEATNO = '" + _smeltingID + "' AND STATIONCODE = '" + _stationCode + "' AND DISPOSALTIME='" + _dealTime + "'";
string strErr = "", strHNo = "", strSCode = "", strDTime = "";
strHNo = _smeltingID;
strSCode = _stationCode;
strDTime = _dealTime;
_stationId = _stationCode;
ArrayList arry = new ArrayList();
arry.Add("GetBofSamplingData.select");
arry.Add(strHNo);
arry.Add(strHNo);
arry.Add(strSCode);
arry.Add(strSCode);
arry.Add(strDTime);
arry.Add(strDTime);
arry.Add(strHNo);
arry.Add(strHNo);
arry.Add(strSCode);
arry.Add(strSCode);
arry.Add(strDTime);
arry.Add(strDTime);
CommonClientToServer cctos = new CommonClientToServer();
cctos.ob = this.ob;
DataSet ds = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
"doSimpleQuery", arry, out strErr);
if (strErr == "" && ds != null)
{
_dtSample = ds.Tables[0];
}
SetColumDisplay();
}
///
/// 填充温度信息界面数据
///
public void FillTemperatureData(string strSamplingName)
{
try
{
lock (this)
{
this._dtTemperature.Rows.Clear();
int nRows = 0; // 加一条铁水温度
DataRow[] dr = null;
if (_dtSample != null && _dtSample.Rows.Count > 0)
{
if (strSamplingName.Contains("2") == true) //判断中包温度
{
dr = _dtSample.Select("SAMPLINGNAME='" + strSamplingName + "' or SAMPLINGNAME='" + strSamplingName.Replace("2", "1") + "'", " SAMPLINGDATE ASC");
}
else
dr = _dtSample.Select("SAMPLINGNAME='" + strSamplingName + "' or SAMPLINGNAME='" + strSamplingName + "1' or SAMPLINGNAME='" + strSamplingName + "2'", " SAMPLINGDATE ASC");
}
if (dr != null && dr.Length > 0)
nRows += dr.Length;
CStaticMethod.ResetTableRows(ref _dtTemperature, nRows);
int i = 0;
string szVal = "";
#region " 实时值 "
if (dr != null && dr.Length > 0)
{
string str = "";
for (int j = 0; j < dr.Length; j++, i++)
{
if (dr[j]["STATIONCODE"].ToString().Substring(0, 1) == "C")
{
if (i == 0)
str = "一倒温度";
else if (i == dr.Length - 1)
str = "终点温度";
else
str = "过程温度";
}
else if (dr[j]["STATIONCODE"].ToString().Substring(0, 1) == "G")
{
str = "中包" + (i + 1).ToString() + "次测温";
}
else
{
if (i == 0)
str = "进站温度";
else if (i == dr.Length - 1)
str = "出站温度";
else
str = "过程温度";
}
CStaticMethod.SetGridTemperature(ref _dtTemperature, str, "", dr[j]["SAMPLINGVALUE"].ToString(), dr[j]["ALPPM"].ToString(), dr[j]["CPPM"].ToString(), dr[j]["O2PPM"].ToString(), dr[j]["SAMPLINGDATE"].ToString(), i);
}
}
#endregion
#region " 与标准进行比对 "
if (dr != null && dr.Length > 0)
{
CStaticMethod.CompareStandard(_dtCraftStdVal, ref _dtTemperature, "L02004", ref ultgridTemp, dr.Length, "C");
}
#endregion
}
}
catch (Exception ex)
{
string Msg = ex.Message;
}
}
private void ucTempSampling_Load(object sender, EventArgs e)
{
_dtTemperature = new DataTable("temperature");
_dtTemperature.Columns.Add(new DataColumn("项目名", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("实际值", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("定铝值", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("定碳值", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("定氧值", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("采样时间", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("设定范围", typeof(String)));
_dtTemperature.Columns.Add(new DataColumn("id", typeof(String)));
this.ultgridTemp.DataSource = this._dtTemperature;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[0].Width = 70;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[0].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[0].Header.Caption = "项目名";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[1].Width = 60;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[1].Header.Caption = "温度值";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[2].Width = 60;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[2].Header.Caption = "定铝值";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[3].Width = 60;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[3].Header.Caption = "定碳值";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].Width = 60;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].Header.Caption = "定氧值";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[5].Width = 120;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[5].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[5].Header.Caption = "采样时间";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[6].Width = 60;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[6].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[6].Header.Caption = "范围";
this.ultgridTemp.DisplayLayout.Bands[0].Columns[2].Hidden = true;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[3].Hidden = true;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].Hidden = true;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[6].Hidden = true;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[7].Hidden = true;
}
private void SetColumDisplay()
{
if (_stationId == string.Empty) return;
switch (_stationId.Substring(0, 1))
{
case "D":
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].Hidden = false;
break;
case "F":
this.ultgridTemp.DisplayLayout.Bands[0].Columns[2].Hidden = false ;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[3].Hidden = false ;
this.ultgridTemp.DisplayLayout.Bands[0].Columns[4].Hidden = false ;
break;
}
}
}
}