using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IStation.Service
{
public static class MonitorPointSignalViewExtensions
{
///
/// 获取记录值类型
///
///
///
public static Model.eGeneralRecordValueType GetRecordValueType(this Model.GeneralMonitorPoint signal)
{
if (signal == null)
return Model.eGeneralRecordValueType.数值;
return new GeneralRecordType().GetValueTypeByIdentifier(signal.RecordType);
}
///
/// 获取记录单位类型
///
///
///
public static Model.eUnitType GetRecordUnitType(this Model.GeneralMonitorPoint signal)
{
if (signal == null)
return Model.eUnitType.未知;
return new GeneralRecordType().GetUnitTypeByIdentifier(signal.RecordType);
}
public static string GetRecordUnitName(this Model.GeneralMonitorPoint signal)
{
if (signal == null)
return default;
var record = new GeneralRecordType().GetByIdentifier(signal.RecordType);
if (record == null)
return default;
var unitType = record.UnitType;
if (unitType == Model.eUnitType.未知 || unitType == Model.eUnitType.自定义)
return record.UnitValue;
return Model.GeneralRecordUnitHelper.GetUnitEnDisp(unitType,int.Parse(record.UnitValue));
}
///
/// 获取记录枚举值字典
///
///
///
public static Dictionary GetRecordEnumValueDict(this Model.GeneralMonitorPoint signal)
{
if (signal == null)
return default;
var dict = new GeneralRecordType().GetEnumDisplayDict(signal.RecordType);
return dict;
}
}
}