From e7df5d1ece7ecabaa7a3943f24a6621649fdc455 Mon Sep 17 00:00:00 2001 From: duheng <2784771470@qq.com> Date: 星期一, 13 一月 2025 16:08:11 +0800 Subject: [PATCH] 增加批量添加,修改阀门界面 --- Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 211 insertions(+), 22 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 39efafe..4897d85 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 @@ -372,6 +372,10 @@ { reservoir.UpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (reservoir.Flags == null) + { + reservoir.Flags = new List<string>(); + } #endregion @@ -569,6 +573,11 @@ else { tank.UpdatePropStatus(nameof(tank.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (tank.Flags == null) + { + tank.Flags = new List<string>(); } #endregion @@ -844,6 +853,11 @@ waterbox.UpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (waterbox.Flags == null) + { + waterbox.Flags = new List<string>(); + } + #endregion #region Description @@ -1117,6 +1131,11 @@ junction.UpdatePropStatus(nameof(junction.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (junction.Flags == null) + { + junction.Flags = new List<string>(); + } + #endregion #region Description @@ -1328,6 +1347,11 @@ blunthead.UpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (blunthead.Flags == null) + { + blunthead.Flags = new List<string>(); + } + #endregion #region Description @@ -1443,7 +1467,14 @@ { blunthead.Caliber = caliber; } - else + 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緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -1570,6 +1601,11 @@ elbow.UpdatePropStatus(nameof(elbow.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (elbow.Flags == null) + { + elbow.Flags = new List<string>(); + } + #endregion #region Description @@ -1685,7 +1721,14 @@ { elbow.Caliber = caliber; } - else + 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緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -1739,7 +1782,7 @@ if (jobject[RevitJsonProp.BendingAngle].MatchNumeric(out double bendingAngle)) { - elbow.BendingAngle = bendingAngle; + elbow.BendingAngle = (int)bendingAngle; } else { @@ -1839,6 +1882,11 @@ else { threelink.UpdatePropStatus(nameof(threelink.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (threelink.Flags == null) + { + threelink.Flags = new List<string>(); } #endregion @@ -1956,7 +2004,14 @@ { threelink.Caliber = caliber; } - else + 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緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -2108,6 +2163,11 @@ fourlink.UpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (fourlink.Flags == null) + { + fourlink.Flags = new List<string>(); + } + #endregion #region Description @@ -2223,7 +2283,14 @@ { fourlink.Caliber = caliber; } - else + 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緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -2347,6 +2414,11 @@ else { nozzle.UpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (nozzle.Flags == null) + { + nozzle.Flags = new List<string>(); } #endregion @@ -2620,6 +2692,11 @@ hydrant.UpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (hydrant.Flags == null) + { + hydrant.Flags = new List<string>(); + } + #endregion #region Description @@ -2884,6 +2961,11 @@ else { cooling.UpdatePropStatus(nameof(cooling.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (cooling.Flags == null) + { + cooling.Flags = new List<string>(); } #endregion @@ -3169,6 +3251,11 @@ meter.UpdatePropStatus(nameof(meter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (meter.Flags == null) + { + meter.Flags = new List<string>(); + } + #endregion #region Description @@ -3378,6 +3465,11 @@ else { flowmeter.UpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (flowmeter.Flags == null) + { + flowmeter.Flags = new List<string>(); } #endregion @@ -3604,6 +3696,11 @@ pressmeter.UpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (pressmeter.Flags == null) + { + pressmeter.Flags = new List<string>(); + } + #endregion #region Description @@ -3784,7 +3881,10 @@ if (jobject.ParseString(RevitJsonProp.Name, out string name)) { pipe.Name = name; - pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + if (string.IsNullOrEmpty(pipe.Name)) + { + pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } } else { @@ -3814,7 +3914,7 @@ 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) @@ -3826,6 +3926,11 @@ else { pipe.UpdatePropStatus(nameof(pipe.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pipe.Flags == null) + { + pipe.Flags = new List<string>(); } #endregion @@ -3949,7 +4054,8 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + //鐩村緞淇℃伅 + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { pipe.Diameter = diameter; } @@ -3958,11 +4064,26 @@ 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.Diameter = diameter; + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鐩村緞]杩涜淇]"); + } + else + { + 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 @@ -3971,6 +4092,7 @@ } } + //鍏О鐩村緞 if (pipe.Diameter < 1) { if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) @@ -3986,8 +4108,7 @@ if (pipe.Diameter < 1) { - pipe.Diameter = 500; - pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Error, "[鐩村緞淇℃伅]瑙f瀽閿欒锛屾棤娉曢�氳繃銆愮洿寰勩�戙�愬唴寰勩�戙�愬叕绉扮洿寰勩�戜慨澶�"); } #endregion @@ -4123,6 +4244,11 @@ else { translation.UpdatePropStatus(nameof(translation.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (translation.Flags == null) + { + translation.Flags = new List<string>(); } #endregion @@ -4289,7 +4415,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { translation.Diameter = diameter; } @@ -4328,6 +4454,24 @@ { 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 @@ -4462,6 +4606,11 @@ else { pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pump.Flags == null) + { + pump.Flags = new List<string>(); } #endregion @@ -4862,6 +5011,11 @@ valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (valve.Flags == null) + { + valve.Flags = new List<string>(); + } + #endregion #region Description @@ -5026,7 +5180,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { valve.Diameter = diameter; } @@ -5037,9 +5191,9 @@ if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out diameter)) { - valve.Diameter = internalDiameter; + valve.Diameter = diameter; valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); } else @@ -5050,9 +5204,9 @@ if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) + if (jobject[RevitJsonProp.DN].MatchNumeric(out diameter)) { - valve.Diameter = dn; + valve.Diameter = diameter; valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); } else @@ -5063,8 +5217,33 @@ if (valve.Diameter < 1) { - valve.Diameter = 500; - valve.UpdatePropStatus(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 @@ -5240,6 +5419,11 @@ exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (exchanger.Flags == null) + { + exchanger.Flags = new List<string>(); + } + #endregion #region Description @@ -5404,7 +5588,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { exchanger.Diameter = diameter; } @@ -5556,6 +5740,11 @@ else { compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (compressor.Flags == null) + { + compressor.Flags = new List<string>(); } #endregion @@ -5722,7 +5911,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { compressor.Diameter = diameter; } -- Gitblit v1.9.3