duheng
2024-08-29 b7fd723cf65d323b50a2219f57bf3fee3c2402bb
Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs
@@ -69,6 +69,10 @@
                                    reservoir.Head = head;
                                }
                                reservoir.HeadPattern = jobject[RevitJsonProp.HeadPattern].ToString();
                                if (!string.IsNullOrEmpty(reservoir.HeadPattern))
                                {
                                    reservoir.HeadPattern = string.Empty;
                                }
                                model.Reservoirs.Add(reservoir);
                            }
                            break;
@@ -127,6 +131,10 @@
                                    tank.MinVol = minVol;
                                }
                                tank.VolCurve = jobject[RevitJsonProp.VolCurve].ToString();
                                if (!string.IsNullOrEmpty(tank.VolCurve))
                                {
                                    tank.VolCurve = string.Empty;
                                }
                                model.Tanks.Add(tank);
                            }
                            break;
@@ -185,6 +193,10 @@
                                    waterbox.MinVol = minVol;
                                }
                                waterbox.VolCurve = jobject[RevitJsonProp.VolCurve].ToString();
                                if (!string.IsNullOrEmpty(waterbox.VolCurve))
                                {
                                    waterbox.VolCurve = string.Empty;
                                }
                                model.Waterboxs.Add(waterbox);
                            }
                            break;
@@ -227,6 +239,10 @@
                                    junction.Demand = demand;
                                }
                                junction.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(junction.DemandPattern))
                                {
                                    junction.DemandPattern = string.Empty;
                                }
                                model.Junctions.Add(junction);
                            }
                            break;
@@ -269,6 +285,10 @@
                                    elbow.Demand = demand;
                                }
                                elbow.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(elbow.DemandPattern))
                                {
                                    elbow.DemandPattern = string.Empty;
                                }
                                model.Elbows.Add(elbow);
                            }
                            break;
@@ -311,6 +331,10 @@
                                    threelink.Demand = demand;
                                }
                                threelink.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(threelink.DemandPattern))
                                {
                                    threelink.DemandPattern = string.Empty;
                                }
                                model.Threelinks.Add(threelink);
                            }
                            break;
@@ -353,6 +377,10 @@
                                    fourlink.Demand = demand;
                                }
                                fourlink.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(fourlink.DemandPattern))
                                {
                                    fourlink.DemandPattern = string.Empty;
                                }
                                model.Fourlinks.Add(fourlink);
                            }
                            break;
@@ -395,6 +423,10 @@
                                    meter.Demand = demand;
                                }
                                meter.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(meter.DemandPattern))
                                {
                                    meter.DemandPattern = string.Empty;
                                }
                                model.Meters.Add(meter);
                            }
                            break;
@@ -437,6 +469,10 @@
                                    flowmeter.Demand = demand;
                                }
                                flowmeter.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(flowmeter.DemandPattern))
                                {
                                    flowmeter.DemandPattern = string.Empty;
                                }
                                model.Flowmeters.Add(flowmeter);
                            }
                            break;
@@ -479,6 +515,10 @@
                                    pressmeter.Demand = demand;
                                }
                                pressmeter.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(pressmeter.DemandPattern))
                                {
                                    pressmeter.DemandPattern = string.Empty;
                                }
                                model.Pressmeters.Add(pressmeter);
                            }
                            break;
@@ -521,6 +561,10 @@
                                    blunthead.Demand = demand;
                                }
                                blunthead.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(blunthead.DemandPattern))
                                {
                                    blunthead.DemandPattern = string.Empty;
                                }
                                model.Bluntheads.Add(blunthead);
                            }
                            break;
@@ -563,6 +607,10 @@
                                    nozzle.Demand = demand;
                                }
                                nozzle.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(nozzle.DemandPattern))
                                {
                                    nozzle.DemandPattern = string.Empty;
                                }
                                if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffient))
                                {
                                    nozzle.Coefficient = coeffient;
@@ -609,6 +657,10 @@
                                    hydrant.Demand = demand;
                                }
                                hydrant.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString();
                                if (!string.IsNullOrEmpty(hydrant.DemandPattern))
                                {
                                    hydrant.DemandPattern = string.Empty;
                                }
                                if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffient))
                                {
                                    hydrant.Coefficient = coeffient;
@@ -921,17 +973,30 @@
                                    pump.RatedPower = ratedPower;
                                }
                                pump.CurveQH = jobject[RevitJsonProp.CurveQH].ToString();
                                pump.CurveQH = "PumpDefault";
                                if (jobject[RevitJsonProp.SpeedRatio].MatchNumeric(out double speedRatio))
                                {
                                    pump.SpeedRatio = speedRatio;
                                }
                                pump.SpeedRatioPattern = jobject[RevitJsonProp.SpeedRatioPattern].ToString();
                                if (!string.IsNullOrEmpty(pump.SpeedRatioPattern))
                                {
                                    pump.SpeedRatioPattern = string.Empty;
                                }
                                if (jobject[RevitJsonProp.Price].MatchNumeric(out double price))
                                {
                                    pump.Price = price;
                                }
                                pump.PricePattern = jobject[RevitJsonProp.PricePattern].ToString();
                                if (!string.IsNullOrEmpty(pump.PricePattern))
                                {
                                    pump.PricePattern = string.Empty;
                                }
                                pump.CurveQE = jobject[RevitJsonProp.CurveQE].ToString();
                                if (!string.IsNullOrEmpty(pump.CurveQE))
                                {
                                    pump.CurveQE = string.Empty;
                                }
                                model.Pumps.Add(pump);
                            }
                            break;
@@ -997,7 +1062,17 @@
                                model.Valves.Add(valve);
                            }
                            break;
                        case RevitJsonCatalog.Other:
                            {
                                var decorator = new Model.RevitDecorator();
                                decorator.Id = jobject[RevitJsonProp.Id].ToString();
                                decorator.Name = string.Empty;
                                decorator.Category = jobject[RevitJsonProp.ClanAndType][RevitJsonProp.ClanName].ToString();
                                decorator.Decoration = string.Empty;
                                decorator.Decoration = string.Empty;
                                model.Decorators.Add(decorator);
                            }
                            break;
                        default: break;
                    }
                }