using Hydro.CommonBase; using Newtonsoft.Json; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace Hydro.ConfigModel { public class LogicPoint { public static string selectColumn = "Id, Name, LogicType, ExpressionType, IndicatorType, ModelObjectID, Sort, ParentId, Expression, ExtJson"; public static List Columns { get { return selectColumn.Split(',').Select(item => item.Trim()).ToList(); } set { selectColumn = string.Concat(value, ','); } } [DisplayName("编号")] [Category("1、基本信息")] public int Id { get; set; } [DisplayName("名称")] [Category("1、基本信息")] public string Name { get; set; } [DisplayName("类型")] [Category("1、基本信息")] public string LogicType { get; set; } [DisplayName("值类型")] [Category("2、计算参数")] public string ExpressionType { get; set; } private string _fullAddress; [Browsable(false)] public string FullAddress => _fullAddress ?? (_fullAddress = ExpressionType == "3389" ? LogicType : $"{LogicType}:{ExpressionType}"); [Browsable(false)] public string ExpressionToShow { get { if (ExpressionType == null) return null; if (ExpressionType.IndexOf("接口") >= 0 ) { return ExpressionType + " " + Expression; } else if (ExpressionType.IndexOf("基准值") >= 0 || ExpressionType.IndexOf("计算值") >= 0 || ExpressionType.IndexOf("变化值") >= 0 || ExpressionType.IndexOf("初始计算值") >= 0) { return ExpressionType + " " + Expression; } else if (ExpressionType.IndexOf("值") >= 0 || ExpressionType.IndexOf("系数") >= 0) { return ExpressionType; } else { return $"{ExpressionType} " + (ExpressionType == "∈" ? $"[{Expression}] ▲{accurary}" : (ExpressionType == "最小" || ExpressionType == "最大" ? $"| 容许范围[{Expression}]" : Expression)); } } } [DisplayName("监测类型")] [Category("1、基本信息")] public string IndicatorType { get; set; } [DisplayName("模型编号或内容")] [Category("2、计算参数")] public string ModelObjectID { get; set; } [DisplayName("排序")] [Category("4、其他")] public int Sort { get; set; } [DisplayName("父节点编号")] [Category("4、其他")] public int ParentId { get; set; } [DisplayName("值")] [Category("2、计算参数")] public string Expression { get; set; } [Browsable(false)] public string ExtJson { get; set; } = ""; private HostExt _ext; [Browsable(false)] public HostExt Ext { get { if (_ext == null) { try { _ext = JsonConvert.DeserializeObject(ExtJson); if (_ext == null) _ext = new HostExt(); return _ext; } catch { return (_ext=new HostExt()); } } else return _ext;// ?? } } [Browsable(false)] public byte[] VPN { get; set; } = null; [DisplayName("结果")] [Category("2、计算参数")] public string Result { get; set; } = null; public dict di = null; public string objListString = null; [DisplayName("对象名称")] [Category("1、基本信息")] public string ObjectType { get { return this.Ext.ObjectType; } set { this.Ext.ObjectType = value; } } [DisplayName("精度")] [Category("2、计算参数")] public string accurary { get { return this.Ext.accurary; } set { this.Ext.accurary = value; } } [DisplayName("子方案名称")] [Category("3、子方案")] public string childSolution { get { return this.Ext.childSolution; } set { this.Ext.childSolution = value; } } [DisplayName("子方案键")] [Category("3、子方案")] public string childTag { get { return this.Ext.childTag; } set { this.Ext.childTag = value; } } [DisplayName("子方案传输")] [Category("3、子方案")] public string childType { get { return this.Ext.childType; } set { this.Ext.childType = value; } } [DisplayName("子搜索精度")] [Category("3、子方案")] public string SaveAcc { get { return this.Ext.SaveAcc; } set { this.Ext.SaveAcc = value; } } [DisplayName("是否存储")] [Category("3、子方案")] public string isSave { get { return this.Ext.isSave; } set { this.Ext.isSave = value; } } [DisplayName("存储键值")] [Category("3、子方案")] public string SaveRange { get { return this.Ext.SaveRange; } set { this.Ext.SaveRange = value; } } [DisplayName("是否内存存储")] [Category("3、子方案")] public string isMemSave { get { return this.Ext.isMemSave; } set { this.Ext.isMemSave = value; } } [DisplayName("内存存储范围")] [Category("3、子方案")] public string MemSaveRange { get { return this.Ext.MemSaveRange; } set { this.Ext.MemSaveRange = value; } } [DisplayName("内存存储精度")] [Category("3、子方案")] public string MemSaveAcc { get { return this.Ext.MemSaveAcc; } set { this.Ext.MemSaveAcc = value; } } [DisplayName("内存存储次序")] [Category("3、子方案")] public string MemSaveIndex { get { return this.Ext.MemSaveIndex; } set { this.Ext.MemSaveIndex = value; } } [DisplayName("启用")] [Category("1、基本信息")] public bool Enable { get { return this.Ext.Enable; } set { this.Ext.Enable = value; } } [DisplayName("可见性")] [Category("1、基本信息")] public bool Visible { get { return this.Ext.Visible; } set { this.Ext.Visible = value; } } } }