| | |
| | | using System.Transactions; |
| | | |
| | | namespace HStation.Service |
| | | namespace HStation.Service |
| | | { |
| | | /// <summary> |
| | | /// Revit Json辅助类 |
| | |
| | | } |
| | | var decorator = new Model.RevitDecorator(); |
| | | decorator.Id = id; |
| | | decorator.Code = id; |
| | | decorator.Name = jobject[RevitOthersJsonProp.Name]?.ToString(); |
| | | decorator.Category = jobject[RevitOthersJsonProp.CategoryName]?.ToString(); |
| | | decorator.Decoration = jobject[RevitOthersJsonProp.CategoryID]?.ToString(); |
| | |
| | | return revitModel; |
| | | } |
| | | |
| | | //解析连接节点 |
| | | private static HStation.Model.RevitJunction ParseJunction(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var junction = new Model.RevitJunction(); |
| | | junction.Catalog = RevitJsonCatalog.Junction; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | junction.Id = id; |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | junction.Code = code; |
| | | if (string.IsNullOrEmpty(junction.Code)) |
| | | { |
| | | junction.Code = junction.Id; |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | junction.Name = name; |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | junction.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(junction.ModelType)) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | junction.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (junction.Flags == null || junction.Flags.Count < 1) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | junction.Description = description; |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | junction.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (junction.ConnectList == null || junction.ConnectList.Count < 1) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | junction.Quality = quality; |
| | | if (junction.Quality <= 0) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | junction.Position = junction.ConnectList?.GetCenterPosition(); |
| | | if (junction.Position == null) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | junction.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (junction.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | junction.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (junction.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (junction.Position == null) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | junction.Elev = junction.Position.Z; |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | junction.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | junction.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(junction.DemandPattern)) |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.AppendOrUpdatePropStatus(nameof(junction.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return junction; |
| | | } |
| | | |
| | | //解析喷头 |
| | | private static HStation.Model.RevitNozzle ParseNozzle(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var nozzle = new Model.RevitNozzle(); |
| | | nozzle.Catalog = RevitJsonCatalog.Nozzle; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | nozzle.Id = id; |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | nozzle.Code = code; |
| | | if (string.IsNullOrEmpty(nozzle.Code)) |
| | | { |
| | | nozzle.Code = nozzle.Id; |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | nozzle.Name = name; |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | nozzle.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(nozzle.ModelType)) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | nozzle.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (nozzle.Flags == null || nozzle.Flags.Count < 1) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | nozzle.Description = description; |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | nozzle.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (nozzle.ConnectList == null || nozzle.ConnectList.Count < 1) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | nozzle.Quality = quality; |
| | | if (nozzle.Quality <= 0) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | nozzle.Position = nozzle.ConnectList?.GetCenterPosition(); |
| | | if (nozzle.Position == null) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | nozzle.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (nozzle.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | nozzle.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (nozzle.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (nozzle.Position == null) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | nozzle.Elev = nozzle.Position.Z; |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | nozzle.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | nozzle.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(nozzle.DemandPattern)) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Coefficient |
| | | |
| | | if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) |
| | | { |
| | | nozzle.Coefficient = coeffientp; |
| | | if (nozzle.Coefficient <= 0) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[喷射系数]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Abnormal, "[喷射系数]缺少或者格式错误"); |
| | | if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) |
| | | { |
| | | nozzle.Coefficient = coeffientf; |
| | | if (nozzle.Coefficient <= 0) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[流量系数]缺省"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (nozzle.Coefficient < 1) |
| | | { |
| | | nozzle.AppendOrUpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[喷射系数]缺省,使用默认值(163)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return nozzle; |
| | | } |
| | | |
| | | //解析消火栓 |
| | | private static HStation.Model.RevitHydrant ParseHydrant(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var hydrant = new Model.RevitHydrant(); |
| | | hydrant.Catalog = RevitJsonCatalog.Hydrant; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | hydrant.Id = id; |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | hydrant.Code = code; |
| | | if (string.IsNullOrEmpty(hydrant.Code)) |
| | | { |
| | | hydrant.Code = hydrant.Id; |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | hydrant.Name = name; |
| | | if (string.IsNullOrEmpty(hydrant.Name)) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | hydrant.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(hydrant.ModelType)) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | hydrant.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (hydrant.Flags == null || hydrant.Flags.Count < 1) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | hydrant.Description = description; |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | hydrant.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (hydrant.ConnectList == null || hydrant.ConnectList.Count < 1) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | hydrant.Quality = quality; |
| | | if (hydrant.Quality <= 0) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | hydrant.Position = hydrant.ConnectList?.GetCenterPosition(); |
| | | if (hydrant.Position == null) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | hydrant.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (hydrant.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | hydrant.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (hydrant.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (hydrant.Position == null) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | hydrant.Elev = hydrant.Position.Z; |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | hydrant.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | hydrant.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(hydrant.DemandPattern)) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Coefficient |
| | | |
| | | if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) |
| | | { |
| | | hydrant.Coefficient = coeffientp; |
| | | if (hydrant.Coefficient <= 0) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Lack, "[喷射系数]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Abnormal, "[喷射系数]缺少或者格式错误"); |
| | | if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) |
| | | { |
| | | hydrant.Coefficient = coeffientf; |
| | | if (hydrant.Coefficient <= 0) |
| | | { |
| | | hydrant.AppendOrUpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Lack, "[流量系数]缺省"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return hydrant; |
| | | } |
| | | |
| | | //解析闷头 |
| | | private static HStation.Model.RevitBlunthead ParseBlunthead(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var blunthead = new Model.RevitBlunthead(); |
| | | blunthead.Catalog = RevitJsonCatalog.Blunthead; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | blunthead.Id = id; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | blunthead.Code = code; |
| | | if (string.IsNullOrEmpty(blunthead.Code)) |
| | | { |
| | | blunthead.Code = blunthead.Id; |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | blunthead.Name = name; |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | blunthead.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(blunthead.ModelType)) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | blunthead.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (blunthead.Flags == null || blunthead.Flags.Count < 1) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | blunthead.Description = description; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | blunthead.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (blunthead.ConnectList == null || blunthead.ConnectList.Count < 1) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | blunthead.Quality = quality; |
| | | if (blunthead.Quality <= 0) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | blunthead.Position = blunthead.ConnectList?.GetCenterPosition(); |
| | | if (blunthead.Position == null) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | blunthead.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (blunthead.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | blunthead.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (blunthead.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (blunthead.Position == null) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | blunthead.Elev = blunthead.Position.Z; |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | blunthead.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | blunthead.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(blunthead.DemandPattern)) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | blunthead.Material = material; |
| | | if (string.IsNullOrEmpty(blunthead.Material)) |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | blunthead.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.Caliber), ePropStatus.Abnormal, "[口径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | blunthead.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | blunthead.AppendOrUpdatePropStatus(nameof(blunthead.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return blunthead; |
| | | } |
| | | |
| | | //解析弯头 |
| | | private static HStation.Model.RevitElbow ParseElbow(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var elbow = new Model.RevitElbow(); |
| | | elbow.Catalog = RevitJsonCatalog.Elbow; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | elbow.Id = id; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | elbow.Code = code; |
| | | if (string.IsNullOrEmpty(elbow.Code)) |
| | | { |
| | | elbow.Code = elbow.Id; |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | elbow.Name = name; |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | elbow.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(elbow.ModelType)) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | elbow.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (elbow.Flags == null || elbow.Flags.Count < 1) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | elbow.Description = description; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | elbow.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (elbow.ConnectList == null || elbow.ConnectList.Count < 1) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | elbow.Quality = quality; |
| | | if (elbow.Quality <= 0) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | elbow.Position = elbow.ConnectList?.GetCenterPosition(); |
| | | if (elbow.Position == null) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | elbow.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (elbow.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | elbow.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (elbow.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (elbow.Position == null) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | elbow.Elev = elbow.Position.Z; |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | elbow.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | elbow.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(elbow.DemandPattern)) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | elbow.Material = material; |
| | | if (string.IsNullOrEmpty(elbow.Material)) |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | elbow.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.Caliber), ePropStatus.Abnormal, "[口径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | elbow.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | elbow.AppendOrUpdatePropStatus(nameof(elbow.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return elbow; |
| | | } |
| | | |
| | | //解析三通 |
| | | private static HStation.Model.RevitThreelink ParseThreelink(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var threelink = new Model.RevitThreelink(); |
| | | threelink.Catalog = RevitJsonCatalog.Threelink; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | threelink.Id = id; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | threelink.Code = code; |
| | | if (string.IsNullOrEmpty(threelink.Code)) |
| | | { |
| | | threelink.Code = threelink.Id; |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | threelink.Name = name; |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | threelink.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(threelink.ModelType)) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | threelink.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (threelink.Flags == null || threelink.Flags.Count < 1) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | threelink.Description = description; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | threelink.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (threelink.ConnectList == null || threelink.ConnectList.Count < 1) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | threelink.Quality = quality; |
| | | if (threelink.Quality <= 0) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | threelink.Position = threelink.ConnectList?.GetCenterPosition(); |
| | | if (threelink.Position == null) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | threelink.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (threelink.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | threelink.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (threelink.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (threelink.Position == null) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | threelink.Elev = threelink.Position.Z; |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | threelink.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | threelink.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(threelink.DemandPattern)) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | threelink.Material = material; |
| | | if (string.IsNullOrEmpty(threelink.Material)) |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | threelink.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.Caliber), ePropStatus.Abnormal, "[口径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | threelink.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | threelink.AppendOrUpdatePropStatus(nameof(threelink.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return threelink; |
| | | } |
| | | |
| | | //解析四通 |
| | | private static HStation.Model.RevitFourlink ParseFourlink(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var fourlink = new Model.RevitFourlink(); |
| | | fourlink.Catalog = RevitJsonCatalog.Fourlink; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | fourlink.Id = id; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | fourlink.Code = code; |
| | | if (string.IsNullOrEmpty(fourlink.Code)) |
| | | { |
| | | fourlink.Code = fourlink.Id; |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | fourlink.Name = name; |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | fourlink.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(fourlink.ModelType)) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | fourlink.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (fourlink.Flags == null || fourlink.Flags.Count < 1) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | fourlink.Description = description; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | fourlink.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (fourlink.ConnectList == null || fourlink.ConnectList.Count < 1) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | fourlink.Quality = quality; |
| | | if (fourlink.Quality <= 0) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | fourlink.Position = fourlink.ConnectList?.GetCenterPosition(); |
| | | if (fourlink.Position == null) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | fourlink.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (fourlink.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | fourlink.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (fourlink.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (fourlink.Position == null) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | fourlink.Elev = fourlink.Position.Z; |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | fourlink.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | fourlink.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(fourlink.DemandPattern)) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | fourlink.Material = material; |
| | | if (string.IsNullOrEmpty(fourlink.Material)) |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | fourlink.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.Caliber), ePropStatus.Abnormal, "[口径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | fourlink.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | fourlink.AppendOrUpdatePropStatus(nameof(fourlink.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return fourlink; |
| | | } |
| | | |
| | | //解析水表 |
| | | private static HStation.Model.RevitMeter ParseMeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var meter = new Model.RevitMeter(); |
| | | meter.Catalog = RevitJsonCatalog.Meter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | meter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | meter.Code = code; |
| | | if (string.IsNullOrEmpty(meter.Code)) |
| | | { |
| | | meter.Code = meter.Id; |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | meter.Name = name; |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | meter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(meter.ModelType)) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | meter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (meter.Flags == null || meter.Flags.Count < 1) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | meter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | meter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (meter.ConnectList == null || meter.ConnectList.Count < 1) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | meter.Quality = quality; |
| | | if (meter.Quality <= 0) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | meter.Position = meter.ConnectList?.GetCenterPosition(); |
| | | if (meter.Position == null) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | meter.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (meter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | meter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (meter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (meter.Position == null) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | meter.Elev = meter.Position.Z; |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | meter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | meter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(meter.DemandPattern)) |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.AppendOrUpdatePropStatus(nameof(meter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return meter; |
| | | } |
| | | |
| | | //解析流量计 |
| | | private static HStation.Model.RevitFlowmeter ParseFlowmeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var flowmeter = new Model.RevitFlowmeter(); |
| | | flowmeter.Catalog = RevitJsonCatalog.Flowmeter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | flowmeter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | flowmeter.Code = code; |
| | | if (string.IsNullOrEmpty(flowmeter.Code)) |
| | | { |
| | | flowmeter.Code = flowmeter.Id; |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | flowmeter.Name = name; |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | flowmeter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(flowmeter.ModelType)) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | flowmeter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (flowmeter.Flags == null || flowmeter.Flags.Count < 1) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | flowmeter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | flowmeter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (flowmeter.ConnectList == null || flowmeter.ConnectList.Count < 1) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | flowmeter.Quality = quality; |
| | | if (flowmeter.Quality <= 0) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | flowmeter.Position = flowmeter.ConnectList?.GetCenterPosition(); |
| | | if (flowmeter.Position == null) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | flowmeter.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (flowmeter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | flowmeter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (flowmeter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (flowmeter.Position == null) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | flowmeter.Elev = flowmeter.Position.Z; |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | flowmeter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | flowmeter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(flowmeter.DemandPattern)) |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.AppendOrUpdatePropStatus(nameof(flowmeter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return flowmeter; |
| | | } |
| | | |
| | | //解析压力表 |
| | | private static HStation.Model.RevitPressmeter ParsePressmeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var pressmeter = new Model.RevitPressmeter(); |
| | | pressmeter.Catalog = RevitJsonCatalog.Pressmeter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | pressmeter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | pressmeter.Code = code; |
| | | if (string.IsNullOrEmpty(pressmeter.Code)) |
| | | { |
| | | pressmeter.Code = pressmeter.Id; |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | pressmeter.Name = name; |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Name), ePropStatus.Error, "缺少 [名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | pressmeter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(pressmeter.ModelType)) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | pressmeter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (pressmeter.Flags == null || pressmeter.Flags.Count < 1) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | pressmeter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | pressmeter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (pressmeter.ConnectList == null || pressmeter.ConnectList.Count < 1) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | pressmeter.Quality = quality; |
| | | if (pressmeter.Quality <= 0) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | pressmeter.Position = pressmeter.ConnectList?.GetCenterPosition(); |
| | | if (pressmeter.Position == null) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | pressmeter.Elev = elev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pressmeter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | pressmeter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (pressmeter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pressmeter.Position == null) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Lack, "[标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pressmeter.Elev = pressmeter.Position.Z; |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Lack, "[标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | pressmeter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | pressmeter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(pressmeter.DemandPattern)) |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.AppendOrUpdatePropStatus(nameof(pressmeter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return pressmeter; |
| | | } |
| | | |
| | | //解析水库 |
| | | private static HStation.Model.RevitReservoir ParseReservoir(JToken jobject) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | reservoir.Code = code; |
| | | if (string.IsNullOrEmpty(reservoir.Code)) |
| | | { |
| | | reservoir.Code = reservoir.Id; |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Code), ePropStatus.Error, "缺少[编码]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | reservoir.Name = name; |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Name), ePropStatus.Error, "缺少[名称]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | reservoir.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(reservoir.ModelType)) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (reservoir.Flags == null || reservoir.Flags.Count < 1) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (reservoir.ConnectList == null || reservoir.ConnectList.Count < 1) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | reservoir.Quality = quality; |
| | | if (reservoir.Quality <= 0) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | reservoir.Position = reservoir.ConnectList?.GetCenterPosition(); |
| | | if (reservoir.Position == null) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (jobject[RevitJsonProp.PoolElev].MatchNumeric(out double poolElev)) |
| | | { |
| | | reservoir.PoolElev = poolElev / 1000f; |
| | | reservoir.PoolElev = poolElev; |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (reservoir.PoolElev <= 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | |
| | | //通过z轴自动计算 |
| | | if (reservoir.Position == null) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | reservoir.PoolElev = reservoir.Position.Z; |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Head), ePropStatus.Abnormal, "[总水头]缺少或者数据格式错误"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.Head), ePropStatus.Abnormal, "[总水头]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | reservoir.HeadPattern = headPattern; |
| | | if (string.IsNullOrEmpty(reservoir.HeadPattern)) |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.HeadPattern), ePropStatus.Lack, "[水头模式]缺省"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.HeadPattern), ePropStatus.Lack, "[水头模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | reservoir.AppendOrUpdatePropStatus(nameof(reservoir.HeadPattern), ePropStatus.Abnormal, "缺少[水头模式]"); |
| | | reservoir.UpdatePropStatus(nameof(reservoir.HeadPattern), ePropStatus.Abnormal, "缺少[水头模式]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | tank.Code = code; |
| | | if (string.IsNullOrEmpty(tank.Code)) |
| | | { |
| | | tank.Code = tank.Id; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Code), ePropStatus.Error, "缺少[编码]"); |
| | | tank.UpdatePropStatus(nameof(tank.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | tank.Name = name; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Name), ePropStatus.Error, "缺少[名称]"); |
| | | tank.UpdatePropStatus(nameof(tank.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | tank.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(tank.ModelType)) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | tank.UpdatePropStatus(nameof(tank.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (tank.Flags == null || tank.Flags.Count < 1) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | tank.UpdatePropStatus(nameof(tank.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | tank.UpdatePropStatus(nameof(tank.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (tank.ConnectList == null || tank.ConnectList.Count < 1) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | tank.UpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | tank.Quality = quality; |
| | | if (tank.Quality <= 0) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | tank.Position = tank.ConnectList?.GetCenterPosition(); |
| | | if (tank.Position == null) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | tank.UpdatePropStatus(nameof(tank.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (jobject[RevitJsonProp.PoolElev].MatchNumeric(out double poolElev)) |
| | | { |
| | | tank.PoolElev = poolElev / 1000f; |
| | | tank.PoolElev = poolElev; |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (tank.PoolElev <= 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | |
| | | //通过z轴自动计算 |
| | | if (tank.Position == null) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | tank.UpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | tank.PoolElev = tank.Position.Z; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | tank.UpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.InitLevel].MatchNumeric(out double initLevel)) |
| | | { |
| | | tank.InitLevel = initLevel; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.InitLevel), ePropStatus.Lack, "[初始水位]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.InitLevel), ePropStatus.Lack, "[初始水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.InitLevel), ePropStatus.Abnormal, "[初始水位]缺少或者数据格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.InitLevel), ePropStatus.Abnormal, "[初始水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MinLevel].MatchNumeric(out double minLevel)) |
| | | { |
| | | tank.MinLevel = minLevel; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MinLevel), ePropStatus.Lack, "[最低水位]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.MinLevel), ePropStatus.Lack, "[最低水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MinLevel), ePropStatus.Abnormal, "[最低水位]缺少或者数据格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.MinLevel), ePropStatus.Abnormal, "[最低水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MaxLevel].MatchNumeric(out double maxLevel)) |
| | | { |
| | | tank.MaxLevel = maxLevel; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MaxLevel), ePropStatus.Lack, "[最高水位]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.MaxLevel), ePropStatus.Lack, "[最高水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MaxLevel), ePropStatus.Abnormal, "[最高水位]缺少或者数据格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.MaxLevel), ePropStatus.Abnormal, "[最高水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | tank.DN = dn / 1000f; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.DN), ePropStatus.Lack, "[公称直径]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.DN), ePropStatus.Lack, "[公称直径]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.DN), ePropStatus.Abnormal, "[公称直径]缺少或者数据格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.DN), ePropStatus.Abnormal, "[公称直径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MinVol].MatchNumeric(out double minVol)) |
| | | { |
| | | tank.MinVol = minVol; |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MinVol), ePropStatus.Lack, "[最小容积]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.MinVol), ePropStatus.Lack, "[最小容积]缺省"); |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.MinVol), ePropStatus.Abnormal, "[最小容积]缺少或者数据格式错误"); |
| | | tank.UpdatePropStatus(nameof(tank.MinVol), ePropStatus.Abnormal, "[最小容积]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | tank.VolCurve = volCurve; |
| | | if (string.IsNullOrEmpty(tank.VolCurve)) |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.VolCurve), ePropStatus.Lack, "[容积曲线]缺省"); |
| | | tank.UpdatePropStatus(nameof(tank.VolCurve), ePropStatus.Lack, "[容积曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.AppendOrUpdatePropStatus(nameof(tank.VolCurve), ePropStatus.Abnormal, "缺少[容积曲线]"); |
| | | tank.UpdatePropStatus(nameof(tank.VolCurve), ePropStatus.Abnormal, "缺少[容积曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region OverFlow |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.OverFlow, out string overFlow)) |
| | | { |
| | | if (!string.IsNullOrEmpty(overFlow)) |
| | | { |
| | | if (overFlow.Contains("0") || overFlow.ToLower().Contains("false") || overFlow.Contains("是") || overFlow.Contains("允许")) |
| | | { |
| | | tank.OverFlow = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | tank.UpdatePropStatus(nameof(tank.OverFlow), ePropStatus.Error, "缺少[允许溢流]"); |
| | | } |
| | | #endregion |
| | | |
| | | return tank; |
| | |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | waterbox.Code = code; |
| | | if (string.IsNullOrEmpty(waterbox.Code)) |
| | | { |
| | | waterbox.Code = waterbox.Id; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Code), ePropStatus.Error, "缺少[编码]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | waterbox.Name = name; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Name), ePropStatus.Error, "缺少[名称]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | waterbox.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(waterbox.ModelType)) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (waterbox.Flags == null || waterbox.Flags.Count < 1) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (waterbox.ConnectList == null || waterbox.ConnectList.Count < 1) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Quality |
| | | |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | waterbox.Quality = quality; |
| | | if (waterbox.Quality <= 0) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Quality), ePropStatus.Lack, "[初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Quality), ePropStatus.Abnormal, "[初始水质]异常,可能是缺少或格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | waterbox.Position = waterbox.ConnectList?.GetCenterPosition(); |
| | | if (waterbox.Position == null) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Position), ePropStatus.Lack, "[位置]缺省,可能是受[连接列表]解析失败影响"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (jobject[RevitJsonProp.PoolElev].MatchNumeric(out double poolElev)) |
| | | { |
| | | waterbox.PoolElev = poolElev / 1000f; |
| | | waterbox.PoolElev = poolElev; |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[池底标高]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (waterbox.PoolElev <= 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | |
| | | //通过z轴自动计算 |
| | | if (waterbox.Position == null) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Lack, "[池底标高]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.PoolElev = waterbox.Position.Z; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Lack, "[池底标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.InitLevel].MatchNumeric(out double initLevel)) |
| | | { |
| | | waterbox.InitLevel = initLevel; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.InitLevel), ePropStatus.Lack, "[初始水位]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.InitLevel), ePropStatus.Lack, "[初始水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.InitLevel), ePropStatus.Abnormal, "[初始水位]缺少或者数据格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.InitLevel), ePropStatus.Abnormal, "[初始水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MinLevel].MatchNumeric(out double minLevel)) |
| | | { |
| | | waterbox.MinLevel = minLevel; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MinLevel), ePropStatus.Lack, "[最低水位]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MinLevel), ePropStatus.Lack, "[最低水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MinLevel), ePropStatus.Abnormal, "[最低水位]缺少或者数据格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MinLevel), ePropStatus.Abnormal, "[最低水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MaxLevel].MatchNumeric(out double maxLevel)) |
| | | { |
| | | waterbox.MaxLevel = maxLevel; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MaxLevel), ePropStatus.Lack, "[最高水位]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MaxLevel), ePropStatus.Lack, "[最高水位]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MaxLevel), ePropStatus.Abnormal, "[最高水位]缺少或者数据格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MaxLevel), ePropStatus.Abnormal, "[最高水位]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | waterbox.DN = dn / 1000f; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.DN), ePropStatus.Lack, "[公称直径]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.DN), ePropStatus.Lack, "[公称直径]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.DN), ePropStatus.Abnormal, "[公称直径]缺少或者数据格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.DN), ePropStatus.Abnormal, "[公称直径]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject[RevitJsonProp.MinVol].MatchNumeric(out double minVol)) |
| | | { |
| | | waterbox.MinVol = minVol; |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MinVol), ePropStatus.Lack, "[最小容积]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MinVol), ePropStatus.Lack, "[最小容积]缺省"); |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.MinVol), ePropStatus.Abnormal, "[最小容积]缺少或者数据格式错误"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.MinVol), ePropStatus.Abnormal, "[最小容积]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | waterbox.VolCurve = volCurve; |
| | | if (string.IsNullOrEmpty(waterbox.VolCurve)) |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.VolCurve), ePropStatus.Lack, "[容积曲线]缺省"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.VolCurve), ePropStatus.Lack, "[容积曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.AppendOrUpdatePropStatus(nameof(waterbox.VolCurve), ePropStatus.Abnormal, "缺少[容积曲线]"); |
| | | waterbox.UpdatePropStatus(nameof(waterbox.VolCurve), ePropStatus.Abnormal, "缺少[容积曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region OverFlow |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.OverFlow, out string overFlow)) |
| | | { |
| | | if (!string.IsNullOrEmpty(overFlow)) |
| | | { |
| | | if (overFlow.Contains("0") || overFlow.ToLower().Contains("false") || overFlow.Contains("是") || overFlow.Contains("允许")) |
| | | { |
| | | waterbox.OverFlow = true; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | waterbox.UpdatePropStatus(nameof(waterbox.OverFlow), ePropStatus.Error, "缺少[允许溢流]"); |
| | | } |
| | | #endregion |
| | | |
| | | return waterbox; |
| | | } |
| | | |
| | | //解析连接节点 |
| | | private static HStation.Model.RevitJunction ParseJunction(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var junction = new Model.RevitJunction(); |
| | | junction.Catalog = RevitJsonCatalog.Junction; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | junction.Id = id; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | junction.Name = name; |
| | | junction.UpdatePropStatus(nameof(junction.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | junction.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(junction.ModelType)) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | junction.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (junction.Flags == null || junction.Flags.Count < 1) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | junction.Description = description; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | junction.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (junction.ConnectList == null || junction.ConnectList.Count < 1) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | junction.Position = junction.ConnectList?.GetCenterPosition(); |
| | | if (junction.Position == null) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | junction.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (junction.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | junction.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (junction.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (junction.Position == null) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | junction.Elev = junction.Position.Z; |
| | | junction.UpdatePropStatus(nameof(junction.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | junction.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | junction.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(junction.DemandPattern)) |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | junction.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | junction.UpdatePropStatus(nameof(junction.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return junction; |
| | | } |
| | | |
| | | //解析闷头 |
| | | private static HStation.Model.RevitBlunthead ParseBlunthead(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var blunthead = new Model.RevitBlunthead(); |
| | | blunthead.Catalog = RevitJsonCatalog.Blunthead; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | blunthead.Id = id; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | blunthead.Name = name; |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | blunthead.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(blunthead.ModelType)) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | blunthead.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (blunthead.Flags == null || blunthead.Flags.Count < 1) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | blunthead.Description = description; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | blunthead.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (blunthead.ConnectList == null || blunthead.ConnectList.Count < 1) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | blunthead.Position = blunthead.ConnectList?.GetCenterPosition(); |
| | | if (blunthead.Position == null) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | blunthead.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (blunthead.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | blunthead.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (blunthead.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (blunthead.Position == null) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | blunthead.Elev = blunthead.Position.Z; |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | blunthead.Material = material; |
| | | if (string.IsNullOrEmpty(blunthead.Material)) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | blunthead.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | blunthead.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | blunthead.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(blunthead.DemandPattern)) |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | blunthead.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | blunthead.UpdatePropStatus(nameof(blunthead.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return blunthead; |
| | | |
| | | } |
| | | |
| | | //解析弯头 |
| | | private static HStation.Model.RevitElbow ParseElbow(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var elbow = new Model.RevitElbow(); |
| | | elbow.Catalog = RevitJsonCatalog.Elbow; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | elbow.Id = id; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | elbow.Name = name; |
| | | elbow.UpdatePropStatus(nameof(elbow.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | elbow.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(elbow.ModelType)) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | elbow.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (elbow.Flags == null || elbow.Flags.Count < 1) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | elbow.Description = description; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | elbow.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (elbow.ConnectList == null || elbow.ConnectList.Count < 1) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | elbow.Position = elbow.ConnectList?.GetCenterPosition(); |
| | | if (elbow.Position == null) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | elbow.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (elbow.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | elbow.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (elbow.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (elbow.Position == null) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | elbow.Elev = elbow.Position.Z; |
| | | elbow.UpdatePropStatus(nameof(elbow.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | elbow.Material = material; |
| | | if (string.IsNullOrEmpty(elbow.Material)) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | elbow.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | elbow.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | elbow.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(elbow.DemandPattern)) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | elbow.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region BendingAngle |
| | | |
| | | if (jobject[RevitJsonProp.BendingAngle].MatchNumeric(out double bendingAngle)) |
| | | { |
| | | elbow.BendingAngle = bendingAngle; |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.BendingAngle), ePropStatus.Abnormal, "[弯曲角度]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ElbowType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ElbowType, out string elbowType)) |
| | | { |
| | | elbow.ElbowType = elbowType; |
| | | if (string.IsNullOrEmpty(elbow.ElbowType)) |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ElbowType), ePropStatus.Lack, "[弯头类型]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | elbow.UpdatePropStatus(nameof(elbow.ElbowType), ePropStatus.Abnormal, "缺少[弯头类型]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return elbow; |
| | | } |
| | | |
| | | //解析三通 |
| | | private static HStation.Model.RevitThreelink ParseThreelink(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var threelink = new Model.RevitThreelink(); |
| | | threelink.Catalog = RevitJsonCatalog.Threelink; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | threelink.Id = id; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | threelink.Name = name; |
| | | threelink.UpdatePropStatus(nameof(threelink.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | threelink.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(threelink.ModelType)) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | threelink.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (threelink.Flags == null || threelink.Flags.Count < 1) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | threelink.Description = description; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | threelink.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (threelink.ConnectList == null || threelink.ConnectList.Count < 1) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | threelink.Position = threelink.ConnectList?.GetCenterPosition(); |
| | | if (threelink.Position == null) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | threelink.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (threelink.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | threelink.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (threelink.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (threelink.Position == null) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | threelink.Elev = threelink.Position.Z; |
| | | threelink.UpdatePropStatus(nameof(threelink.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | threelink.Material = material; |
| | | if (string.IsNullOrEmpty(threelink.Material)) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | threelink.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | threelink.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | threelink.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(threelink.DemandPattern)) |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | threelink.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RunningThroughLoss |
| | | |
| | | if (jobject[RevitJsonProp.RunningThroughLoss].MatchNumeric(out double runningThroughLoss)) |
| | | { |
| | | threelink.RunningThroughLoss = runningThroughLoss; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.RunningThroughLoss), ePropStatus.Abnormal, "[运行损失系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region BranchThroughLoss |
| | | |
| | | if (jobject[RevitJsonProp.BranchThroughLoss].MatchNumeric(out double branchThroughLoss)) |
| | | { |
| | | threelink.BranchThroughLoss = branchThroughLoss; |
| | | } |
| | | else |
| | | { |
| | | threelink.UpdatePropStatus(nameof(threelink.BranchThroughLoss), ePropStatus.Abnormal, "[支管损失系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return threelink; |
| | | } |
| | | |
| | | //解析四通 |
| | | private static HStation.Model.RevitFourlink ParseFourlink(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var fourlink = new Model.RevitFourlink(); |
| | | fourlink.Catalog = RevitJsonCatalog.Fourlink; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | fourlink.Id = id; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | fourlink.Name = name; |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | fourlink.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(fourlink.ModelType)) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | fourlink.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (fourlink.Flags == null || fourlink.Flags.Count < 1) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | fourlink.Description = description; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | fourlink.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (fourlink.ConnectList == null || fourlink.ConnectList.Count < 1) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | fourlink.Position = fourlink.ConnectList?.GetCenterPosition(); |
| | | if (fourlink.Position == null) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | fourlink.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (fourlink.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | fourlink.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (fourlink.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (fourlink.Position == null) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | fourlink.Elev = fourlink.Position.Z; |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | fourlink.Material = material; |
| | | if (string.IsNullOrEmpty(fourlink.Material)) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | fourlink.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | fourlink.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | fourlink.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(fourlink.DemandPattern)) |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | fourlink.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | fourlink.UpdatePropStatus(nameof(fourlink.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return fourlink; |
| | | } |
| | | |
| | | //解析喷头 |
| | | private static HStation.Model.RevitNozzle ParseNozzle(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var nozzle = new Model.RevitNozzle(); |
| | | nozzle.Catalog = RevitJsonCatalog.Nozzle; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | nozzle.Id = id; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | nozzle.Name = name; |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | nozzle.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(nozzle.ModelType)) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | nozzle.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (nozzle.Flags == null || nozzle.Flags.Count < 1) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | nozzle.Description = description; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | nozzle.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (nozzle.ConnectList == null || nozzle.ConnectList.Count < 1) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | nozzle.Position = nozzle.ConnectList?.GetCenterPosition(); |
| | | if (nozzle.Position == null) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | nozzle.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (nozzle.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | nozzle.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (nozzle.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (nozzle.Position == null) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | nozzle.Elev = nozzle.Position.Z; |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | nozzle.Material = material; |
| | | if (string.IsNullOrEmpty(nozzle.Material)) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | nozzle.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | nozzle.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | nozzle.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(nozzle.DemandPattern)) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | nozzle.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Coefficient |
| | | |
| | | if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) |
| | | { |
| | | nozzle.Coefficient = coeffientp; |
| | | if (nozzle.Coefficient <= 0) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[喷射系数]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Abnormal, "[喷射系数]缺少或者格式错误"); |
| | | if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) |
| | | { |
| | | nozzle.Coefficient = coeffientf; |
| | | if (nozzle.Coefficient <= 0) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[流量系数]缺省"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (nozzle.Coefficient < 1) |
| | | { |
| | | nozzle.UpdatePropStatus(nameof(nozzle.Coefficient), ePropStatus.Lack, "[喷射系数]缺省,使用默认值(163)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return nozzle; |
| | | } |
| | | |
| | | //解析消火栓 |
| | | private static HStation.Model.RevitHydrant ParseHydrant(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var hydrant = new Model.RevitHydrant(); |
| | | hydrant.Catalog = RevitJsonCatalog.Hydrant; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | hydrant.Id = id; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | hydrant.Name = name; |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | hydrant.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(hydrant.ModelType)) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | hydrant.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (hydrant.Flags == null || hydrant.Flags.Count < 1) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | hydrant.Description = description; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | hydrant.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (hydrant.ConnectList == null || hydrant.ConnectList.Count < 1) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | hydrant.Position = hydrant.ConnectList?.GetCenterPosition(); |
| | | if (hydrant.Position == null) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | hydrant.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (hydrant.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | hydrant.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (hydrant.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (hydrant.Position == null) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | hydrant.Elev = hydrant.Position.Z; |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | hydrant.Material = material; |
| | | if (string.IsNullOrEmpty(hydrant.Material)) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Caliber |
| | | |
| | | if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) |
| | | { |
| | | hydrant.Caliber = caliber; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Caliber), ePropStatus.Abnormal, "[口径信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | hydrant.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | hydrant.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(hydrant.DemandPattern)) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | hydrant.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Coefficient |
| | | |
| | | if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) |
| | | { |
| | | hydrant.Coefficient = coeffientp; |
| | | if (hydrant.Coefficient <= 0) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Lack, "[喷射系数]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Abnormal, "[喷射系数]缺少或者格式错误"); |
| | | if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) |
| | | { |
| | | hydrant.Coefficient = coeffientf; |
| | | if (hydrant.Coefficient <= 0) |
| | | { |
| | | hydrant.UpdatePropStatus(nameof(hydrant.Coefficient), ePropStatus.Lack, "[流量系数]缺省"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return hydrant; |
| | | } |
| | | |
| | | //解析水表 |
| | | private static HStation.Model.RevitMeter ParseMeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var meter = new Model.RevitMeter(); |
| | | meter.Catalog = RevitJsonCatalog.Meter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | meter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | meter.Name = name; |
| | | meter.UpdatePropStatus(nameof(meter.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | meter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(meter.ModelType)) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | meter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (meter.Flags == null || meter.Flags.Count < 1) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | meter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | meter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (meter.ConnectList == null || meter.ConnectList.Count < 1) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | meter.Position = meter.ConnectList?.GetCenterPosition(); |
| | | if (meter.Position == null) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | meter.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (meter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | meter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (meter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (meter.Position == null) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | meter.Elev = meter.Position.Z; |
| | | meter.UpdatePropStatus(nameof(meter.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | meter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | meter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(meter.DemandPattern)) |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | meter.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | meter.UpdatePropStatus(nameof(meter.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return meter; |
| | | } |
| | | |
| | | //解析流量计 |
| | | private static HStation.Model.RevitFlowmeter ParseFlowmeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var flowmeter = new Model.RevitFlowmeter(); |
| | | flowmeter.Catalog = RevitJsonCatalog.Flowmeter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | flowmeter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | flowmeter.Name = name; |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | flowmeter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(flowmeter.ModelType)) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | flowmeter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (flowmeter.Flags == null || flowmeter.Flags.Count < 1) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | flowmeter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | flowmeter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (flowmeter.ConnectList == null || flowmeter.ConnectList.Count < 1) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | flowmeter.Position = flowmeter.ConnectList?.GetCenterPosition(); |
| | | if (flowmeter.Position == null) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | flowmeter.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (flowmeter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | flowmeter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (flowmeter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (flowmeter.Position == null) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | flowmeter.Elev = flowmeter.Position.Z; |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | flowmeter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | flowmeter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(flowmeter.DemandPattern)) |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | flowmeter.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurrentFlow |
| | | |
| | | if (jobject[RevitJsonProp.CurrentFlow].MatchNumeric(out double currentFlow)) |
| | | { |
| | | flowmeter.CurrentFlow = currentFlow; |
| | | } |
| | | else |
| | | { |
| | | flowmeter.UpdatePropStatus(nameof(flowmeter.CurrentFlow), ePropStatus.Abnormal, "[流量信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return flowmeter; |
| | | } |
| | | |
| | | //解析压力表 |
| | | private static HStation.Model.RevitPressmeter ParsePressmeter(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | |
| | | var pressmeter = new Model.RevitPressmeter(); |
| | | pressmeter.Catalog = RevitJsonCatalog.Pressmeter; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | pressmeter.Id = id; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | pressmeter.Name = name; |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Name), ePropStatus.Error, "缺少 [构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | pressmeter.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(pressmeter.ModelType)) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | pressmeter.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (pressmeter.Flags == null || pressmeter.Flags.Count < 1) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | pressmeter.Description = description; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | pressmeter.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (pressmeter.ConnectList == null || pressmeter.ConnectList.Count < 1) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Position |
| | | |
| | | pressmeter.Position = pressmeter.ConnectList?.GetCenterPosition(); |
| | | if (pressmeter.Position == null) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Position), ePropStatus.Lack, "[位置信息]缺省,可能是受[连接列表]解析失败影响"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | pressmeter.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pressmeter.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | pressmeter.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (pressmeter.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pressmeter.Position == null) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pressmeter.Elev = pressmeter.Position.Z; |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Demand |
| | | |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | pressmeter.Demand = demand; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.Demand), ePropStatus.Abnormal, "[需水量]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region DemandPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) |
| | | { |
| | | pressmeter.DemandPattern = demandPattern; |
| | | if (string.IsNullOrEmpty(pressmeter.DemandPattern)) |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.DemandPattern), ePropStatus.Lack, "[需水模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.DemandPattern), ePropStatus.Abnormal, "缺少[需水模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | pressmeter.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurrentPress |
| | | |
| | | if (jobject[RevitJsonProp.CurrentPress].MatchNumeric(out double currentPress)) |
| | | { |
| | | pressmeter.CurrentPress = currentPress; |
| | | } |
| | | else |
| | | { |
| | | pressmeter.UpdatePropStatus(nameof(pressmeter.CurrentPress), ePropStatus.Abnormal, "[压力信息]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return pressmeter; |
| | | } |
| | | |
| | | //解析管道 |
| | |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | pipe.Code = code; |
| | | if (string.IsNullOrEmpty(pipe.Code)) |
| | | { |
| | | pipe.Code = pipe.Id; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Code), ePropStatus.Error, "缺少[编码]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | pipe.Name = name; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Name), ePropStatus.Error, "缺少[名称]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | pipe.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(pipe.ModelType)) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | pipe.UpdatePropStatus(nameof(pipe.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (pipe.Flags == null || pipe.Flags.Count < 1) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (pipe.ConnectList == null || pipe.ConnectList.Count < 1) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | pipe.UpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | pipe.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(pipe.StartCode)) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pipe.StartPosition = startConnect?.Position; |
| | | if (pipe.StartPosition == null) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | pipe.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(pipe.EndCode)) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pipe.EndPosition = endConnect?.Position; |
| | | if (pipe.EndPosition == null) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (string.IsNullOrEmpty(pipe.LinkStatus)) |
| | | { |
| | | pipe.LinkStatus = PipeStatus.Open; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Lack, "[管道状态]缺省"); |
| | | pipe.UpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Lack, "[管道状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PipeStatus.Contains(pipe.LinkStatus)) |
| | | { |
| | | pipe.LinkStatus = PipeStatus.Open; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Abnormal, "[管道状态]设置错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Abnormal, "[管道状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.LinkStatus = PipeStatus.Open; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Abnormal, "[管道状态]缺少或格式错误,使用默认值(Open)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | { |
| | | pipe.StartElev = startElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartElev), ePropStatus.Abnormal, "[上游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (pipe.StartElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pipe.StartPosition == null) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartElev), ePropStatus.Lack, "[上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pipe.StartElev = pipe.StartPosition.Z; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartElev), ePropStatus.Lack, "[上游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | pipe.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndElev), ePropStatus.Abnormal, "[下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (pipe.EndElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pipe.EndPosition == null) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndElev), ePropStatus.Lack, "[下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pipe.EndElev = pipe.EndPosition.Z; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndElev), ePropStatus.Lack, "[下游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | pipe.StartQuality = startQuality; |
| | | if (pipe.StartQuality <= 0) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartQuality), ePropStatus.Lack, "[上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.StartQuality), ePropStatus.Abnormal, "[上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | pipe.EndQuality = endQuality; |
| | | if (pipe.EndQuality <= 0) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndQuality), ePropStatus.Lack, "[下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.EndQuality), ePropStatus.Abnormal, "[下游初始水质]缺少或者格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.LinkStatus), ePropStatus.Abnormal, "[管道状态]缺少或格式错误,使用默认值(Open)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | pipe.Material = material; |
| | | if (string.IsNullOrEmpty(pipe.Material)) |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径]缺少或者格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pipe.Diameter < 1) |
| | |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | pipe.Diameter = internalDiameter; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径]通过[内径]进行修复]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径信息]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径]无法通过[内径]进行修复]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | pipe.Diameter = dn; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径]通过[公称直径]进行修复]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径信息]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径]无法通过[公称直径]进行修复]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (pipe.Diameter < 1) |
| | | { |
| | | pipe.Diameter = 500; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径][内径]解析错误,使用默认值(500mm)修正]"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[直径信息][内径]解析错误,使用默认值(500mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (jobject[RevitJsonProp.Length].MatchNumeric(out double length)) |
| | | { |
| | | pipe.Length = length / 1000f; |
| | | pipe.Length = length; |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Length), ePropStatus.Abnormal, "[长度]缺少或者格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Length), ePropStatus.Abnormal, "[长度信息]缺少或者格式错误"); |
| | | } |
| | | if (pipe.Length <= 0) |
| | | { |
| | | if (pipe.StartPosition != null && pipe.EndPosition != null) |
| | | { |
| | | pipe.Length = pipe.StartPosition.Distance(pipe.EndPosition); |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Length), ePropStatus.Lack, "[长度]缺省,通过位置自动计算"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Length), ePropStatus.Lack, "[长度信息]缺省,通过位置信息自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Length), ePropStatus.Abnormal, "[长度]受[连接列表]影响无法自动计算"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Length), ePropStatus.Abnormal, "[长度信息]受[连接列表]影响无法自动计算"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Roughness), ePropStatus.Abnormal, "[粗糙系数]缺少或者数据格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Roughness), ePropStatus.Abnormal, "[粗糙系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | if (pipe.Roughness < 0.1) |
| | | { |
| | | pipe.Roughness = 110; |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.Roughness), ePropStatus.Lack, "[粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | pipe.UpdatePropStatus(nameof(pipe.Roughness), ePropStatus.Lack, "[粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | pipe.AppendOrUpdatePropStatus(nameof(pipe.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | pipe.UpdatePropStatus(nameof(pipe.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | translation.Code = code; |
| | | if (string.IsNullOrEmpty(translation.Code)) |
| | | { |
| | | translation.Code = translation.Id; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Code), ePropStatus.Error, "缺少[编码]"); |
| | | translation.UpdatePropStatus(nameof(translation.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | translation.Name = name; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | translation.UpdatePropStatus(nameof(translation.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Name), ePropStatus.Error, "缺少[名称]"); |
| | | translation.UpdatePropStatus(nameof(translation.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | translation.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(translation.ModelType)) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | translation.UpdatePropStatus(nameof(translation.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | translation.UpdatePropStatus(nameof(translation.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (translation.Flags == null || translation.Flags.Count < 1) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | translation.UpdatePropStatus(nameof(translation.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | translation.UpdatePropStatus(nameof(translation.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (translation.ConnectList == null || translation.ConnectList.Count < 1) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | translation.UpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | translation.UpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | translation.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(translation.StartCode)) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | translation.UpdatePropStatus(nameof(translation.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | translation.StartPosition = startConnect?.Position; |
| | | if (translation.StartPosition == null) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | translation.UpdatePropStatus(nameof(translation.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | translation.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(translation.EndCode)) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | translation.UpdatePropStatus(nameof(translation.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | translation.EndPosition = endConnect?.Position; |
| | | if (translation.EndPosition == null) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | translation.UpdatePropStatus(nameof(translation.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusPipe, out string linkStatus)) |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatus, out string linkStatus)) |
| | | { |
| | | translation.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(translation.LinkStatus)) |
| | | { |
| | | translation.LinkStatus = PipeStatus.Open; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Lack, "[管道状态]缺省"); |
| | | translation.UpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Lack, "[管段状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PipeStatus.Contains(translation.LinkStatus)) |
| | | { |
| | | translation.LinkStatus = PipeStatus.Open; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Abnormal, "[管道状态]设置错误"); |
| | | translation.UpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Abnormal, "[管段状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.LinkStatus = PipeStatus.Open; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Abnormal, "[管道状态]缺少或格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.LinkStatus), ePropStatus.Abnormal, "[管段状态]缺少或格式错误,使用默认值(Open)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | translation.StartElev = startElev / 1000f; |
| | | translation.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartElev), ePropStatus.Abnormal, "[上游标高]缺少或格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (translation.StartElev <= 0) |
| | | if (translation.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (translation.StartPosition == null) |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartElev), ePropStatus.Lack, "[上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | translation.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | translation.StartElev = translation.StartPosition.Z; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartElev), ePropStatus.Lack, "[上游标高]缺省,通过Z轴自动计算"); |
| | | translation.UpdatePropStatus(nameof(translation.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | translation.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndElev), ePropStatus.Abnormal, "[下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (translation.EndElev <= 0) |
| | | if (translation.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (translation.EndPosition == null) |
| | | if (translation.StartPosition == null || translation.EndPosition == null) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndElev), ePropStatus.Lack, "[下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | translation.UpdatePropStatus(nameof(translation.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置信息]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | translation.EndElev = translation.EndPosition.Z; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndElev), ePropStatus.Lack, "[下游标高]缺省,通过Z轴自动计算"); |
| | | var center = translation.ConnectList?.GetCenterPosition(); |
| | | if (center != null) |
| | | { |
| | | translation.Elev = center.Z; |
| | | translation.UpdatePropStatus(nameof(translation.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | translation.StartQuality = startQuality; |
| | | if (translation.StartQuality <= 0) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartQuality), ePropStatus.Lack, "[上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.StartQuality), ePropStatus.Abnormal, "[上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | translation.EndQuality = endQuality; |
| | | if (translation.EndQuality <= 0) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndQuality), ePropStatus.Lack, "[下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.EndQuality), ePropStatus.Abnormal, "[下游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | translation.Material = material; |
| | | if (string.IsNullOrEmpty(translation.Material)) |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Material), ePropStatus.Lack, "[材质]缺省"); |
| | | translation.UpdatePropStatus(nameof(translation.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Material), ePropStatus.Abnormal, "缺少[材质]"); |
| | | translation.UpdatePropStatus(nameof(translation.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径]缺少或者格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (translation.Diameter < 1) |
| | |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | translation.Diameter = internalDiameter; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径]通过[内径]进行修复]"); |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径信息]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径]无法通过[内径]进行修复]"); |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | translation.Diameter = dn; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径]通过[公称直径]进行修复]"); |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径信息]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径]无法通过[公称直径]进行修复]"); |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (translation.Diameter < 1) |
| | | { |
| | | translation.Diameter = 150; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径][内径]解析错误,使用默认值(500mm)修正]"); |
| | | translation.Diameter = 500; |
| | | translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[直径信息][内径]解析错误,使用默认值(500mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | |
| | | if (jobject[RevitJsonProp.Length].MatchNumeric(out double length)) |
| | | { |
| | | translation.Length = length / 1000f; |
| | | translation.Length = length; |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Length), ePropStatus.Abnormal, "[长度]缺少或者格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.Length), ePropStatus.Abnormal, "[长度信息]缺少或者格式错误"); |
| | | } |
| | | if (translation.Length <= 0) |
| | | { |
| | | if (translation.StartPosition != null && translation.EndPosition != null) |
| | | { |
| | | translation.Length = translation.StartPosition.Distance(translation.EndPosition); |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Length), ePropStatus.Lack, "[长度]缺省,通过位置自动计算"); |
| | | translation.UpdatePropStatus(nameof(translation.Length), ePropStatus.Lack, "[长度信息]缺省,通过位置信息自动计算"); |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Length), ePropStatus.Abnormal, "[长度]受[连接列表]影响无法自动计算"); |
| | | translation.UpdatePropStatus(nameof(translation.Length), ePropStatus.Abnormal, "[长度信息]受[连接列表]影响无法自动计算"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Roughness), ePropStatus.Abnormal, "[粗糙系数]缺少或者数据格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.Roughness), ePropStatus.Abnormal, "[粗糙系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | if (translation.Roughness < 0.1) |
| | | { |
| | | translation.Roughness = 110; |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.Roughness), ePropStatus.Lack, "[粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | translation.UpdatePropStatus(nameof(translation.Roughness), ePropStatus.Lack, "[粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | translation.AppendOrUpdatePropStatus(nameof(translation.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | translation.UpdatePropStatus(nameof(translation.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return translation; |
| | | } |
| | | |
| | | //解析水泵 |
| | | private static HStation.Model.RevitPump ParsePump(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | var pump = new Model.RevitPump(); |
| | | pump.Catalog = RevitJsonCatalog.Pump; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | pump.Id = id; |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | pump.Name = name; |
| | | pump.UpdatePropStatus(nameof(pump.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | pump.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(pump.ModelType)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | pump.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (pump.Flags == null || pump.Flags.Count < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | pump.Description = description; |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | pump.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (pump.ConnectList == null || pump.ConnectList.Count < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartCode/StartPosition |
| | | |
| | | var startConnect = pump.ConnectList?.GetStartConnect(); |
| | | pump.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(pump.StartCode)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pump.StartPosition = startConnect?.Position; |
| | | if (pump.StartPosition == null) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndCode/EndPosition |
| | | |
| | | var endConnect = pump.ConnectList?.GetEndConnect(); |
| | | pump.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(pump.EndCode)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pump.EndPosition = endConnect?.Position; |
| | | if (pump.EndPosition == null) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusPump, out string linkStatus)) |
| | | { |
| | | pump.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(pump.LinkStatus)) |
| | | { |
| | | pump.LinkStatus = PumpStatus.Open; |
| | | pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Lack, "[水泵状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PumpStatus.Contains(pump.LinkStatus)) |
| | | { |
| | | pump.LinkStatus = PipeStatus.Open; |
| | | pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[水泵状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.LinkStatus = PipeStatus.Open; |
| | | pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[水泵状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | pump.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pump.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | pump.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (pump.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pump.StartPosition == null || pump.EndPosition == null) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置信息]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | var center = pump.ConnectList?.GetCenterPosition(); |
| | | if (center != null) |
| | | { |
| | | pump.Elev = center.Z; |
| | | pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedQ |
| | | |
| | | if (jobject[RevitJsonProp.RatedQ].MatchNumeric(out double ratedQ)) |
| | | { |
| | | pump.RatedQ = ratedQ; |
| | | if (pump.RatedQ < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Lack, "[额定流量]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Abnormal, "[额定流量]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedH |
| | | |
| | | if (jobject[RevitJsonProp.RatedH].MatchNumeric(out double ratedH)) |
| | | { |
| | | pump.RatedH = ratedH; |
| | | if (pump.RatedH < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedH), ePropStatus.Lack, "[额定扬程]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedH), ePropStatus.Abnormal, "[额定扬程]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedP |
| | | |
| | | if (jobject[RevitJsonProp.RatedP].MatchNumeric(out double ratedP)) |
| | | { |
| | | pump.RatedP = ratedP; |
| | | if (pump.RatedP < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedP), ePropStatus.Lack, "[额定功率]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedP), ePropStatus.Abnormal, "[额定功率]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedN |
| | | |
| | | if (jobject[RevitJsonProp.RatedN].MatchNumeric(out double ratedN)) |
| | | { |
| | | pump.RatedN = ratedN; |
| | | if (pump.RatedN < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedN), ePropStatus.Lack, "[额定转速]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedN), ePropStatus.Abnormal, "[额定转速]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedHz |
| | | |
| | | if (jobject[RevitJsonProp.RatedHz].MatchNumeric(out double ratedHz)) |
| | | { |
| | | pump.RatedHz = ratedHz; |
| | | if (pump.RatedHz < 1) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[额定频率]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Abnormal, "[额定频率]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pump.RatedHz < 1) |
| | | { |
| | | pump.RatedHz = 50; |
| | | pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[额定频率]缺省,使用默认值(50Hz)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQH |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQH, out string curveqh)) |
| | | { |
| | | pump.CurveQH = curveqh; |
| | | if (string.IsNullOrEmpty(pump.CurveQH)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[流量扬程曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Abnormal, "缺少[流量扬程曲线]"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(pump.CurveQH)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[流量扬程曲线]缺省,使用默认值(PumpDefault)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQP |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQP, out string curveqp)) |
| | | { |
| | | pump.CurveQP = curveqp; |
| | | if (string.IsNullOrEmpty(pump.CurveQP)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Lack, "[流量功率曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Abnormal, "缺少[流量功率曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQE |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQE, out string curveqe)) |
| | | { |
| | | pump.CurveQE = curveqe; |
| | | if (string.IsNullOrEmpty(pump.CurveQE)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Lack, "[流量效率曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Abnormal, "缺少[流量效率曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region SpeedRatio |
| | | |
| | | if (jobject[RevitJsonProp.SpeedRatio].MatchNumeric(out double speedRatio)) |
| | | { |
| | | pump.SpeedRatio = speedRatio; |
| | | } |
| | | else |
| | | { |
| | | pump.SpeedRatio = 1; |
| | | pump.UpdatePropStatus(nameof(pump.SpeedRatio), ePropStatus.Abnormal, "[转速比]缺省,使用默认值(1)修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region SpeedRatioPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.SpeedRatioPattern, out string speedRatioPattern)) |
| | | { |
| | | pump.SpeedRatioPattern = speedRatioPattern; |
| | | if (string.IsNullOrEmpty(pump.SpeedRatioPattern)) |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Lack, "[转速比模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.UpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Abnormal, "缺少[转速比模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return pump; |
| | | } |
| | | |
| | | //解析阀门 |
| | | private static HStation.Model.RevitValve ParseValve(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | var valve = new Model.RevitValve(); |
| | | valve.Catalog = RevitJsonCatalog.Valve; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | valve.Id = id; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | valve.Name = name; |
| | | valve.UpdatePropStatus(nameof(valve.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | valve.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(valve.ModelType)) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | valve.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (valve.Flags == null || valve.Flags.Count < 1) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | valve.Description = description; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | valve.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (valve.ConnectList == null || valve.ConnectList.Count < 1) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartCode/StartPosition |
| | | |
| | | var startConnect = valve.ConnectList?.GetStartConnect(); |
| | | valve.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(valve.StartCode)) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | valve.StartPosition = startConnect?.Position; |
| | | if (valve.StartPosition == null) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndCode/EndPosition |
| | | |
| | | var endConnect = valve.ConnectList?.GetEndConnect(); |
| | | valve.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(valve.EndCode)) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | valve.EndPosition = endConnect?.Position; |
| | | if (valve.EndPosition == null) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | valve.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (valve.Elev <= 0) |
| | | { |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | valve.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | if (valve.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (valve.StartPosition == null || valve.EndPosition == null) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置信息]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | var center = valve.ConnectList?.GetCenterPosition(); |
| | | if (center != null) |
| | | { |
| | | valve.Elev = center.Z; |
| | | valve.UpdatePropStatus(nameof(valve.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusValve, out string linkStatus)) |
| | | { |
| | | valve.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(valve.LinkStatus)) |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Lack, "[阀门状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!ValveStatus.Contains(valve.LinkStatus)) |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[阀门状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[阀门状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Material |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Material, out string material)) |
| | | { |
| | | valve.Material = material; |
| | | if (string.IsNullOrEmpty(valve.Material)) |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Diameter |
| | | |
| | | if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) |
| | | { |
| | | valve.Diameter = diameter; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | valve.Diameter = internalDiameter; |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径信息]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | valve.Diameter = dn; |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径信息]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | valve.Diameter = 500; |
| | | valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径信息][内径]解析错误,使用默认值(500mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | valve.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Roughness |
| | | |
| | | if (jobject[RevitJsonProp.Roughness].MatchNumeric(out double roughness)) |
| | | { |
| | | valve.Roughness = roughness; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.Roughness), ePropStatus.Abnormal, "[粗糙系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | if (valve.Roughness < 0.1) |
| | | { |
| | | valve.Roughness = 110; |
| | | valve.UpdatePropStatus(nameof(valve.Roughness), ePropStatus.Lack, "[粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ValveType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ValveType, out string valveType)) |
| | | { |
| | | valve.ValveType = valveType; |
| | | if (string.IsNullOrEmpty(valve.ValveType)) |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.UpdatePropStatus(nameof(valve.ValveType), ePropStatus.Lack, "[阀门类型]缺省,使用默认值(GPV)进行修正"); |
| | | } |
| | | else |
| | | { |
| | | if (!ValveType.Contains(valve.ValveType)) |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.UpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[阀门类型]设置错误,使用默认值(GPV)进行修正"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.UpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[阀门类型]缺少或格式错误,使用默认值(GPV)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region OpeningDegree |
| | | |
| | | if (jobject[RevitJsonProp.ValveOpeningDegree].MatchNumeric(out double openingDegree)) |
| | | { |
| | | valve.OpeningDegree = openingDegree; |
| | | } |
| | | else |
| | | { |
| | | valve.OpeningDegree = 100; |
| | | valve.UpdatePropStatus(nameof(valve.OpeningDegree), ePropStatus.Abnormal, "[阀门开度]缺少或者数据格式错误,使用默认值(100)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ValveSetting |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ValveSetting, out string valveSetting)) |
| | | { |
| | | valve.ValveSetting = valveSetting; |
| | | } |
| | | else |
| | | { |
| | | valve.UpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Abnormal, "[阀门设置]缺少或格式错误"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(valve.ValveSetting)) |
| | | { |
| | | if (valve.ValveType == ValveType.GPV) |
| | | { |
| | | valve.ValveSetting = "GPVDefault"; |
| | | valve.UpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Lack, "[阀门设置]缺省,使用默认值(GPVDefault)进行修正"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return valve; |
| | | } |
| | | |
| | | //解析换热器 |
| | |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Id), ePropStatus.Error, "[换热器]缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | exchanger.Code = code; |
| | | if (string.IsNullOrEmpty(exchanger.Code)) |
| | | { |
| | | exchanger.Code = exchanger.Id; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Code), ePropStatus.Lack, "[换热器][编码]缺省,使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Code), ePropStatus.Error, "[换热器]缺少[编码]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | exchanger.Name = name; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Name), ePropStatus.Lack, "[换热器][名称]缺省"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Name), ePropStatus.Error, "[换热器]缺少[名称]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | exchanger.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(exchanger.ModelType)) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Lack, "[换热器][型号信息]缺省"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Error, "[换热器]缺少[型号信息]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (exchanger.Flags == null || exchanger.Flags.Count < 1) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Abnormal, "[换热器][标签]格式错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "[换热器]缺少[标签]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Description), ePropStatus.Error, "[换热器]缺少[说明信息]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (exchanger.ConnectList == null || exchanger.ConnectList.Count < 1) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[换热器][连接列表]解析失败"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[换热器]缺少[连接列表]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | exchanger.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(exchanger.StartCode)) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartCode), ePropStatus.Error, "[换热器][上游构件]受[连接列表]影响解析错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | exchanger.StartPosition = startConnect?.Position; |
| | | if (exchanger.StartPosition == null) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartPosition), ePropStatus.Error, "[换热器][上游构件位置]受[连接列表]影响解析错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | exchanger.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(exchanger.EndCode)) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndCode), ePropStatus.Error, "[换热器][下游构件]受[连接列表]影响解析错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | exchanger.EndPosition = endConnect?.Position; |
| | | if (exchanger.EndPosition == null) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndPosition), ePropStatus.Error, "[换热器][下游构件位置]受[连接列表]影响解析错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusPipe, out string linkStatus)) |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusSwitch, out string linkStatus)) |
| | | { |
| | | exchanger.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(exchanger.LinkStatus)) |
| | | { |
| | | exchanger.LinkStatus = PipeStatus.Open; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Lack, "[换热器][管道状态]缺省"); |
| | | exchanger.LinkStatus = ValveStatus.Open; |
| | | exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Lack, "[开关状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PipeStatus.Contains(exchanger.LinkStatus)) |
| | | if (!ValveStatus.Contains(exchanger.LinkStatus)) |
| | | { |
| | | exchanger.LinkStatus = PipeStatus.Open; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[换热器][管道状态]设置错误"); |
| | | exchanger.LinkStatus = ValveStatus.Open; |
| | | exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[开关状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.LinkStatus = PipeStatus.Open; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[换热器][管道状态]缺少或格式错误"); |
| | | exchanger.LinkStatus = ValveStatus.Open; |
| | | exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[开关状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | exchanger.StartElev = startElev / 1000f; |
| | | exchanger.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Abnormal, "[换热器][上游标高]缺少或格式错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (exchanger.StartElev <= 0) |
| | | if (exchanger.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (exchanger.StartPosition == null) |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Lack, "[换热器][上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | exchanger.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | exchanger.StartElev = exchanger.StartPosition.Z; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Lack, "[换热器][上游标高]缺省,通过Z轴自动计算"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | exchanger.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndElev), ePropStatus.Abnormal, "[换热器][下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (exchanger.EndElev <= 0) |
| | | if (exchanger.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (exchanger.EndPosition == null) |
| | | if (exchanger.StartPosition == null || exchanger.EndPosition == null) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndElev), ePropStatus.Lack, "[换热器][下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置信息]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | exchanger.EndElev = exchanger.EndPosition.Z; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndElev), ePropStatus.Lack, "[换热器][下游标高]缺省,通过Z轴自动计算"); |
| | | var center = exchanger.ConnectList?.GetCenterPosition(); |
| | | if (center != null) |
| | | { |
| | | exchanger.Elev = center.Z; |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | exchanger.StartQuality = startQuality; |
| | | if (exchanger.StartQuality <= 0) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartQuality), ePropStatus.Lack, "[换热器][上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartQuality), ePropStatus.Abnormal, "[换热器][上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | exchanger.EndQuality = endQuality; |
| | | if (exchanger.EndQuality <= 0) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndQuality), ePropStatus.Lack, "[换热器][下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndQuality), ePropStatus.Abnormal, "[换热器][下游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | exchanger.Material = material; |
| | | if (string.IsNullOrEmpty(exchanger.Material)) |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Material), ePropStatus.Lack, "[换热器][材质]缺省"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Material), ePropStatus.Abnormal, "[换热器]缺少[材质]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[换热器][直径]缺少或者格式错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[直径信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (exchanger.Diameter < 1) |
| | |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | exchanger.Diameter = internalDiameter; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[换热器][直径]通过[内径]进行修复]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[直径信息]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[换热器][直径]无法通过[内径]进行修复]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | exchanger.Diameter = dn; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[换热器][直径]通过[公称直径]进行修复]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[直径信息]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[换热器][直径]无法通过[公称直径]进行修复]"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (exchanger.Diameter < 1) |
| | | { |
| | | exchanger.Diameter = 1000; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[换热器][直径][内径]解析错误,使用默认值(1000mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Length |
| | | |
| | | if (jobject[RevitJsonProp.Length].MatchNumeric(out double length)) |
| | | { |
| | | exchanger.Length = length / 1000f; |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Length), ePropStatus.Abnormal, "[换热器][长度]缺少或者格式错误"); |
| | | } |
| | | if (exchanger.Length <= 0) |
| | | { |
| | | if (exchanger.StartPosition != null && exchanger.EndPosition != null) |
| | | { |
| | | exchanger.Length = exchanger.StartPosition.Distance(exchanger.EndPosition); |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Length), ePropStatus.Lack, "[换热器][长度]缺省,通过位置自动计算"); |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Length), ePropStatus.Abnormal, "[换热器][长度]受[连接列表]影响无法自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Roughness |
| | | |
| | | if (jobject[RevitJsonProp.Roughness].MatchNumeric(out double roughness)) |
| | | { |
| | | exchanger.Roughness = roughness; |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Roughness), ePropStatus.Abnormal, "[换热器][粗糙系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | if (exchanger.Roughness < 0.1) |
| | | { |
| | | exchanger.Roughness = 110; |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Roughness), ePropStatus.Lack, "[换热器][粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[直径信息][内径]解析错误,使用默认值(1000mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.MinorLoss), ePropStatus.Abnormal, "[换热器][局部阻力系数]缺少或者数据格式错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLossK |
| | | #region CurveQL |
| | | |
| | | if (jobject[RevitJsonProp.MinorLossK].MatchNumeric(out double minorLossK)) |
| | | if (jobject.ParseString(RevitJsonProp.CurveQL, out string curveql)) |
| | | { |
| | | exchanger.MinorLossK = minorLossK; |
| | | exchanger.CurveQL = curveql; |
| | | if (string.IsNullOrEmpty(exchanger.CurveQL)) |
| | | { |
| | | exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Lack, "[水头损失曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | exchanger.AppendOrUpdatePropStatus(nameof(exchanger.MinorLossK), ePropStatus.Abnormal, "[换热器][损失K系数]缺少或者数据格式错误"); |
| | | exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Abnormal, "缺少[水头损失曲线]"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(exchanger.CurveQL)) |
| | | { |
| | | exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Lack, "[水头损失曲线]缺省,期待产品匹配时修复"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Id), ePropStatus.Error, "[空压机]缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | compressor.Code = code; |
| | | if (string.IsNullOrEmpty(compressor.Code)) |
| | | { |
| | | compressor.Code = compressor.Id; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Code), ePropStatus.Lack, "[空压机][编码]缺省,使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Code), ePropStatus.Error, "[空压机]缺少[编码]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | compressor.Name = name; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Name), ePropStatus.Lack, "[空压机][名称]缺省"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Name), ePropStatus.Lack, "[构件名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Name), ePropStatus.Error, "[空压机]缺少[名称]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Name), ePropStatus.Error, "缺少[构件名称]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | compressor.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(compressor.ModelType)) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Lack, "[空压机][型号信息]缺省"); |
| | | compressor.UpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Error, "[空压机]缺少[型号信息]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | if (compressor.Flags == null || compressor.Flags.Count < 1) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Flags), ePropStatus.Abnormal, "[空压机][标签]格式错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Abnormal, "[标签信息]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "[空压机]缺少[标签]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "缺少[标签信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Description), ePropStatus.Error, "[空压机]缺少[说明信息]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | }).ToList(); |
| | | if (compressor.ConnectList == null || compressor.ConnectList.Count < 1) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[空压机][连接列表]解析失败"); |
| | | compressor.UpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[空压机]缺少[连接列表]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | compressor.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(compressor.StartCode)) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartCode), ePropStatus.Error, "[空压机][上游构件]受[连接列表]影响解析错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | compressor.StartPosition = startConnect?.Position; |
| | | if (compressor.StartPosition == null) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartPosition), ePropStatus.Error, "[空压机][上游构件位置]受[连接列表]影响解析错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | compressor.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(compressor.EndCode)) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndCode), ePropStatus.Error, "[空压机][下游构件]受[连接列表]影响解析错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | compressor.EndPosition = endConnect?.Position; |
| | | if (compressor.EndPosition == null) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndPosition), ePropStatus.Error, "[空压机][下游构件位置]受[连接列表]影响解析错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusPipe, out string linkStatus)) |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusSwitch, out string linkStatus)) |
| | | { |
| | | compressor.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(compressor.LinkStatus)) |
| | | { |
| | | compressor.LinkStatus = PipeStatus.Open; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Lack, "[空压机][管道状态]缺省"); |
| | | compressor.LinkStatus = ValveStatus.Open; |
| | | compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Lack, "[开关状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PipeStatus.Contains(compressor.LinkStatus)) |
| | | if (!ValveStatus.Contains(compressor.LinkStatus)) |
| | | { |
| | | compressor.LinkStatus = PipeStatus.Open; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[空压机][管道状态]设置错误"); |
| | | compressor.LinkStatus = ValveStatus.Open; |
| | | compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[开关状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.LinkStatus = PipeStatus.Open; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[空压机][管道状态]缺少或格式错误"); |
| | | compressor.LinkStatus = ValveStatus.Open; |
| | | compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[开关状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | #region Elev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | compressor.StartElev = startElev / 1000f; |
| | | compressor.Elev = elev; |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Abnormal, "[空压机][上游标高]缺少或格式错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Abnormal, "[标高信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (compressor.StartElev <= 0) |
| | | if (compressor.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (compressor.StartPosition == null) |
| | | if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Lack, "[空压机][上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | compressor.Elev = elevOfElevation / 1000f; |
| | | } |
| | | else |
| | | { |
| | | compressor.StartElev = compressor.StartPosition.Z; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Lack, "[空压机][上游标高]缺省,通过Z轴自动计算"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Abnormal, "[标高中的高程]缺少或者格式错误"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | compressor.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndElev), ePropStatus.Abnormal, "[空压机][下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (compressor.EndElev <= 0) |
| | | if (compressor.Elev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (compressor.EndPosition == null) |
| | | if (compressor.StartPosition == null || compressor.EndPosition == null) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndElev), ePropStatus.Lack, "[空压机][下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Lack, "[标高信息]缺省,受[位置信息]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | compressor.EndElev = compressor.EndPosition.Z; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndElev), ePropStatus.Lack, "[空压机][下游标高]缺省,通过Z轴自动计算"); |
| | | var center = compressor.ConnectList?.GetCenterPosition(); |
| | | if (center != null) |
| | | { |
| | | compressor.Elev = center.Z; |
| | | compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Lack, "[标高信息]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | compressor.StartQuality = startQuality; |
| | | if (compressor.StartQuality <= 0) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartQuality), ePropStatus.Lack, "[空压机][上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.StartQuality), ePropStatus.Abnormal, "[空压机][上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | compressor.EndQuality = endQuality; |
| | | if (compressor.EndQuality <= 0) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndQuality), ePropStatus.Lack, "[空压机][下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.EndQuality), ePropStatus.Abnormal, "[空压机][下游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | compressor.Material = material; |
| | | if (string.IsNullOrEmpty(compressor.Material)) |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Material), ePropStatus.Lack, "[空压机][材质]缺省"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Material), ePropStatus.Lack, "[材质信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Material), ePropStatus.Abnormal, "[空压机]缺少[材质]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Material), ePropStatus.Abnormal, "缺少[材质信息]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[空压机][直径]缺少或者格式错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[直径信息]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (compressor.Diameter < 1) |
| | |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | compressor.Diameter = internalDiameter; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[空压机][直径]通过[内径]进行修复]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[直径信息]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[空压机][直径]无法通过[内径]进行修复]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | compressor.Diameter = dn; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[空压机][直径]通过[公称直径]进行修复]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[直径信息]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[空压机][直径]无法通过[公称直径]进行修复]"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[直径信息]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (compressor.Diameter < 1) |
| | | { |
| | | compressor.Diameter = 1000; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[空压机][直径][内径]解析错误,使用默认值(1000mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Length |
| | | |
| | | if (jobject[RevitJsonProp.Length].MatchNumeric(out double length)) |
| | | { |
| | | compressor.Length = length / 1000f; |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Length), ePropStatus.Abnormal, "[空压机][长度]缺少或者格式错误"); |
| | | } |
| | | if (compressor.Length <= 0) |
| | | { |
| | | if (compressor.StartPosition != null && compressor.EndPosition != null) |
| | | { |
| | | compressor.Length = compressor.StartPosition.Distance(compressor.EndPosition); |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Length), ePropStatus.Lack, "[空压机][长度]缺省,通过位置自动计算"); |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Length), ePropStatus.Abnormal, "[空压机][长度]受[连接列表]影响无法自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Roughness |
| | | |
| | | if (jobject[RevitJsonProp.Roughness].MatchNumeric(out double roughness)) |
| | | { |
| | | compressor.Roughness = roughness; |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Roughness), ePropStatus.Abnormal, "[空压机][粗糙系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | if (compressor.Roughness < 0.1) |
| | | { |
| | | compressor.Roughness = 110; |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.Roughness), ePropStatus.Lack, "[空压机][粗糙系数]解析错误,通过默认值(110)进行修正"); |
| | | compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[直径信息][内径]解析错误,使用默认值(1000mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.MinorLoss), ePropStatus.Abnormal, "[空压机][局部阻力系数]缺少或者数据格式错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.MinorLoss), ePropStatus.Abnormal, "[局阻系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLossK |
| | | #region CurveQL |
| | | |
| | | if (jobject[RevitJsonProp.MinorLossK].MatchNumeric(out double minorLossK)) |
| | | if (jobject.ParseString(RevitJsonProp.CurveQL, out string curveql)) |
| | | { |
| | | compressor.MinorLossK = minorLossK; |
| | | compressor.CurveQL = curveql; |
| | | if (string.IsNullOrEmpty(compressor.CurveQL)) |
| | | { |
| | | compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Lack, "[水头损失曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | compressor.AppendOrUpdatePropStatus(nameof(compressor.MinorLossK), ePropStatus.Abnormal, "[空压机][损失K系数]缺少或者数据格式错误"); |
| | | compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Abnormal, "缺少[水头损失曲线]"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(compressor.CurveQL)) |
| | | { |
| | | compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Lack, "[水头损失曲线]缺省,期待产品匹配时修复"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return compressor; |
| | | } |
| | | |
| | | //解析水泵 |
| | | private static HStation.Model.RevitPump ParsePump(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | var pump = new Model.RevitPump(); |
| | | pump.Catalog = RevitJsonCatalog.Pump; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | pump.Id = id; |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | pump.Code = code; |
| | | if (string.IsNullOrEmpty(pump.Code)) |
| | | { |
| | | pump.Code = pump.Id; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | pump.Name = name; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Name), ePropStatus.Error, "缺少[名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | pump.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(pump.ModelType)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | pump.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (pump.Flags == null || pump.Flags.Count < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | pump.Description = description; |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | pump.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (pump.ConnectList == null || pump.ConnectList.Count < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartCode/StartPosition |
| | | |
| | | var startConnect = pump.ConnectList?.GetStartConnect(); |
| | | pump.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(pump.StartCode)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pump.StartPosition = startConnect?.Position; |
| | | if (pump.StartPosition == null) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndCode/EndPosition |
| | | |
| | | var endConnect = pump.ConnectList?.GetEndConnect(); |
| | | pump.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(pump.EndCode)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | pump.EndPosition = endConnect?.Position; |
| | | if (pump.EndPosition == null) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusPump, out string linkStatus)) |
| | | { |
| | | pump.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(pump.LinkStatus)) |
| | | { |
| | | pump.LinkStatus = PumpStatus.Open; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Lack, "[水泵状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!PumpStatus.Contains(pump.LinkStatus)) |
| | | { |
| | | pump.LinkStatus = PipeStatus.Open; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[水泵状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.LinkStatus = PipeStatus.Open; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[水泵状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | { |
| | | pump.StartElev = startElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Abnormal, "[上游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (pump.StartElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pump.StartPosition == null) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Lack, "[上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pump.StartElev = pump.StartPosition.Z; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Lack, "[上游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | pump.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndElev), ePropStatus.Abnormal, "[下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (pump.EndElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (pump.EndPosition == null) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndElev), ePropStatus.Lack, "[下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | pump.EndElev = pump.EndPosition.Z; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndElev), ePropStatus.Lack, "[下游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | pump.StartQuality = startQuality; |
| | | if (pump.StartQuality <= 0) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartQuality), ePropStatus.Lack, "[上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.StartQuality), ePropStatus.Abnormal, "[上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | pump.EndQuality = endQuality; |
| | | if (pump.EndQuality <= 0) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndQuality), ePropStatus.Lack, "[下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.EndQuality), ePropStatus.Abnormal, "[下游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedP |
| | | |
| | | if (jobject[RevitJsonProp.RatedP].MatchNumeric(out double ratedP)) |
| | | { |
| | | pump.RatedP = ratedP; |
| | | if (pump.RatedP < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedP), ePropStatus.Lack, "[额定功率]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedP), ePropStatus.Abnormal, "[额定功率]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedQ |
| | | |
| | | if (jobject[RevitJsonProp.RatedQ].MatchNumeric(out double ratedQ)) |
| | | { |
| | | pump.RatedQ = ratedQ; |
| | | if (pump.RatedQ < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Lack, "[额定流量]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Abnormal, "[额定流量]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedH |
| | | |
| | | if (jobject[RevitJsonProp.RatedH].MatchNumeric(out double ratedH)) |
| | | { |
| | | pump.RatedH = ratedH; |
| | | if (pump.RatedH < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedH), ePropStatus.Lack, "[额定扬程]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedH), ePropStatus.Abnormal, "[额定扬程]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedN |
| | | |
| | | if (jobject[RevitJsonProp.RatedN].MatchNumeric(out double ratedN)) |
| | | { |
| | | pump.RatedN = ratedN; |
| | | if (pump.RatedN < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedN), ePropStatus.Lack, "[额定转速]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedN), ePropStatus.Abnormal, "[额定转速]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region RatedHz |
| | | |
| | | if (jobject[RevitJsonProp.RatedHz].MatchNumeric(out double ratedHz)) |
| | | { |
| | | pump.RatedHz = ratedHz; |
| | | if (pump.RatedHz < 1) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[额定频率]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Abnormal, "[额定频率]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (pump.RatedHz < 1) |
| | | { |
| | | pump.RatedHz = 50; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[额定频率]缺省,使用默认值(50Hz)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQH |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQH, out string curveqh)) |
| | | { |
| | | pump.CurveQH = curveqh; |
| | | if (string.IsNullOrEmpty(pump.CurveQH)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[流量扬程曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Abnormal, "缺少[流量扬程曲线]"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(pump.CurveQH)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[流量扬程曲线]缺省,使用默认值(PumpDefault)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQP |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQP, out string curveqp)) |
| | | { |
| | | pump.CurveQP = curveqp; |
| | | if (string.IsNullOrEmpty(pump.CurveQP)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Lack, "[流量功率曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Abnormal, "缺少[流量功率曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region CurveQE |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.CurveQE, out string curveqe)) |
| | | { |
| | | pump.CurveQE = curveqe; |
| | | if (string.IsNullOrEmpty(pump.CurveQE)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Lack, "[流量效率曲线]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Abnormal, "缺少[流量效率曲线]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region SpeedRatio |
| | | |
| | | if (jobject[RevitJsonProp.SpeedRatio].MatchNumeric(out double speedRatio)) |
| | | { |
| | | pump.SpeedRatio = speedRatio; |
| | | } |
| | | else |
| | | { |
| | | pump.SpeedRatio = 1; |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.SpeedRatio), ePropStatus.Abnormal, "[转速比]缺省,使用默认值(1)修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region SpeedRatioPattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.SpeedRatioPattern, out string speedRatioPattern)) |
| | | { |
| | | pump.SpeedRatioPattern = speedRatioPattern; |
| | | if (string.IsNullOrEmpty(pump.SpeedRatioPattern)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Lack, "[转速比模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Abnormal, "缺少[转速比模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Price |
| | | |
| | | if (jobject[RevitJsonProp.Price].MatchNumeric(out double price)) |
| | | { |
| | | pump.Price = price; |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.Price), ePropStatus.Abnormal, "缺少[能耗价格]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region PricePattern |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.PricePattern, out string pricePattern)) |
| | | { |
| | | pump.PricePattern = pricePattern; |
| | | if (string.IsNullOrEmpty(pump.PricePattern)) |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.PricePattern), ePropStatus.Lack, "[价格模式]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | pump.AppendOrUpdatePropStatus(nameof(pump.PricePattern), ePropStatus.Abnormal, "缺少[价格模式]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return pump; |
| | | } |
| | | |
| | | //解析阀门 |
| | | private static HStation.Model.RevitValve ParseValve(JToken jobject) |
| | | { |
| | | if (jobject == null) |
| | | { |
| | | return default; |
| | | } |
| | | var valve = new Model.RevitValve(); |
| | | valve.Catalog = RevitJsonCatalog.Valve; |
| | | |
| | | #region Id |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | valve.Id = id; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Id), ePropStatus.Error, "缺少[构件编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | valve.Code = code; |
| | | if (string.IsNullOrEmpty(valve.Code)) |
| | | { |
| | | valve.Code = valve.Id; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Code), ePropStatus.Lack, "使用[构件编码]赋值"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Code), ePropStatus.Error, "缺少[编码]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Name |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Name, out string name)) |
| | | { |
| | | valve.Name = name; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Name), ePropStatus.Lack, "[名称]缺省"); |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Name), ePropStatus.Error, "缺少[名称]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ModelType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) |
| | | { |
| | | valve.ModelType = modelType; |
| | | if (string.IsNullOrEmpty(valve.ModelType)) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ModelType), ePropStatus.Lack, "[型号信息]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ModelType), ePropStatus.Error, "缺少[型号信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Flags |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) |
| | | { |
| | | valve.Flags = Yw.Untity.FlagsHelper.ToList(flags); |
| | | if (!string.IsNullOrEmpty(flags)) |
| | | { |
| | | if (valve.Flags == null || valve.Flags.Count < 1) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Flags), ePropStatus.Abnormal, "[标签]格式错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缺少[标签]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Description |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Description, out string description)) |
| | | { |
| | | valve.Description = description; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Description), ePropStatus.Error, "缺少[说明信息]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ConnectList |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) |
| | | { |
| | | var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); |
| | | valve.ConnectList = connectList?.Select(x => new Model.RevitConnect() |
| | | { |
| | | Id = x.ConnectId, |
| | | Direction = x.Dirction, |
| | | Position = new Model.RevitPosition() |
| | | { |
| | | X = x.Point.X / 1000f, |
| | | Y = x.Point.Y / 1000f, |
| | | Z = x.Point.Z / 1000f |
| | | } |
| | | }).ToList(); |
| | | if (valve.ConnectList == null || valve.ConnectList.Count < 1) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "[连接列表]解析失败"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "缺少[连接列表]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartCode/StartPosition |
| | | |
| | | var startConnect = valve.ConnectList?.GetStartConnect(); |
| | | valve.StartCode = startConnect?.Id; |
| | | if (string.IsNullOrEmpty(valve.StartCode)) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartCode), ePropStatus.Error, "[上游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | valve.StartPosition = startConnect?.Position; |
| | | if (valve.StartPosition == null) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartPosition), ePropStatus.Error, "[上游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndCode/EndPosition |
| | | |
| | | var endConnect = valve.ConnectList?.GetEndConnect(); |
| | | valve.EndCode = endConnect?.Id; |
| | | if (string.IsNullOrEmpty(valve.EndCode)) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndCode), ePropStatus.Error, "[下游构件]受[连接列表]影响解析错误"); |
| | | } |
| | | valve.EndPosition = endConnect?.Position; |
| | | if (valve.EndPosition == null) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndPosition), ePropStatus.Error, "[下游构件位置]受[连接列表]影响解析错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region LinkStatus |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.LinkStatusValve, out string linkStatus)) |
| | | { |
| | | valve.LinkStatus = linkStatus; |
| | | if (string.IsNullOrEmpty(valve.LinkStatus)) |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Lack, "[阀门状态]缺省"); |
| | | } |
| | | else |
| | | { |
| | | if (!ValveStatus.Contains(valve.LinkStatus)) |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[阀门状态]设置错误"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.LinkStatus = ValveStatus.Open; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[阀门状态]缺少或格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartElev |
| | | |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | { |
| | | valve.StartElev = startElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartElev), ePropStatus.Abnormal, "[上游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (valve.StartElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (valve.StartPosition == null) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartElev), ePropStatus.Lack, "[上游标高]缺省,受[上游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | valve.StartElev = valve.StartPosition.Z; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartElev), ePropStatus.Lack, "[上游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndElev |
| | | |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | valve.EndElev = endElev / 1000f; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndElev), ePropStatus.Abnormal, "[下游标高]缺少或格式错误"); |
| | | } |
| | | |
| | | if (valve.EndElev <= 0) |
| | | { |
| | | //通过z轴自动计算 |
| | | if (valve.EndPosition == null) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndElev), ePropStatus.Lack, "[下游标高]缺省,受[下游构件位置]影响,无法通过Z轴自动计算"); |
| | | } |
| | | else |
| | | { |
| | | valve.EndElev = valve.EndPosition.Z; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndElev), ePropStatus.Lack, "[下游标高]缺省,通过Z轴自动计算"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region StartQuality |
| | | |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | valve.StartQuality = startQuality; |
| | | if (valve.StartQuality <= 0) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartQuality), ePropStatus.Lack, "[上游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.StartQuality), ePropStatus.Abnormal, "[上游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region EndQuality |
| | | |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | valve.EndQuality = endQuality; |
| | | if (valve.EndQuality <= 0) |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndQuality), ePropStatus.Lack, "[下游初始水质]缺省"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.EndQuality), ePropStatus.Abnormal, "[下游初始水质]缺少或者格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Diameter |
| | | |
| | | if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) |
| | | { |
| | | valve.Diameter = diameter; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径]缺少或者格式错误"); |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | valve.Diameter = internalDiameter; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径]通过[内径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径]无法通过[内径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) |
| | | { |
| | | valve.Diameter = dn; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径]通过[公称直径]进行修复]"); |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[直径]无法通过[公称直径]进行修复]"); |
| | | } |
| | | } |
| | | |
| | | if (valve.Diameter < 1) |
| | | { |
| | | valve.Diameter = 500; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[直径][内径]解析错误,使用默认值(500mm)修正]"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region MinorLoss |
| | | |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | valve.MinorLoss = minorLoss; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.MinorLoss), ePropStatus.Abnormal, "[局部阻力系数]缺少或者数据格式错误"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ValveType |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ValveType, out string valveType)) |
| | | { |
| | | valve.ValveType = valveType; |
| | | if (string.IsNullOrEmpty(valve.ValveType)) |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Lack, "[阀门类型]缺省,使用默认值(GPV)进行修正"); |
| | | } |
| | | else |
| | | { |
| | | if (!ValveType.Contains(valve.ValveType)) |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[阀门类型]设置错误,使用默认值(GPV)进行修正"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | valve.ValveType = ValveType.GPV; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[阀门类型]缺少或格式错误,使用默认值(GPV)进行修正"); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ValveSetting |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.ValveSetting, out string valveSetting)) |
| | | { |
| | | valve.ValveSetting = valveSetting; |
| | | } |
| | | else |
| | | { |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Abnormal, "[阀门设置]缺少或格式错误"); |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(valve.ValveSetting)) |
| | | { |
| | | if (valve.ValveType == ValveType.GPV) |
| | | { |
| | | valve.ValveSetting = "GPVDefault"; |
| | | valve.AppendOrUpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Lack, "[阀门设置]缺省,使用默认值(GPVDefault)进行修正"); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | return valve; |
| | | } |
| | | |
| | | //解析装饰件 |
| | |
| | | if (jobject.ParseString(RevitJsonProp.Id, out string id)) |
| | | { |
| | | decorator.Id = id; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Code |
| | | |
| | | if (jobject.ParseString(RevitJsonProp.Code, out string code)) |
| | | { |
| | | decorator.Code = code; |
| | | } |
| | | if (string.IsNullOrEmpty(decorator.Code)) |
| | | { |
| | | decorator.Code = decorator.Id; |
| | | } |
| | | |
| | | #endregion |