using System;
using QMAPP.Entity;
using QMFrameWork.Data.Attributes;
using System.Data;
namespace QMAPP.FJC.Entity.EnergyManage
{
[DBTable(TableName = "T_EM_METER")]
public class Meter : BaseEntity
{
///
///主键
///
[DBColumn(ColumnName = "PID", DataType = DbType.String, IsKey = true)]
public string PID { get; set; }
///
///能源表编码
///
[DBColumn(ColumnName = "METER_CODE", DataType = DbType.String)]
public string METER_CODE { get; set; }
///
///能源表名称
/// 临时存设备名
///
[DBColumn(ColumnName = "METER_NAME", DataType = DbType.String)]
public string METER_NAME { get; set; }
///
///能源表类型
///
[DBColumn(ColumnName = "METER_TYPE", DataType = DbType.String)]
public string METER_TYPE { get; set; }
public string METER_TYPE_TXT { get; set; }
///
///能源表网络地址
///
[DBColumn(ColumnName = "NET_ADDR", DataType = DbType.String)]
public string NET_ADDR { get; set; }
///
///能源表网络标识
///
[DBColumn(ColumnName = "NET_ID", DataType = DbType.String)]
public string NET_ID { get; set; }
///
///获取方式 1 自动 2 手动
///
[DBColumn(ColumnName = "STATE", DataType = DbType.String)]
public string STATE { get; set; }
public string STATE_TXT { get; set; }
///
///工厂编码
///
[DBColumn(ColumnName = "FACTORY_CODE", DataType = DbType.String)]
public string FACTORY_CODE { get; set; }
///
///设备编码
///
[DBColumn(ColumnName = "EQPT_CODE", DataType = DbType.String)]
public string EQPT_CODE { get; set; }
public string MACHINENAME { get; set; }
///
///互感器倍率
///
[DBColumn(ColumnName = "RATIO", DataType = DbType.String)]
public Double RATIO { get; set; }
public string CONSUME { get; set; }
public string WORKCENTER_CODE { get; set; }
public DateTime ONLINETIMESTART;
public DateTime ONLINETIMEEND;
public string EQPT_NAME { get; set; }
#region 电表扩展属性
///
/// 电表系统号
///
public Int16 SysNum
{
get
{
if (NET_ID != null)
{
string[] MeterAddr = NET_ID.Split(',');
if (MeterAddr.Length > 0)
return Int16.Parse(MeterAddr[0]);
}
return 0;
}
}
///
/// 电表号
///
public Int16 MeterNum
{
get
{
if (NET_ID != null)
{
string[] MeterAddr = NET_ID.Split(',');
if (MeterAddr.Length > 1)
return Int16.Parse(MeterAddr[1]);
}
return 0;
}
}
///
/// 用户号
///
public byte UserNum
{
get
{
if (NET_ID != null)
{
string[] MeterAddr = NET_ID.Split(',');
if (MeterAddr.Length > 2)
return byte.Parse(MeterAddr[2]);
}
return 0;
}
}
///
/// IP地址
///
public string IPAddr
{
get
{
if (NET_ADDR!=null)
{
string[] NET_ADDRArray = NET_ADDR.Split(':');
if (NET_ADDRArray.Length > 0)
return NET_ADDRArray[0];
}
return "0";
}
}
///
/// 端口号
///
public int Port
{
get
{
if (NET_ADDR != null)
{
string[] NET_ADDRArray = NET_ADDR.Split(':');
if (NET_ADDRArray.Length > 1)
return int.Parse(NET_ADDRArray[1]);
}
return 0;
}
}
#endregion
}
}