lixiaojun
2024-12-02 f54adb8f368def21b9aa01e466b09bed6cd8347c
Service/HStation.Service.Revit.Core/02-parter/00-core/RevitParter.cs
@@ -3,7 +3,7 @@
    /// <summary>
    /// 组件
    /// </summary>
    public class RevitParter
    public abstract class RevitParter
    {
        /// <summary>
        /// 
@@ -16,42 +16,93 @@
        public RevitParter(Model.RevitParter rhs)
        {
            this.Id = rhs.Id;
            this.Catalog = rhs.Catalog;
            this.Name = rhs.Name;
            this.Code = rhs.Code;
            this.ModelType = rhs.ModelType;
            this.Flags = rhs.Flags;
            this.Description = rhs.Description;
            this.PropValueList = rhs.PropValueList?.Select(x => new RevitPropValue(x)).ToList();
            this.PropStatusList = rhs.PropStatusList?.Select(x => new RevitPropStatus(x)).ToList();
        }
        /// <summary>
        /// Id
        /// </summary>
        [JsonProperty("Id", NullValueHandling = NullValueHandling.Ignore)]
        public string Id { get; set; }
        /// <summary>
        /// 分类
        /// </summary>
        public string Catalog { get; set; }
        /// <summary>
        /// 名称
        /// </summary>   
        [JsonProperty("名称", NullValueHandling = NullValueHandling.Ignore)]
        public string Name { get; set; }
        /// <summary>
        /// 编码
        /// 型号
        /// </summary>
        [JsonProperty("编码", NullValueHandling = NullValueHandling.Ignore)]
        public string Code { get; set; }
        public string ModelType { get; set; }
        /// <summary>
        /// 标签
        /// </summary>
        [JsonProperty("标签", NullValueHandling = NullValueHandling.Ignore)]
        public List<string> Flags { get; set; }
        /// <summary>
        /// 说明
        /// </summary>   
        [JsonProperty("说明信息", NullValueHandling = NullValueHandling.Ignore)]
        public string Description { get; set; }
        /// <summary>
        /// 属性值列表
        /// </summary>
        public List<RevitPropValue> PropValueList { get; set; }
        /// <summary>
        /// 属性状态列表
        /// </summary>
        public List<RevitPropStatus> PropStatusList { get; set; }
        /// <summary>
        /// 获取属性名称
        /// </summary>
        public RevitPropStatus GetPropStatus(string propName)
        {
            if (string.IsNullOrEmpty(propName))
            {
                return default;
            }
            var propStatus = this.PropStatusList?.Find(x => x.PropName == propName);
            return propStatus;
        }
        /// <summary>
        /// 更新属性状态
        /// </summary>
        public bool UpdatePropStatus(string propName, ePropStatus propStatus, string statusInfo)
        {
            if (string.IsNullOrEmpty(propName))
            {
                return false;
            }
            if (this.PropStatusList == null)
            {
                this.PropStatusList = new List<Model.RevitPropStatus>();
            }
            var propStatusModel = this.GetPropStatus(propName);
            if (propStatusModel == null)
            {
                propStatusModel = new Model.RevitPropStatus() { PropName = propName };
                this.PropStatusList.Add(propStatusModel);
            }
            propStatusModel.PropStatus = propStatus;
            propStatusModel.StatusInfo = statusInfo;
            return true;
        }
    }
}