using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Reflection;
namespace Core.StlMes.Client.LgClassModel
{
[Serializable]
public class COM_STL_COMMAND
{
private string _id_ = ""; //ID
private string _stationcode = ""; //岗位编号(如:BOF、CAS)
private decimal _sortid = 0; //岗位编号内顺序
private string _opttype = ""; //操作类型(1:正常操作、2:异常操作、3:切换岗位信息)
private string _objectpos = ""; //执行目标位置(如:LFS01_DEVICE)
private string _optcaption = ""; //操作说明
///
/// 操作命令类型:
/// TAPPING:出钢;
/// GONEXT:出下道工序;
/// ASSIGNEDPOS:指定位置;
/// ARRIVE:进站/上台;
/// LEAVE:出站/下台;
/// TRANS:位置对换;
/// OPENCAST:开浇;
/// STOPCAST:停浇;
/// OVER:强制结束;
/// SWITCH:切换信息显示;
/// MELTDOWN:钢水回炉
///
private COM_STL_COMMAND_CMDTYPE _optcommandtype = COM_STL_COMMAND_CMDTYPE.NONE;
private string _filedname01 = ""; //更新时间字段名称1
private string _filedname02 = ""; //更新时间字段名称2
private string _filedname03 = ""; //更新时间字段名称3
private string _visible_idle = ""; //IDLE位可见
private string _visible_front = ""; //FRONT位可见
private string _visible_device = ""; //DEVICE位可见
private string _visible_back = ""; //BACK位可见
///
/// ID
///
public string ID_
{
get { return this._id_; }
set { if (value != this._id_) this._id_ = value; }
}
///
///岗位编号(如:BOF、CAS)
///
public string STATIONCODE
{
get { return this._stationcode; }
set { if (value != this._stationcode) this._stationcode = value; }
}
///
/// 岗位编号内顺序
///
public decimal SORTID
{
get { return this._sortid; }
set { if (value != this._sortid) this._sortid = value; }
}
///
/// 操作类型(1:正常操作、2:异常操作、3:切换岗位信息)
///
public string OPTTYPE
{
get { return this._opttype; }
set { if (value != this._opttype) this._opttype = value; }
}
///
/// 执行目标位置(如:LFS01_DEVICE)
///
public string OBJECTPOS
{
get { return this._objectpos; }
set { if (value != this._objectpos) this._objectpos = value; }
}
///
/// 操作说明
///
public string OPTCAPTION
{
get { return this._optcaption; }
set { if (value != this._optcaption) this._optcaption = value; }
}
///
/// 操作命令类型:
/// TAPPING:出钢;
/// GONEXT:出下道工序;
/// ASSIGNEDPOS:指定位置;
/// ARRIVE:进站/上台;
/// LEAVE:出站/下台;
/// TRANS:位置对换;
/// OPENCAST:开浇;
/// STOPCAST:停浇;
/// OVER:强制结束;
/// SWITCH:切换信息显示;
/// MELTDOWN:钢水回炉
///
public COM_STL_COMMAND_CMDTYPE OPTCOMMANDTYPE
{
get { return this._optcommandtype; }
set { if (value != this._optcommandtype) this._optcommandtype = value; }
}
///
/// 更新时间字段名称1
///
public string FILEDNAME01
{
get { return this._filedname01; }
set { if (value != this._filedname01) this._filedname01 = value; }
}
///
/// 更新时间字段名称2
///
public string FILEDNAME02
{
get { return this._filedname02; }
set { if (value != this._filedname02) this._filedname02 = value; }
}
///
/// 更新时间字段名称3
///
public string FILEDNAME03
{
get { return this._filedname03; }
set { if (value != this._filedname03) this._filedname03 = value; }
}
///
/// IDLE位可见
///
public string VISIBLE_IDLE
{
get { return this._visible_idle; }
set { if (value != this._visible_idle) this._visible_idle = value; }
}
///
/// FRONT位可见
///
public string VISIBLE_FRONT
{
get { return this._visible_front; }
set { if (value != this._visible_front) this._visible_front = value; }
}
///
/// DEVICE位可见
///
public string VISIBLE_DEVICE
{
get { return this._visible_device; }
set { if (value != this._visible_device) this._visible_device = value; }
}
///
/// BACK位可见
///
public string VISIBLE_BACK
{
get { return this._visible_back; }
set { if (value != this._visible_back) this._visible_back = value; }
}
///
/// 数据重置
///
public void Reset()
{
PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
if (PropertyInfos == null || PropertyInfos.Length == 0) return;
object value = null;
foreach (PropertyInfo oPropertyInfo in PropertyInfos)
{
try
{
if (oPropertyInfo.Name.ToUpper().Equals("OPTCOMMANDTYPE"))
oPropertyInfo.SetValue(this, COM_STL_COMMAND_CMDTYPE.NONE, null);
else
oPropertyInfo.SetValue(this, value, null);
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
}
///
/// 复制
///
///
public void Copy(ref STL_IRON_ARRIVE par)
{
if (par != null)
{
PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
if (PropertyInfos == null || PropertyInfos.Length == 0) return;
object value;
foreach (PropertyInfo oPropertyInfo in PropertyInfos)
{
try
{
value = oPropertyInfo.GetValue(par, null);
oPropertyInfo.SetValue(this, value, null);
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
}
}
///
///设置数据
///
///
public void SetData(DataRow Row)
{
if (Row == null) return;
PropertyInfo[] PropertyInfos = this.GetType().GetProperties();
if (PropertyInfos == null || PropertyInfos.Length == 0) return;
COM_STL_COMMAND_CMDTYPE cmdType = COM_STL_COMMAND_CMDTYPE.NONE;
foreach (PropertyInfo oPropertyInfo in PropertyInfos)
{
try
{
if (Row.Table.Columns.Contains(oPropertyInfo.Name.ToUpper()))
{
if (oPropertyInfo.Name.ToUpper().Equals("OPTCOMMANDTYPE"))
{
try
{
cmdType = (COM_STL_COMMAND_CMDTYPE)Enum.Parse(typeof(COM_STL_COMMAND_CMDTYPE), Convert.ToString(Row[oPropertyInfo.Name.ToUpper()]), true);
}
catch
{
cmdType = COM_STL_COMMAND_CMDTYPE.NONE;
}
oPropertyInfo.SetValue(this, cmdType, null);
}
else oPropertyInfo.SetValue(this, Row[oPropertyInfo.Name.ToUpper()], null);
}
}
catch (Exception ex)
{
Debug.Print(ex.Message);
}
}
}
}
public class CommandCollection
{
private ArrayList _Keys;
private Hashtable _Values;
public CommandCollection()
{
_Keys = new ArrayList();
_Values = new Hashtable();
}
public bool Contains(COM_STL_COMMAND Item)
{
return (Item != null && _Keys.Contains(Item.ID_));
}
public int Count
{
get
{
return _Keys.Count;
}
}
public COM_STL_COMMAND this[int index]
{
get
{
if (_Keys != null && index >= 0 && index < _Keys.Count)
{
return (COM_STL_COMMAND)_Values[_Keys[index]];
}
return null;
}
}
public COM_STL_COMMAND this[string Key]
{
get
{
if (_Keys != null && _Keys.Contains(Key))
{
return (COM_STL_COMMAND)_Values[Key];
}
return null;
}
}
public COM_STL_COMMAND Add(COM_STL_COMMAND Item)
{
if (Item == null || _Keys.Contains(Item.ID_))
{
return null;
}
else
{
_Keys.Add(Item.ID_);
_Values.Add(Item.ID_, Item);
return Item;
}
}
public void Remove(COM_STL_COMMAND Item)
{
if (Item != null && _Keys.Contains(Item.ID_))
{
_Keys.Remove(Item.ID_);
_Values.Remove(Item.ID_);
}
}
public void RemoveAt(int index)
{
if (index >= 0 && index < _Keys.Count)
{
object obj = _Keys[index];
if (obj != null)
{
_Keys.Remove(obj);
_Values.Remove(obj);
}
}
}
public void RemoveAll()
{
Clear();
}
public void Clear()
{
_Keys.Clear();
_Values.Clear();
}
}
///
/// 炼钢作业手动操作命令类型
///
public enum COM_STL_COMMAND_CMDTYPE
{
///
/// 空
///
NONE,
///
/// 出钢
///
TAPPING,
///
/// 出下道工序
///
GONEXT,
///
/// 指定位置
///
ASSIGNEDPOS,
///
/// 进站/上台
///
ARRIVE,
///
/// 出站/下台
///
LEAVE,
///
/// 位置对换
///
TRANS,
///
/// 开浇
///
OPENCAST,
///
/// 停浇
///
STOPCAST,
///
/// 强制结束
///
OVER,
///
/// 切换信息显示
///
SWITCH,
///
/// 钢水回炉
///
MELTDOWN,
}
}