From 9eb94e9eec2e2e164698e34d0481d66093c8655b Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期三, 15 一月 2025 17:40:55 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs | 8167 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 4,068 insertions(+), 4,099 deletions(-) diff --git a/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs b/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs index f3b8866..2d96426 100644 --- a/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs +++ b/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs @@ -150,6 +150,15 @@ } } break; + case RevitJsonCatalog.Cooling: + { + var cooling = ParseCooling(jobject); + if (cooling != null) + { + model.Coolings.Add(cooling); + } + } + break; case RevitJsonCatalog.Pipe: { var pipe = ParsePipe(jobject); @@ -243,7 +252,6 @@ } 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(); @@ -292,2556 +300,6 @@ return revitModel; } - //瑙f瀽杩炴帴鑺傜偣 - private static HStation.Model.RevitJunction ParseJunction(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var junction = new Model.RevitJunction(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - - //瑙f瀽鍠峰ご - private static HStation.Model.RevitNozzle ParseNozzle(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var nozzle = new Model.RevitNozzle(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - - //瑙f瀽娑堢伀鏍� - private static HStation.Model.RevitHydrant ParseHydrant(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var hydrant = new Model.RevitHydrant(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - - //瑙f瀽闂峰ご - private static HStation.Model.RevitBlunthead ParseBlunthead(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var blunthead = new Model.RevitBlunthead(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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, "[鍙e緞]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #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; - } - - //瑙f瀽寮ご - private static HStation.Model.RevitElbow ParseElbow(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var elbow = new Model.RevitElbow(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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, "[鍙e緞]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #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; - } - - //瑙f瀽涓夐�� - private static HStation.Model.RevitThreelink ParseThreelink(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var threelink = new Model.RevitThreelink(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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, "[鍙e緞]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #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; - } - - //瑙f瀽鍥涢�� - private static HStation.Model.RevitFourlink ParseFourlink(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var fourlink = new Model.RevitFourlink(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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, "[鍙e緞]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #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; - } - - //瑙f瀽姘磋〃 - private static HStation.Model.RevitMeter ParseMeter(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var meter = new Model.RevitMeter(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - - //瑙f瀽娴侀噺璁� - private static HStation.Model.RevitFlowmeter ParseFlowmeter(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var flowmeter = new Model.RevitFlowmeter(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - - //瑙f瀽鍘嬪姏琛� - private static HStation.Model.RevitPressmeter ParsePressmeter(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var pressmeter = new Model.RevitPressmeter(); - - #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - 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, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); - } - - #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; - } - //瑙f瀽姘村簱 private static HStation.Model.RevitReservoir ParseReservoir(JToken jobject) { @@ -2851,6 +309,7 @@ } var reservoir = new Model.RevitReservoir(); + reservoir.Catalog = RevitJsonCatalog.Reservoir; #region Id @@ -2860,25 +319,7 @@ } 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 @@ -2888,11 +329,11 @@ 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 @@ -2904,12 +345,12 @@ 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 @@ -2923,13 +364,17 @@ { 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, "缂哄皯[鏍囩淇℃伅]"); + } + if (reservoir.Flags == null) + { + reservoir.Flags = new List<string>(); } #endregion @@ -2942,7 +387,7 @@ } else { - reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + reservoir.UpdatePropStatus(nameof(reservoir.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -2965,29 +410,12 @@ }).ToList(); if (reservoir.ConnectList == null || reservoir.ConnectList.Count < 1) { - reservoir.AppendOrUpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + reservoir.UpdatePropStatus(nameof(reservoir.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } 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 @@ -2997,7 +425,7 @@ reservoir.Position = reservoir.ConnectList?.GetCenterPosition(); if (reservoir.Position == null) { - reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Position), ePropStatus.Lack, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + reservoir.UpdatePropStatus(nameof(reservoir.Position), ePropStatus.Lack, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); } #endregion @@ -3006,11 +434,11 @@ 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) @@ -3021,7 +449,7 @@ } else { - reservoir.AppendOrUpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + reservoir.UpdatePropStatus(nameof(reservoir.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } } @@ -3030,12 +458,12 @@ //閫氳繃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杞磋嚜鍔ㄨ绠�"); } } @@ -3049,7 +477,7 @@ } else { - reservoir.AppendOrUpdatePropStatus(nameof(reservoir.Head), ePropStatus.Abnormal, "[鎬绘按澶碷缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + reservoir.UpdatePropStatus(nameof(reservoir.Head), ePropStatus.Abnormal, "[鎬绘按澶碷缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } #endregion @@ -3061,12 +489,12 @@ 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 @@ -3083,6 +511,7 @@ } var tank = new Model.RevitTank(); + tank.Catalog = RevitJsonCatalog.Tank; #region Id @@ -3092,25 +521,7 @@ } 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 @@ -3120,11 +531,11 @@ 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 @@ -3136,12 +547,12 @@ 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 @@ -3155,13 +566,18 @@ { 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (tank.Flags == null) + { + tank.Flags = new List<string>(); } #endregion @@ -3174,7 +590,7 @@ } else { - tank.AppendOrUpdatePropStatus(nameof(tank.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + tank.UpdatePropStatus(nameof(tank.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -3197,29 +613,12 @@ }).ToList(); if (tank.ConnectList == null || tank.ConnectList.Count < 1) { - tank.AppendOrUpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + tank.UpdatePropStatus(nameof(tank.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } 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 @@ -3229,7 +628,7 @@ tank.Position = tank.ConnectList?.GetCenterPosition(); if (tank.Position == null) { - tank.AppendOrUpdatePropStatus(nameof(tank.Position), ePropStatus.Lack, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + tank.UpdatePropStatus(nameof(tank.Position), ePropStatus.Lack, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); } #endregion @@ -3238,11 +637,11 @@ 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) @@ -3253,7 +652,7 @@ } else { - tank.AppendOrUpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + tank.UpdatePropStatus(nameof(tank.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } } @@ -3262,12 +661,12 @@ //閫氳繃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杞磋嚜鍔ㄨ绠�"); } } @@ -3278,11 +677,11 @@ 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 @@ -3292,11 +691,11 @@ 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 @@ -3306,11 +705,11 @@ 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 @@ -3320,11 +719,11 @@ 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 @@ -3334,11 +733,11 @@ 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 @@ -3350,14 +749,32 @@ 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; @@ -3372,6 +789,7 @@ } var waterbox = new Model.RevitWaterbox(); + waterbox.Catalog = RevitJsonCatalog.Waterbox; #region Id @@ -3381,25 +799,7 @@ } 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 @@ -3409,11 +809,11 @@ 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 @@ -3425,12 +825,12 @@ 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 @@ -3444,13 +844,18 @@ { 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (waterbox.Flags == null) + { + waterbox.Flags = new List<string>(); } #endregion @@ -3463,7 +868,7 @@ } else { - waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + waterbox.UpdatePropStatus(nameof(waterbox.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -3486,29 +891,12 @@ }).ToList(); if (waterbox.ConnectList == null || waterbox.ConnectList.Count < 1) { - waterbox.AppendOrUpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + waterbox.UpdatePropStatus(nameof(waterbox.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } 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 @@ -3518,7 +906,7 @@ waterbox.Position = waterbox.ConnectList?.GetCenterPosition(); if (waterbox.Position == null) { - waterbox.AppendOrUpdatePropStatus(nameof(waterbox.Position), ePropStatus.Lack, "[浣嶇疆]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + waterbox.UpdatePropStatus(nameof(waterbox.Position), ePropStatus.Lack, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); } #endregion @@ -3527,11 +915,11 @@ 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) @@ -3542,7 +930,7 @@ } else { - waterbox.AppendOrUpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + waterbox.UpdatePropStatus(nameof(waterbox.PoolElev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } } @@ -3551,12 +939,12 @@ //閫氳繃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杞磋嚜鍔ㄨ绠�"); } } @@ -3567,11 +955,11 @@ 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 @@ -3581,11 +969,11 @@ 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 @@ -3595,11 +983,11 @@ 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 @@ -3609,11 +997,11 @@ 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 @@ -3623,11 +1011,11 @@ 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 @@ -3639,17 +1027,2918 @@ 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; + } + + //瑙f瀽杩炴帴鑺傜偣 + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (junction.Flags == null) + { + junction.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + junction.Elev += facade / 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; + } + + //瑙f瀽闂峰ご + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (blunthead.Flags == null) + { + blunthead.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + blunthead.Elev += facade / 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; + } + if (blunthead.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + blunthead.Caliber = caliber; + } + } + if (blunthead.Caliber <= 0) + { + blunthead.UpdatePropStatus(nameof(blunthead.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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; + + } + + //瑙f瀽寮ご + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (elbow.Flags == null) + { + elbow.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + elbow.Elev += facade / 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; + } + if (elbow.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + elbow.Caliber = caliber; + } + } + if (elbow.Caliber <= 0) + { + elbow.UpdatePropStatus(nameof(elbow.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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 = (int)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; + } + + //瑙f瀽涓夐�� + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (threelink.Flags == null) + { + threelink.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + threelink.Elev += facade / 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; + } + if (threelink.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + threelink.Caliber = caliber; + } + } + if (threelink.Caliber <= 0) + { + threelink.UpdatePropStatus(nameof(threelink.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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; + } + + //瑙f瀽鍥涢�� + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (fourlink.Flags == null) + { + fourlink.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + fourlink.Elev += facade / 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; + } + if (fourlink.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + fourlink.Caliber = caliber; + } + } + if (fourlink.Caliber <= 0) + { + fourlink.UpdatePropStatus(nameof(fourlink.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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; + } + + //瑙f瀽鍠峰ご + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (nozzle.Flags == null) + { + nozzle.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + nozzle.Elev += facade / 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, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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; + } + + //瑙f瀽娑堢伀鏍� + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (hydrant.Flags == null) + { + hydrant.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + hydrant.Elev += facade / 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, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #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; + } + + //瑙f瀽鍐峰嵈濉� + private static HStation.Model.RevitCooling ParseCooling(JToken jobject) + { + if (jobject == null) + { + return default; + } + + var cooling = new Model.RevitCooling(); + cooling.Catalog = RevitJsonCatalog.Cooling; + + #region Id + + if (jobject.ParseString(RevitJsonProp.Id, out string id)) + { + cooling.Id = id; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); + } + + #endregion + + #region Name + + if (jobject.ParseString(RevitJsonProp.Name, out string name)) + { + cooling.Name = name; + cooling.UpdatePropStatus(nameof(cooling.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Name), ePropStatus.Error, "缂哄皯 [鏋勪欢鍚嶇О]"); + } + + #endregion + + #region ModelType + + if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) + { + cooling.ModelType = modelType; + if (string.IsNullOrEmpty(cooling.ModelType)) + { + cooling.UpdatePropStatus(nameof(cooling.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + } + + #endregion + + #region Flags + + if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) + { + cooling.Flags = Yw.Untity.FlagsHelper.ToList(flags); + if (!string.IsNullOrEmpty(flags)) + { + if (cooling.Flags == null || cooling.Flags.Count < 1) + { + cooling.UpdatePropStatus(nameof(cooling.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); + } + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (cooling.Flags == null) + { + cooling.Flags = new List<string>(); + } + + #endregion + + #region Description + + if (jobject.ParseString(RevitJsonProp.Description, out string description)) + { + cooling.Description = description; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + } + + #endregion + + #region ConnectList + + if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) + { + var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); + cooling.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 (cooling.ConnectList == null || cooling.ConnectList.Count < 1) + { + cooling.UpdatePropStatus(nameof(cooling.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + } + + #endregion + + #region Position + + cooling.Position = cooling.ConnectList?.GetCenterPosition(); + if (cooling.Position == null) + { + cooling.UpdatePropStatus(nameof(cooling.Position), ePropStatus.Lack, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) + { + cooling.Elev = elev; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Abnormal, "[鏍囬珮淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (cooling.Elev <= 0) + { + if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) + { + cooling.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + cooling.Elev += facade / 1000f; + } + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + } + + if (cooling.Elev <= 0) + { + //閫氳繃z杞磋嚜鍔ㄨ绠� + if (cooling.Position == null) + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛屽彈[浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + else + { + cooling.Elev = cooling.Position.Z; + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + } + + #endregion + + #region Material + + if (jobject.ParseString(RevitJsonProp.Material, out string material)) + { + cooling.Material = material; + if (string.IsNullOrEmpty(cooling.Material)) + { + cooling.UpdatePropStatus(nameof(cooling.Material), ePropStatus.Lack, "[鏉愯川淇℃伅]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Material), ePropStatus.Abnormal, "缂哄皯[鏉愯川淇℃伅]"); + } + + #endregion + + #region Caliber + + if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) + { + cooling.Caliber = caliber; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region Demand + + if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) + { + cooling.Demand = demand; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Demand), ePropStatus.Abnormal, "[闇�姘撮噺]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region DemandPattern + + if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) + { + cooling.DemandPattern = demandPattern; + if (string.IsNullOrEmpty(cooling.DemandPattern)) + { + cooling.UpdatePropStatus(nameof(cooling.DemandPattern), ePropStatus.Lack, "[闇�姘存ā寮廬缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.DemandPattern), ePropStatus.Abnormal, "缂哄皯[闇�姘存ā寮廬"); + } + + #endregion + + #region MinorLoss + + if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) + { + cooling.MinorLoss = minorLoss; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region Coefficient + + if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) + { + cooling.Coefficient = coeffientp; + if (cooling.Coefficient <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Lack, "[鍠峰皠绯绘暟]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Abnormal, "[鍠峰皠绯绘暟]缂哄皯鎴栬�呮牸寮忛敊璇�"); + if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) + { + cooling.Coefficient = coeffientf; + if (cooling.Coefficient <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Lack, "[娴侀噺绯绘暟]缂虹渷"); + } + } + } + + #endregion + + #region LowerLimit + + if (jobject[RevitJsonProp.LowerLimit].MatchNumeric(out double lowerLimit)) + { + cooling.LowerLimit = lowerLimit; + if (cooling.LowerLimit <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.LowerLimit), ePropStatus.Lack, "[鏈�灏忓帇鍔沒缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.LowerLimit), ePropStatus.Abnormal, "[鏈�灏忓帇鍔沒缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + #endregion + + return cooling; + } + + //瑙f瀽姘磋〃 + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (meter.Flags == null) + { + meter.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + meter.Elev += facade / 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; + } + + //瑙f瀽娴侀噺璁� + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (flowmeter.Flags == null) + { + flowmeter.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + flowmeter.Elev += facade / 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; + } + + //瑙f瀽鍘嬪姏琛� + 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pressmeter.Flags == null) + { + pressmeter.Flags = new List<string>(); + } + + #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, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + 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, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + pressmeter.Elev += facade / 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; } //瑙f瀽绠¢亾 @@ -3661,6 +3950,7 @@ } var pipe = new Model.RevitPipe(); + pipe.Catalog = RevitJsonCatalog.Pipe; #region Id @@ -3670,25 +3960,7 @@ } 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 @@ -3698,11 +3970,14 @@ if (jobject.ParseString(RevitJsonProp.Name, out string name)) { pipe.Name = name; - pipe.AppendOrUpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鍚嶇О]缂虹渷"); + if (string.IsNullOrEmpty(pipe.Name)) + { + pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } } else { - pipe.AppendOrUpdatePropStatus(nameof(pipe.Name), ePropStatus.Error, "缂哄皯[鍚嶇О]"); + pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Error, "缂哄皯[鏋勪欢鍚嶇О]"); } #endregion @@ -3714,12 +3989,12 @@ 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 @@ -3728,18 +4003,23 @@ if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) { - pipe.Flags = Yw.Untity.FlagsHelper.ToList(flags); + pipe.Flags = RevitFlagsHelper.ToList(flags); if (!string.IsNullOrEmpty(flags)) { 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pipe.Flags == null) + { + pipe.Flags = new List<string>(); } #endregion @@ -3752,7 +4032,7 @@ } else { - pipe.AppendOrUpdatePropStatus(nameof(pipe.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + pipe.UpdatePropStatus(nameof(pipe.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -3775,12 +4055,12 @@ }).ToList(); if (pipe.ConnectList == null || pipe.ConnectList.Count < 1) { - pipe.AppendOrUpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + pipe.UpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } else { - pipe.AppendOrUpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + pipe.UpdatePropStatus(nameof(pipe.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); } #endregion @@ -3791,12 +4071,12 @@ pipe.StartCode = startConnect?.Id; if (string.IsNullOrEmpty(pipe.StartCode)) { - pipe.AppendOrUpdatePropStatus(nameof(pipe.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pipe.UpdatePropStatus(nameof(pipe.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } pipe.StartPosition = startConnect?.Position; if (pipe.StartPosition == null) { - pipe.AppendOrUpdatePropStatus(nameof(pipe.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pipe.UpdatePropStatus(nameof(pipe.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -3807,12 +4087,12 @@ pipe.EndCode = endConnect?.Id; if (string.IsNullOrEmpty(pipe.EndCode)) { - pipe.AppendOrUpdatePropStatus(nameof(pipe.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pipe.UpdatePropStatus(nameof(pipe.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } pipe.EndPosition = endConnect?.Position; if (pipe.EndPosition == null) { - pipe.AppendOrUpdatePropStatus(nameof(pipe.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pipe.UpdatePropStatus(nameof(pipe.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -3825,109 +4105,21 @@ 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 @@ -3939,57 +4131,73 @@ 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 #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + //鐩村緞淇℃伅 + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { pipe.Diameter = diameter; } 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)) + if (jobject[RevitJsonProp.Diameter].MatchNumeric(out diameter)) { - pipe.Diameter = internalDiameter; - pipe.AppendOrUpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞]閫氳繃[鍐呭緞]杩涜淇]"); + pipe.Diameter = diameter; + 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) + { + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out diameter)) + { + pipe.Diameter = diameter; + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); + } + else + { + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); + } + } + + //鍏О鐩村緞 if (pipe.Diameter < 1) { 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, "[鐩村緞][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Error, "[鐩村緞淇℃伅]瑙f瀽閿欒锛屾棤娉曢�氳繃銆愮洿寰勩�戙�愬唴寰勩�戙�愬叕绉扮洿寰勩�戜慨澶�"); } #endregion @@ -3998,22 +4206,22 @@ 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, "[闀垮害淇℃伅]鍙梉杩炴帴鍒楄〃]褰卞搷鏃犳硶鑷姩璁$畻"); } } @@ -4027,13 +4235,13 @@ } 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, "[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); + pipe.UpdatePropStatus(nameof(pipe.Roughness), ePropStatus.Lack, "[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); } #endregion @@ -4046,7 +4254,7 @@ } else { - pipe.AppendOrUpdatePropStatus(nameof(pipe.MinorLoss), ePropStatus.Abnormal, "[灞�閮ㄩ樆鍔涚郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + pipe.UpdatePropStatus(nameof(pipe.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } #endregion @@ -4063,6 +4271,7 @@ } var translation = new Model.RevitTranslation(); + translation.Catalog = RevitJsonCatalog.Translation; #region Id @@ -4072,25 +4281,7 @@ } 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 @@ -4100,11 +4291,11 @@ 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 @@ -4116,12 +4307,12 @@ 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 @@ -4135,13 +4326,18 @@ { 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, "缂哄皯[鏍囩淇℃伅]"); + } + + if (translation.Flags == null) + { + translation.Flags = new List<string>(); } #endregion @@ -4154,7 +4350,7 @@ } else { - translation.AppendOrUpdatePropStatus(nameof(translation.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + translation.UpdatePropStatus(nameof(translation.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -4177,12 +4373,12 @@ }).ToList(); if (translation.ConnectList == null || translation.ConnectList.Count < 1) { - translation.AppendOrUpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + translation.UpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } else { - translation.AppendOrUpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + translation.UpdatePropStatus(nameof(translation.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); } #endregion @@ -4193,12 +4389,12 @@ translation.StartCode = startConnect?.Id; if (string.IsNullOrEmpty(translation.StartCode)) { - translation.AppendOrUpdatePropStatus(nameof(translation.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + translation.UpdatePropStatus(nameof(translation.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } translation.StartPosition = startConnect?.Position; if (translation.StartPosition == null) { - translation.AppendOrUpdatePropStatus(nameof(translation.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + translation.UpdatePropStatus(nameof(translation.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -4209,127 +4405,90 @@ translation.EndCode = endConnect?.Id; if (string.IsNullOrEmpty(translation.EndCode)) { - translation.AppendOrUpdatePropStatus(nameof(translation.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + translation.UpdatePropStatus(nameof(translation.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } translation.EndPosition = endConnect?.Position; if (translation.EndPosition == null) { - translation.AppendOrUpdatePropStatus(nameof(translation.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + translation.UpdatePropStatus(nameof(translation.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #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.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + translation.Elev += facade / 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 @@ -4341,25 +4500,25 @@ 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 #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { translation.Diameter = diameter; } else { - translation.AppendOrUpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[鐩村緞]缂哄皯鎴栬�呮牸寮忛敊璇�"); + translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); } if (translation.Diameter < 1) @@ -4367,11 +4526,11 @@ 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, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); } } @@ -4380,18 +4539,36 @@ 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, "[鐩村緞][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + translation.Diameter = 500; + translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + } + + #endregion + + #region StartDiameter + + if (jobject[RevitJsonProp.MaxSize].MatchNumeric(out double maxSize)) + { + translation.StartDiameter = maxSize; + } + + #endregion + + #region EndDiameter + + if (jobject[RevitJsonProp.MinSize].MatchNumeric(out double minSize)) + { + translation.EndDiameter = minSize; } #endregion @@ -4400,22 +4577,22 @@ 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, "[闀垮害淇℃伅]鍙梉杩炴帴鍒楄〃]褰卞搷鏃犳硶鑷姩璁$畻"); } } @@ -4429,13 +4606,13 @@ } 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, "[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); + translation.UpdatePropStatus(nameof(translation.Roughness), ePropStatus.Lack, "[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); } #endregion @@ -4448,816 +4625,12 @@ } else { - translation.AppendOrUpdatePropStatus(nameof(translation.MinorLoss), ePropStatus.Abnormal, "[灞�閮ㄩ樆鍔涚郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + translation.UpdatePropStatus(nameof(translation.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } #endregion return translation; - } - - //瑙f瀽鎹㈢儹鍣� - private static HStation.Model.RevitExchanger ParseExchanger(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var exchanger = new Model.RevitExchanger(); - - #region Id - - if (jobject.ParseString(RevitJsonProp.Id, out string id)) - { - exchanger.Id = id; - } - 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, "[鎹㈢儹鍣╙缂哄皯[缂栫爜]"); - } - - #endregion - - #region Name - - if (jobject.ParseString(RevitJsonProp.Name, out string name)) - { - exchanger.Name = name; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Name), ePropStatus.Lack, "[鎹㈢儹鍣╙[鍚嶇О]缂虹渷"); - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Name), ePropStatus.Error, "[鎹㈢儹鍣╙缂哄皯[鍚嶇О]"); - } - - #endregion - - #region ModelType - - if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) - { - exchanger.ModelType = modelType; - if (string.IsNullOrEmpty(exchanger.ModelType)) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Lack, "[鎹㈢儹鍣╙[鍨嬪彿淇℃伅]缂虹渷"); - } - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Error, "[鎹㈢儹鍣╙缂哄皯[鍨嬪彿淇℃伅]"); - } - - #endregion - - #region Flags - - if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) - { - exchanger.Flags = Yw.Untity.FlagsHelper.ToList(flags); - if (!string.IsNullOrEmpty(flags)) - { - if (exchanger.Flags == null || exchanger.Flags.Count < 1) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[鏍囩]鏍煎紡閿欒"); - } - } - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "[鎹㈢儹鍣╙缂哄皯[鏍囩]"); - } - - #endregion - - #region Description - - if (jobject.ParseString(RevitJsonProp.Description, out string description)) - { - exchanger.Description = description; - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Description), ePropStatus.Error, "[鎹㈢儹鍣╙缂哄皯[璇存槑淇℃伅]"); - } - - #endregion - - #region ConnectList - - if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) - { - var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); - exchanger.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 (exchanger.ConnectList == null || exchanger.ConnectList.Count < 1) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[鎹㈢儹鍣╙[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[鎹㈢儹鍣╙缂哄皯[杩炴帴鍒楄〃]"); - } - - #endregion - - #region StartCode/StartPosition - - var startConnect = exchanger.ConnectList?.GetStartConnect(); - exchanger.StartCode = startConnect?.Id; - if (string.IsNullOrEmpty(exchanger.StartCode)) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartCode), ePropStatus.Error, "[鎹㈢儹鍣╙[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - exchanger.StartPosition = startConnect?.Position; - if (exchanger.StartPosition == null) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartPosition), ePropStatus.Error, "[鎹㈢儹鍣╙[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - - #endregion - - #region EndCode/EndPosition - - var endConnect = exchanger.ConnectList?.GetEndConnect(); - exchanger.EndCode = endConnect?.Id; - if (string.IsNullOrEmpty(exchanger.EndCode)) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndCode), ePropStatus.Error, "[鎹㈢儹鍣╙[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - exchanger.EndPosition = endConnect?.Position; - if (exchanger.EndPosition == null) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndPosition), ePropStatus.Error, "[鎹㈢儹鍣╙[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - - #endregion - - #region LinkStatus - - if (jobject.ParseString(RevitJsonProp.LinkStatusPipe, out string linkStatus)) - { - exchanger.LinkStatus = linkStatus; - if (string.IsNullOrEmpty(exchanger.LinkStatus)) - { - exchanger.LinkStatus = PipeStatus.Open; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Lack, "[鎹㈢儹鍣╙[绠¢亾鐘舵�乚缂虹渷"); - } - else - { - if (!PipeStatus.Contains(exchanger.LinkStatus)) - { - exchanger.LinkStatus = PipeStatus.Open; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[绠¢亾鐘舵�乚璁剧疆閿欒"); - } - } - } - else - { - exchanger.LinkStatus = PipeStatus.Open; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[绠¢亾鐘舵�乚缂哄皯鎴栨牸寮忛敊璇�"); - } - - #endregion - - #region StartElev - - if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) - { - exchanger.StartElev = startElev / 1000f; - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[涓婃父鏍囬珮]缂哄皯鎴栨牸寮忛敊璇�"); - } - - if (exchanger.StartElev <= 0) - { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (exchanger.StartPosition == null) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Lack, "[鎹㈢儹鍣╙[涓婃父鏍囬珮]缂虹渷锛屽彈[涓婃父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - else - { - exchanger.StartElev = exchanger.StartPosition.Z; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.StartElev), ePropStatus.Lack, "[鎹㈢儹鍣╙[涓婃父鏍囬珮]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - } - - #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) - { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (exchanger.EndPosition == null) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndElev), ePropStatus.Lack, "[鎹㈢儹鍣╙[涓嬫父鏍囬珮]缂虹渷锛屽彈[涓嬫父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - else - { - exchanger.EndElev = exchanger.EndPosition.Z; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.EndElev), 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 - - #region Material - - if (jobject.ParseString(RevitJsonProp.Material, out string material)) - { - exchanger.Material = material; - if (string.IsNullOrEmpty(exchanger.Material)) - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Material), ePropStatus.Lack, "[鎹㈢儹鍣╙[鏉愯川]缂虹渷"); - } - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Material), ePropStatus.Abnormal, "[鎹㈢儹鍣╙缂哄皯[鏉愯川]"); - } - - #endregion - - #region Diameter - - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) - { - exchanger.Diameter = diameter; - } - else - { - exchanger.AppendOrUpdatePropStatus(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, "[鎹㈢儹鍣╙[鐩村緞]閫氳繃[鍐呭緞]杩涜淇]"); - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[鐩村緞]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); - } - } - - if (exchanger.Diameter < 1) - { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) - { - exchanger.Diameter = dn; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[鎹㈢儹鍣╙[鐩村緞]閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[鐩村緞]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - } - - if (exchanger.Diameter < 1) - { - exchanger.Diameter = 1000; - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[鎹㈢儹鍣╙[鐩村緞][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(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, "[鎹㈢儹鍣╙[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); - } - - #endregion - - #region MinorLoss - - if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) - { - exchanger.MinorLoss = minorLoss; - } - else - { - exchanger.AppendOrUpdatePropStatus(nameof(exchanger.MinorLoss), ePropStatus.Abnormal, "[鎹㈢儹鍣╙[灞�閮ㄩ樆鍔涚郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #endregion - - return exchanger; - } - - //瑙f瀽绌哄帇鏈� - private static HStation.Model.RevitCompressor ParseCompressor(JToken jobject) - { - if (jobject == null) - { - return default; - } - - var compressor = new Model.RevitCompressor(); - - #region Id - - if (jobject.ParseString(RevitJsonProp.Id, out string id)) - { - compressor.Id = id; - } - 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, "[绌哄帇鏈篯缂哄皯[缂栫爜]"); - } - - #endregion - - #region Name - - if (jobject.ParseString(RevitJsonProp.Name, out string name)) - { - compressor.Name = name; - compressor.AppendOrUpdatePropStatus(nameof(compressor.Name), ePropStatus.Lack, "[绌哄帇鏈篯[鍚嶇О]缂虹渷"); - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Name), ePropStatus.Error, "[绌哄帇鏈篯缂哄皯[鍚嶇О]"); - } - - #endregion - - #region ModelType - - if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) - { - compressor.ModelType = modelType; - if (string.IsNullOrEmpty(compressor.ModelType)) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Lack, "[绌哄帇鏈篯[鍨嬪彿淇℃伅]缂虹渷"); - } - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Error, "[绌哄帇鏈篯缂哄皯[鍨嬪彿淇℃伅]"); - } - - #endregion - - #region Flags - - if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) - { - compressor.Flags = Yw.Untity.FlagsHelper.ToList(flags); - if (!string.IsNullOrEmpty(flags)) - { - if (compressor.Flags == null || compressor.Flags.Count < 1) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Flags), ePropStatus.Abnormal, "[绌哄帇鏈篯[鏍囩]鏍煎紡閿欒"); - } - } - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "[绌哄帇鏈篯缂哄皯[鏍囩]"); - } - - #endregion - - #region Description - - if (jobject.ParseString(RevitJsonProp.Description, out string description)) - { - compressor.Description = description; - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Description), ePropStatus.Error, "[绌哄帇鏈篯缂哄皯[璇存槑淇℃伅]"); - } - - #endregion - - #region ConnectList - - if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) - { - var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); - compressor.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 (compressor.ConnectList == null || compressor.ConnectList.Count < 1) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[绌哄帇鏈篯[杩炴帴鍒楄〃]瑙f瀽澶辫触"); - } - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[绌哄帇鏈篯缂哄皯[杩炴帴鍒楄〃]"); - } - - #endregion - - #region StartCode/StartPosition - - var startConnect = compressor.ConnectList?.GetStartConnect(); - compressor.StartCode = startConnect?.Id; - if (string.IsNullOrEmpty(compressor.StartCode)) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.StartCode), ePropStatus.Error, "[绌哄帇鏈篯[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - compressor.StartPosition = startConnect?.Position; - if (compressor.StartPosition == null) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.StartPosition), ePropStatus.Error, "[绌哄帇鏈篯[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - - #endregion - - #region EndCode/EndPosition - - var endConnect = compressor.ConnectList?.GetEndConnect(); - compressor.EndCode = endConnect?.Id; - if (string.IsNullOrEmpty(compressor.EndCode)) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.EndCode), ePropStatus.Error, "[绌哄帇鏈篯[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - compressor.EndPosition = endConnect?.Position; - if (compressor.EndPosition == null) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.EndPosition), ePropStatus.Error, "[绌哄帇鏈篯[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); - } - - #endregion - - #region LinkStatus - - if (jobject.ParseString(RevitJsonProp.LinkStatusPipe, out string linkStatus)) - { - compressor.LinkStatus = linkStatus; - if (string.IsNullOrEmpty(compressor.LinkStatus)) - { - compressor.LinkStatus = PipeStatus.Open; - compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Lack, "[绌哄帇鏈篯[绠¢亾鐘舵�乚缂虹渷"); - } - else - { - if (!PipeStatus.Contains(compressor.LinkStatus)) - { - compressor.LinkStatus = PipeStatus.Open; - compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[绌哄帇鏈篯[绠¢亾鐘舵�乚璁剧疆閿欒"); - } - } - } - else - { - compressor.LinkStatus = PipeStatus.Open; - compressor.AppendOrUpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[绌哄帇鏈篯[绠¢亾鐘舵�乚缂哄皯鎴栨牸寮忛敊璇�"); - } - - #endregion - - #region StartElev - - if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) - { - compressor.StartElev = startElev / 1000f; - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Abnormal, "[绌哄帇鏈篯[涓婃父鏍囬珮]缂哄皯鎴栨牸寮忛敊璇�"); - } - - if (compressor.StartElev <= 0) - { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (compressor.StartPosition == null) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Lack, "[绌哄帇鏈篯[涓婃父鏍囬珮]缂虹渷锛屽彈[涓婃父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - else - { - compressor.StartElev = compressor.StartPosition.Z; - compressor.AppendOrUpdatePropStatus(nameof(compressor.StartElev), ePropStatus.Lack, "[绌哄帇鏈篯[涓婃父鏍囬珮]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - } - - #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) - { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (compressor.EndPosition == null) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.EndElev), ePropStatus.Lack, "[绌哄帇鏈篯[涓嬫父鏍囬珮]缂虹渷锛屽彈[涓嬫父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); - } - else - { - compressor.EndElev = compressor.EndPosition.Z; - compressor.AppendOrUpdatePropStatus(nameof(compressor.EndElev), 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 - - #region Material - - if (jobject.ParseString(RevitJsonProp.Material, out string material)) - { - compressor.Material = material; - if (string.IsNullOrEmpty(compressor.Material)) - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Material), ePropStatus.Lack, "[绌哄帇鏈篯[鏉愯川]缂虹渷"); - } - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Material), ePropStatus.Abnormal, "[绌哄帇鏈篯缂哄皯[鏉愯川]"); - } - - #endregion - - #region Diameter - - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) - { - compressor.Diameter = diameter; - } - else - { - compressor.AppendOrUpdatePropStatus(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, "[绌哄帇鏈篯[鐩村緞]閫氳繃[鍐呭緞]杩涜淇]"); - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[绌哄帇鏈篯[鐩村緞]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); - } - } - - if (compressor.Diameter < 1) - { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) - { - compressor.Diameter = dn; - compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[绌哄帇鏈篯[鐩村緞]閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[绌哄帇鏈篯[鐩村緞]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - } - - if (compressor.Diameter < 1) - { - compressor.Diameter = 1000; - compressor.AppendOrUpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[绌哄帇鏈篯[鐩村緞][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(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, "[绌哄帇鏈篯[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); - } - - #endregion - - #region MinorLoss - - if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) - { - compressor.MinorLoss = minorLoss; - } - else - { - compressor.AppendOrUpdatePropStatus(nameof(compressor.MinorLoss), ePropStatus.Abnormal, "[绌哄帇鏈篯[灞�閮ㄩ樆鍔涚郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #endregion - - return compressor; } //瑙f瀽姘存车 @@ -5268,6 +4641,7 @@ return default; } var pump = new Model.RevitPump(); + pump.Catalog = RevitJsonCatalog.Pump; #region Id @@ -5277,25 +4651,7 @@ } 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, "缂哄皯[缂栫爜]"); + pump.UpdatePropStatus(nameof(pump.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); } #endregion @@ -5305,11 +4661,11 @@ if (jobject.ParseString(RevitJsonProp.Name, out string name)) { pump.Name = name; - pump.AppendOrUpdatePropStatus(nameof(pump.Name), ePropStatus.Lack, "[鍚嶇О]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); } else { - pump.AppendOrUpdatePropStatus(nameof(pump.Name), ePropStatus.Error, "缂哄皯[鍚嶇О]"); + pump.UpdatePropStatus(nameof(pump.Name), ePropStatus.Error, "缂哄皯[鏋勪欢鍚嶇О]"); } #endregion @@ -5321,12 +4677,12 @@ pump.ModelType = modelType; if (string.IsNullOrEmpty(pump.ModelType)) { - pump.AppendOrUpdatePropStatus(nameof(pump.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + pump.UpdatePropStatus(nameof(pump.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); } #endregion @@ -5340,13 +4696,18 @@ { if (pump.Flags == null || pump.Flags.Count < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.Flags), ePropStatus.Abnormal, "[鏍囩]鏍煎紡閿欒"); + pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); } } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缂哄皯[鏍囩]"); + pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pump.Flags == null) + { + pump.Flags = new List<string>(); } #endregion @@ -5359,7 +4720,7 @@ } else { - pump.AppendOrUpdatePropStatus(nameof(pump.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + pump.UpdatePropStatus(nameof(pump.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -5382,12 +4743,12 @@ }).ToList(); if (pump.ConnectList == null || pump.ConnectList.Count < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + pump.UpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + pump.UpdatePropStatus(nameof(pump.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); } #endregion @@ -5398,12 +4759,12 @@ pump.StartCode = startConnect?.Id; if (string.IsNullOrEmpty(pump.StartCode)) { - pump.AppendOrUpdatePropStatus(nameof(pump.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pump.UpdatePropStatus(nameof(pump.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } pump.StartPosition = startConnect?.Position; if (pump.StartPosition == null) { - pump.AppendOrUpdatePropStatus(nameof(pump.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pump.UpdatePropStatus(nameof(pump.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -5414,12 +4775,12 @@ pump.EndCode = endConnect?.Id; if (string.IsNullOrEmpty(pump.EndCode)) { - pump.AppendOrUpdatePropStatus(nameof(pump.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pump.UpdatePropStatus(nameof(pump.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } pump.EndPosition = endConnect?.Position; if (pump.EndPosition == null) { - pump.AppendOrUpdatePropStatus(nameof(pump.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + pump.UpdatePropStatus(nameof(pump.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -5432,126 +4793,72 @@ if (string.IsNullOrEmpty(pump.LinkStatus)) { pump.LinkStatus = PumpStatus.Open; - pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Lack, "[姘存车鐘舵�乚缂虹渷"); + pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Lack, "[姘存车鐘舵�乚缂虹渷"); } else { if (!PumpStatus.Contains(pump.LinkStatus)) { pump.LinkStatus = PipeStatus.Open; - pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[姘存车鐘舵�乚璁剧疆閿欒"); + pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[姘存车鐘舵�乚璁剧疆閿欒"); } } } else { pump.LinkStatus = PipeStatus.Open; - pump.AppendOrUpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[姘存车鐘舵�乚缂哄皯鎴栨牸寮忛敊璇�"); + pump.UpdatePropStatus(nameof(pump.LinkStatus), ePropStatus.Abnormal, "[姘存车鐘舵�乚缂哄皯鎴栨牸寮忛敊璇�"); } #endregion - #region StartElev + #region Elev - if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { - pump.StartElev = startElev / 1000f; + pump.Elev = elev; } else { - pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Abnormal, "[涓婃父鏍囬珮]缂哄皯鎴栨牸寮忛敊璇�"); + pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Abnormal, "[鏍囬珮淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); } - if (pump.StartElev <= 0) + if (pump.Elev <= 0) { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (pump.StartPosition == null) + if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { - pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Lack, "[涓婃父鏍囬珮]缂虹渷锛屽彈[涓婃父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + pump.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + pump.Elev += facade / 1000f; + } + } } else { - pump.StartElev = pump.StartPosition.Z; - pump.AppendOrUpdatePropStatus(nameof(pump.StartElev), ePropStatus.Lack, "[涓婃父鏍囬珮]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } } - #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) + if (pump.Elev <= 0) { //閫氳繃z杞磋嚜鍔ㄨ绠� - if (pump.EndPosition == null) + if (pump.StartPosition == null || pump.EndPosition == null) { - pump.AppendOrUpdatePropStatus(nameof(pump.EndElev), ePropStatus.Lack, "[涓嬫父鏍囬珮]缂虹渷锛屽彈[涓嬫父鏋勪欢浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + pump.UpdatePropStatus(nameof(pump.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛屽彈[浣嶇疆淇℃伅]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); } else { - pump.EndElev = pump.EndPosition.Z; - pump.AppendOrUpdatePropStatus(nameof(pump.EndElev), ePropStatus.Lack, "[涓嬫父鏍囬珮]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + var center = pump.ConnectList?.GetCenterPosition(); + if (center != null) + { + pump.Elev = center.Z; + pump.UpdatePropStatus(nameof(pump.Elev), 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 @@ -5563,12 +4870,12 @@ pump.RatedQ = ratedQ; if (pump.RatedQ < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Lack, "[棰濆畾娴侀噺]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Lack, "[棰濆畾娴侀噺]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Abnormal, "[棰濆畾娴侀噺]缂哄皯鎴栬�呮牸寮忛敊璇�"); + pump.UpdatePropStatus(nameof(pump.RatedQ), ePropStatus.Abnormal, "[棰濆畾娴侀噺]缂哄皯鎴栬�呮牸寮忛敊璇�"); } #endregion @@ -5580,12 +4887,29 @@ pump.RatedH = ratedH; if (pump.RatedH < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedH), ePropStatus.Lack, "[棰濆畾鎵▼]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.RatedH), ePropStatus.Lack, "[棰濆畾鎵▼]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedH), ePropStatus.Abnormal, "[棰濆畾鎵▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + 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 @@ -5597,12 +4921,12 @@ pump.RatedN = ratedN; if (pump.RatedN < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedN), ePropStatus.Lack, "[棰濆畾杞�焆缂虹渷"); + pump.UpdatePropStatus(nameof(pump.RatedN), ePropStatus.Lack, "[棰濆畾杞�焆缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedN), ePropStatus.Abnormal, "[棰濆畾杞�焆缂哄皯鎴栬�呮牸寮忛敊璇�"); + pump.UpdatePropStatus(nameof(pump.RatedN), ePropStatus.Abnormal, "[棰濆畾杞�焆缂哄皯鎴栬�呮牸寮忛敊璇�"); } #endregion @@ -5614,18 +4938,18 @@ pump.RatedHz = ratedHz; if (pump.RatedHz < 1) { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[棰濆畾棰戠巼]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[棰濆畾棰戠巼]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Abnormal, "[棰濆畾棰戠巼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Abnormal, "[棰濆畾棰戠巼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } if (pump.RatedHz < 1) { pump.RatedHz = 50; - pump.AppendOrUpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[棰濆畾棰戠巼]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(50Hz)杩涜淇"); + pump.UpdatePropStatus(nameof(pump.RatedHz), ePropStatus.Lack, "[棰濆畾棰戠巼]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(50Hz)杩涜淇"); } #endregion @@ -5637,17 +4961,17 @@ pump.CurveQH = curveqh; if (string.IsNullOrEmpty(pump.CurveQH)) { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[娴侀噺鎵▼鏇茬嚎]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[娴侀噺鎵▼鏇茬嚎]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Abnormal, "缂哄皯[娴侀噺鎵▼鏇茬嚎]"); + pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Abnormal, "缂哄皯[娴侀噺鎵▼鏇茬嚎]"); } if (string.IsNullOrEmpty(pump.CurveQH)) { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[娴侀噺鎵▼鏇茬嚎]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(PumpDefault)杩涜淇"); + pump.UpdatePropStatus(nameof(pump.CurveQH), ePropStatus.Lack, "[娴侀噺鎵▼鏇茬嚎]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(PumpDefault)杩涜淇"); } #endregion @@ -5659,12 +4983,12 @@ pump.CurveQP = curveqp; if (string.IsNullOrEmpty(pump.CurveQP)) { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Lack, "[娴侀噺鍔熺巼鏇茬嚎]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Lack, "[娴侀噺鍔熺巼鏇茬嚎]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Abnormal, "缂哄皯[娴侀噺鍔熺巼鏇茬嚎]"); + pump.UpdatePropStatus(nameof(pump.CurveQP), ePropStatus.Abnormal, "缂哄皯[娴侀噺鍔熺巼鏇茬嚎]"); } #endregion @@ -5676,12 +5000,12 @@ pump.CurveQE = curveqe; if (string.IsNullOrEmpty(pump.CurveQE)) { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Lack, "[娴侀噺鏁堢巼鏇茬嚎]缂虹渷"); + pump.UpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Lack, "[娴侀噺鏁堢巼鏇茬嚎]缂虹渷"); } } else { - pump.AppendOrUpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Abnormal, "缂哄皯[娴侀噺鏁堢巼鏇茬嚎]"); + pump.UpdatePropStatus(nameof(pump.CurveQE), ePropStatus.Abnormal, "缂哄皯[娴侀噺鏁堢巼鏇茬嚎]"); } #endregion @@ -5695,7 +5019,7 @@ else { pump.SpeedRatio = 1; - pump.AppendOrUpdatePropStatus(nameof(pump.SpeedRatio), ePropStatus.Abnormal, "[杞�熸瘮]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(1)淇"); + pump.UpdatePropStatus(nameof(pump.SpeedRatio), ePropStatus.Abnormal, "[杞�熸瘮]缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(1)淇"); } #endregion @@ -5707,42 +5031,12 @@ pump.SpeedRatioPattern = speedRatioPattern; if (string.IsNullOrEmpty(pump.SpeedRatioPattern)) { - pump.AppendOrUpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Lack, "[杞�熸瘮妯″紡]缂虹渷"); + pump.UpdatePropStatus(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, "缂哄皯[浠锋牸妯″紡]"); + pump.UpdatePropStatus(nameof(pump.SpeedRatioPattern), ePropStatus.Abnormal, "缂哄皯[杞�熸瘮妯″紡]"); } #endregion @@ -5758,6 +5052,7 @@ return default; } var valve = new Model.RevitValve(); + valve.Catalog = RevitJsonCatalog.Valve; #region Id @@ -5767,25 +5062,7 @@ } 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, "缂哄皯[缂栫爜]"); + valve.UpdatePropStatus(nameof(valve.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); } #endregion @@ -5795,11 +5072,11 @@ if (jobject.ParseString(RevitJsonProp.Name, out string name)) { valve.Name = name; - valve.AppendOrUpdatePropStatus(nameof(valve.Name), ePropStatus.Lack, "[鍚嶇О]缂虹渷"); + valve.UpdatePropStatus(nameof(valve.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Name), ePropStatus.Error, "缂哄皯[鍚嶇О]"); + valve.UpdatePropStatus(nameof(valve.Name), ePropStatus.Error, "缂哄皯[鏋勪欢鍚嶇О]"); } #endregion @@ -5811,12 +5088,12 @@ valve.ModelType = modelType; if (string.IsNullOrEmpty(valve.ModelType)) { - valve.AppendOrUpdatePropStatus(nameof(valve.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + valve.UpdatePropStatus(nameof(valve.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); } } else { - valve.AppendOrUpdatePropStatus(nameof(valve.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + valve.UpdatePropStatus(nameof(valve.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); } #endregion @@ -5830,13 +5107,18 @@ { if (valve.Flags == null || valve.Flags.Count < 1) { - valve.AppendOrUpdatePropStatus(nameof(valve.Flags), ePropStatus.Abnormal, "[鏍囩]鏍煎紡閿欒"); + valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); } } } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缂哄皯[鏍囩]"); + valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (valve.Flags == null) + { + valve.Flags = new List<string>(); } #endregion @@ -5849,7 +5131,7 @@ } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + valve.UpdatePropStatus(nameof(valve.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); } #endregion @@ -5872,12 +5154,12 @@ }).ToList(); if (valve.ConnectList == null || valve.ConnectList.Count < 1) { - valve.AppendOrUpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + valve.UpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); } } else { - valve.AppendOrUpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + valve.UpdatePropStatus(nameof(valve.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); } #endregion @@ -5888,12 +5170,12 @@ valve.StartCode = startConnect?.Id; if (string.IsNullOrEmpty(valve.StartCode)) { - valve.AppendOrUpdatePropStatus(nameof(valve.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + valve.UpdatePropStatus(nameof(valve.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } valve.StartPosition = startConnect?.Position; if (valve.StartPosition == null) { - valve.AppendOrUpdatePropStatus(nameof(valve.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + valve.UpdatePropStatus(nameof(valve.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } #endregion @@ -5904,12 +5186,63 @@ valve.EndCode = endConnect?.Id; if (string.IsNullOrEmpty(valve.EndCode)) { - valve.AppendOrUpdatePropStatus(nameof(valve.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + valve.UpdatePropStatus(nameof(valve.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); } valve.EndPosition = endConnect?.Position; if (valve.EndPosition == null) { - valve.AppendOrUpdatePropStatus(nameof(valve.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + valve.UpdatePropStatus(nameof(valve.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].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; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + valve.Elev += facade / 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 @@ -5922,154 +5255,108 @@ if (string.IsNullOrEmpty(valve.LinkStatus)) { valve.LinkStatus = ValveStatus.Open; - valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Lack, "[闃�闂ㄧ姸鎬乚缂虹渷"); + valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Lack, "[闃�闂ㄧ姸鎬乚缂虹渷"); } else { if (!ValveStatus.Contains(valve.LinkStatus)) { valve.LinkStatus = ValveStatus.Open; - valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[闃�闂ㄧ姸鎬乚璁剧疆閿欒"); + valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[闃�闂ㄧ姸鎬乚璁剧疆閿欒"); } } } else { valve.LinkStatus = ValveStatus.Open; - valve.AppendOrUpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[闃�闂ㄧ姸鎬乚缂哄皯鎴栨牸寮忛敊璇�"); + valve.UpdatePropStatus(nameof(valve.LinkStatus), ePropStatus.Abnormal, "[闃�闂ㄧ姸鎬乚缂哄皯鎴栨牸寮忛敊璇�"); } #endregion - #region StartElev + #region Material - if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) + if (jobject.ParseString(RevitJsonProp.Material, out string material)) { - valve.StartElev = startElev / 1000f; - } - else - { - valve.AppendOrUpdatePropStatus(nameof(valve.StartElev), ePropStatus.Abnormal, "[涓婃父鏍囬珮]缂哄皯鎴栨牸寮忛敊璇�"); - } - - if (valve.StartElev <= 0) - { - //閫氳繃z杞磋嚜鍔ㄨ绠� - if (valve.StartPosition == null) + valve.Material = material; + if (string.IsNullOrEmpty(valve.Material)) { - 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, "[涓婃父鍒濆姘磋川]缂虹渷"); + valve.UpdatePropStatus(nameof(valve.Material), 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, "[涓嬫父鍒濆姘磋川]缂哄皯鎴栬�呮牸寮忛敊璇�"); + valve.UpdatePropStatus(nameof(valve.Material), ePropStatus.Abnormal, "缂哄皯[鏉愯川淇℃伅]"); } #endregion #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { valve.Diameter = diameter; } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞]缂哄皯鎴栬�呮牸寮忛敊璇�"); + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); } if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out diameter)) { - valve.Diameter = internalDiameter; - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞]閫氳繃[鍐呭緞]杩涜淇]"); + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); } } if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) + if (jobject[RevitJsonProp.DN].MatchNumeric(out diameter)) { - valve.Diameter = dn; - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞]閫氳繃[鍏О鐩村緞]杩涜淇]"); + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); } else { - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); } } if (valve.Diameter < 1) { - valve.Diameter = 500; - valve.AppendOrUpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + if (jobject[RevitJsonProp.MaxSize].MatchNumeric(out diameter)) + { + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鏈�澶у昂瀵竇杩涜淇]"); + } + else + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鏈�澶у昂瀵竇杩涜淇]"); + } + } + + if (valve.Diameter < 1) + { + if (jobject[RevitJsonProp.MinSize].MatchNumeric(out diameter)) + { + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鏈�灏忓昂瀵竇杩涜淇]"); + } + else + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鏈�灏忓昂瀵竇杩涜淇]"); + } + } + + if (valve.Diameter < 1) + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]瑙f瀽閿欒锛屾棤娉曢�氳繃[鍐呭緞][鍏О鐩村緞][鏈�澶у昂瀵竇[鏈�灏忓昂瀵竇淇"); } #endregion @@ -6082,7 +5369,26 @@ } else { - valve.AppendOrUpdatePropStatus(nameof(valve.MinorLoss), ePropStatus.Abnormal, "[灞�閮ㄩ樆鍔涚郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + 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, "[绮楃硻绯绘暟]瑙f瀽閿欒锛岄�氳繃榛樿鍊�(110)杩涜淇"); } #endregion @@ -6095,21 +5401,35 @@ if (string.IsNullOrEmpty(valve.ValveType)) { valve.ValveType = ValveType.GPV; - valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Lack, "[闃�闂ㄧ被鍨媇缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(GPV)杩涜淇"); + valve.UpdatePropStatus(nameof(valve.ValveType), ePropStatus.Lack, "[闃�闂ㄧ被鍨媇缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(GPV)杩涜淇"); } else { if (!ValveType.Contains(valve.ValveType)) { valve.ValveType = ValveType.GPV; - valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[闃�闂ㄧ被鍨媇璁剧疆閿欒锛屼娇鐢ㄩ粯璁ゅ��(GPV)杩涜淇"); + valve.UpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[闃�闂ㄧ被鍨媇璁剧疆閿欒锛屼娇鐢ㄩ粯璁ゅ��(GPV)杩涜淇"); } } } else { valve.ValveType = ValveType.GPV; - valve.AppendOrUpdatePropStatus(nameof(valve.ValveType), ePropStatus.Abnormal, "[闃�闂ㄧ被鍨媇缂哄皯鎴栨牸寮忛敊璇紝浣跨敤榛樿鍊�(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 @@ -6122,7 +5442,7 @@ } else { - valve.AppendOrUpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Abnormal, "[闃�闂ㄨ缃甝缂哄皯鎴栨牸寮忛敊璇�"); + valve.UpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Abnormal, "[闃�闂ㄨ缃甝缂哄皯鎴栨牸寮忛敊璇�"); } if (string.IsNullOrEmpty(valve.ValveSetting)) @@ -6130,13 +5450,675 @@ if (valve.ValveType == ValveType.GPV) { valve.ValveSetting = "GPVDefault"; - valve.AppendOrUpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Lack, "[闃�闂ㄨ缃甝缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(GPVDefault)杩涜淇"); + valve.UpdatePropStatus(nameof(valve.ValveSetting), ePropStatus.Lack, "[闃�闂ㄨ缃甝缂虹渷锛屼娇鐢ㄩ粯璁ゅ��(GPVDefault)杩涜淇"); } } #endregion return valve; + } + + //瑙f瀽鎹㈢儹鍣� + private static HStation.Model.RevitExchanger ParseExchanger(JToken jobject) + { + if (jobject == null) + { + return default; + } + + var exchanger = new Model.RevitExchanger(); + exchanger.Catalog = RevitJsonCatalog.Exchanger; + + #region Id + + if (jobject.ParseString(RevitJsonProp.Id, out string id)) + { + exchanger.Id = id; + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); + } + + #endregion + + #region Name + + if (jobject.ParseString(RevitJsonProp.Name, out string name)) + { + exchanger.Name = name; + exchanger.UpdatePropStatus(nameof(exchanger.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Name), ePropStatus.Error, "缂哄皯[鏋勪欢鍚嶇О]"); + } + + #endregion + + #region ModelType + + if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) + { + exchanger.ModelType = modelType; + if (string.IsNullOrEmpty(exchanger.ModelType)) + { + exchanger.UpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + } + + #endregion + + #region Flags + + if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) + { + exchanger.Flags = Yw.Untity.FlagsHelper.ToList(flags); + if (!string.IsNullOrEmpty(flags)) + { + if (exchanger.Flags == null || exchanger.Flags.Count < 1) + { + exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); + } + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (exchanger.Flags == null) + { + exchanger.Flags = new List<string>(); + } + + #endregion + + #region Description + + if (jobject.ParseString(RevitJsonProp.Description, out string description)) + { + exchanger.Description = description; + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + } + + #endregion + + #region ConnectList + + if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) + { + var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); + exchanger.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 (exchanger.ConnectList == null || exchanger.ConnectList.Count < 1) + { + exchanger.UpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + } + + #endregion + + #region StartCode/StartPosition + + var startConnect = exchanger.ConnectList?.GetStartConnect(); + exchanger.StartCode = startConnect?.Id; + if (string.IsNullOrEmpty(exchanger.StartCode)) + { + exchanger.UpdatePropStatus(nameof(exchanger.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + exchanger.StartPosition = startConnect?.Position; + if (exchanger.StartPosition == null) + { + exchanger.UpdatePropStatus(nameof(exchanger.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + + #endregion + + #region EndCode/EndPosition + + var endConnect = exchanger.ConnectList?.GetEndConnect(); + exchanger.EndCode = endConnect?.Id; + if (string.IsNullOrEmpty(exchanger.EndCode)) + { + exchanger.UpdatePropStatus(nameof(exchanger.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + exchanger.EndPosition = endConnect?.Position; + if (exchanger.EndPosition == null) + { + exchanger.UpdatePropStatus(nameof(exchanger.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + + #endregion + + #region LinkStatus + + if (jobject.ParseString(RevitJsonProp.LinkStatusSwitch, out string linkStatus)) + { + exchanger.LinkStatus = linkStatus; + if (string.IsNullOrEmpty(exchanger.LinkStatus)) + { + exchanger.LinkStatus = ValveStatus.Open; + exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Lack, "[寮�鍏崇姸鎬乚缂虹渷"); + } + else + { + if (!ValveStatus.Contains(exchanger.LinkStatus)) + { + exchanger.LinkStatus = ValveStatus.Open; + exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[寮�鍏崇姸鎬乚璁剧疆閿欒"); + } + } + } + else + { + exchanger.LinkStatus = ValveStatus.Open; + exchanger.UpdatePropStatus(nameof(exchanger.LinkStatus), ePropStatus.Abnormal, "[寮�鍏崇姸鎬乚缂哄皯鎴栨牸寮忛敊璇�"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) + { + exchanger.Elev = elev; + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Abnormal, "[鏍囬珮淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (exchanger.Elev <= 0) + { + if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) + { + exchanger.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + exchanger.Elev += facade / 1000f; + } + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + } + + if (exchanger.Elev <= 0) + { + //閫氳繃z杞磋嚜鍔ㄨ绠� + if (exchanger.StartPosition == null || exchanger.EndPosition == null) + { + exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛屽彈[浣嶇疆淇℃伅]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + else + { + var center = exchanger.ConnectList?.GetCenterPosition(); + if (center != null) + { + exchanger.Elev = center.Z; + exchanger.UpdatePropStatus(nameof(exchanger.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + } + } + + #endregion + + #region Material + + if (jobject.ParseString(RevitJsonProp.Material, out string material)) + { + exchanger.Material = material; + if (string.IsNullOrEmpty(exchanger.Material)) + { + exchanger.UpdatePropStatus(nameof(exchanger.Material), ePropStatus.Lack, "[鏉愯川淇℃伅]缂虹渷"); + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Material), ePropStatus.Abnormal, "缂哄皯[鏉愯川淇℃伅]"); + } + + #endregion + + #region Diameter + + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) + { + exchanger.Diameter = diameter; + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (exchanger.Diameter < 1) + { + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + { + exchanger.Diameter = internalDiameter; + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); + } + } + + if (exchanger.Diameter < 1) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) + { + exchanger.Diameter = dn; + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); + } + } + + if (exchanger.Diameter < 1) + { + exchanger.Diameter = 1000; + exchanger.UpdatePropStatus(nameof(exchanger.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(1000mm)淇]"); + } + + #endregion + + #region MinorLoss + + if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) + { + exchanger.MinorLoss = minorLoss; + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region CurveQL + + if (jobject.ParseString(RevitJsonProp.CurveQL, out string curveql)) + { + exchanger.CurveQL = curveql; + if (string.IsNullOrEmpty(exchanger.CurveQL)) + { + exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Lack, "[姘村ご鎹熷け鏇茬嚎]缂虹渷"); + } + } + else + { + exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Abnormal, "缂哄皯[姘村ご鎹熷け鏇茬嚎]"); + } + + if (string.IsNullOrEmpty(exchanger.CurveQL)) + { + exchanger.UpdatePropStatus(nameof(exchanger.CurveQL), ePropStatus.Lack, "[姘村ご鎹熷け鏇茬嚎]缂虹渷锛屾湡寰呬骇鍝佸尮閰嶆椂淇"); + } + + #endregion + + return exchanger; + } + + //瑙f瀽绌哄帇鏈� + private static HStation.Model.RevitCompressor ParseCompressor(JToken jobject) + { + if (jobject == null) + { + return default; + } + + var compressor = new Model.RevitCompressor(); + compressor.Catalog = RevitJsonCatalog.Compressor; + + #region Id + + if (jobject.ParseString(RevitJsonProp.Id, out string id)) + { + compressor.Id = id; + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); + } + + #endregion + + #region Name + + if (jobject.ParseString(RevitJsonProp.Name, out string name)) + { + compressor.Name = name; + compressor.UpdatePropStatus(nameof(compressor.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Name), ePropStatus.Error, "缂哄皯[鏋勪欢鍚嶇О]"); + } + + #endregion + + #region ModelType + + if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) + { + compressor.ModelType = modelType; + if (string.IsNullOrEmpty(compressor.ModelType)) + { + compressor.UpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + } + + #endregion + + #region Flags + + if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) + { + compressor.Flags = Yw.Untity.FlagsHelper.ToList(flags); + if (!string.IsNullOrEmpty(flags)) + { + if (compressor.Flags == null || compressor.Flags.Count < 1) + { + compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); + } + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (compressor.Flags == null) + { + compressor.Flags = new List<string>(); + } + + #endregion + + #region Description + + if (jobject.ParseString(RevitJsonProp.Description, out string description)) + { + compressor.Description = description; + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + } + + #endregion + + #region ConnectList + + if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) + { + var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); + compressor.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 (compressor.ConnectList == null || compressor.ConnectList.Count < 1) + { + compressor.UpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + } + + #endregion + + #region StartCode/StartPosition + + var startConnect = compressor.ConnectList?.GetStartConnect(); + compressor.StartCode = startConnect?.Id; + if (string.IsNullOrEmpty(compressor.StartCode)) + { + compressor.UpdatePropStatus(nameof(compressor.StartCode), ePropStatus.Error, "[涓婃父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + compressor.StartPosition = startConnect?.Position; + if (compressor.StartPosition == null) + { + compressor.UpdatePropStatus(nameof(compressor.StartPosition), ePropStatus.Error, "[涓婃父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + + #endregion + + #region EndCode/EndPosition + + var endConnect = compressor.ConnectList?.GetEndConnect(); + compressor.EndCode = endConnect?.Id; + if (string.IsNullOrEmpty(compressor.EndCode)) + { + compressor.UpdatePropStatus(nameof(compressor.EndCode), ePropStatus.Error, "[涓嬫父鏋勪欢]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + compressor.EndPosition = endConnect?.Position; + if (compressor.EndPosition == null) + { + compressor.UpdatePropStatus(nameof(compressor.EndPosition), ePropStatus.Error, "[涓嬫父鏋勪欢浣嶇疆]鍙梉杩炴帴鍒楄〃]褰卞搷瑙f瀽閿欒"); + } + + #endregion + + #region LinkStatus + + if (jobject.ParseString(RevitJsonProp.LinkStatusSwitch, out string linkStatus)) + { + compressor.LinkStatus = linkStatus; + if (string.IsNullOrEmpty(compressor.LinkStatus)) + { + compressor.LinkStatus = ValveStatus.Open; + compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Lack, "[寮�鍏崇姸鎬乚缂虹渷"); + } + else + { + if (!ValveStatus.Contains(compressor.LinkStatus)) + { + compressor.LinkStatus = ValveStatus.Open; + compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[寮�鍏崇姸鎬乚璁剧疆閿欒"); + } + } + } + else + { + compressor.LinkStatus = ValveStatus.Open; + compressor.UpdatePropStatus(nameof(compressor.LinkStatus), ePropStatus.Abnormal, "[寮�鍏崇姸鎬乚缂哄皯鎴栨牸寮忛敊璇�"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) + { + compressor.Elev = elev; + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Abnormal, "[鏍囬珮淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (compressor.Elev <= 0) + { + if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) + { + compressor.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + compressor.Elev += facade / 1000f; + } + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + } + + if (compressor.Elev <= 0) + { + //閫氳繃z杞磋嚜鍔ㄨ绠� + if (compressor.StartPosition == null || compressor.EndPosition == null) + { + compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛屽彈[浣嶇疆淇℃伅]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + else + { + var center = compressor.ConnectList?.GetCenterPosition(); + if (center != null) + { + compressor.Elev = center.Z; + compressor.UpdatePropStatus(nameof(compressor.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + } + } + + #endregion + + #region Material + + if (jobject.ParseString(RevitJsonProp.Material, out string material)) + { + compressor.Material = material; + if (string.IsNullOrEmpty(compressor.Material)) + { + compressor.UpdatePropStatus(nameof(compressor.Material), ePropStatus.Lack, "[鏉愯川淇℃伅]缂虹渷"); + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Material), ePropStatus.Abnormal, "缂哄皯[鏉愯川淇℃伅]"); + } + + #endregion + + #region Diameter + + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) + { + compressor.Diameter = diameter; + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (compressor.Diameter < 1) + { + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + { + compressor.Diameter = internalDiameter; + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); + } + } + + if (compressor.Diameter < 1) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) + { + compressor.Diameter = dn; + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); + } + else + { + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); + } + } + + if (compressor.Diameter < 1) + { + compressor.Diameter = 1000; + compressor.UpdatePropStatus(nameof(compressor.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(1000mm)淇]"); + } + + #endregion + + #region MinorLoss + + if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) + { + compressor.MinorLoss = minorLoss; + } + else + { + compressor.UpdatePropStatus(nameof(compressor.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region CurveQL + + if (jobject.ParseString(RevitJsonProp.CurveQL, out string curveql)) + { + compressor.CurveQL = curveql; + if (string.IsNullOrEmpty(compressor.CurveQL)) + { + compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Lack, "[姘村ご鎹熷け鏇茬嚎]缂虹渷"); + } + } + else + { + compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Abnormal, "缂哄皯[姘村ご鎹熷け鏇茬嚎]"); + } + + if (string.IsNullOrEmpty(compressor.CurveQL)) + { + compressor.UpdatePropStatus(nameof(compressor.CurveQL), ePropStatus.Lack, "[姘村ご鎹熷け鏇茬嚎]缂虹渷锛屾湡寰呬骇鍝佸尮閰嶆椂淇"); + } + + #endregion + + return compressor; } //瑙f瀽瑁呴グ浠� @@ -6154,19 +6136,6 @@ 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 -- Gitblit v1.9.3