From 083c4e47c7a59025f3348bd093693c6b3febb014 Mon Sep 17 00:00:00 2001
From: duheng <2784771470@qq.com>
Date: 星期三, 16 十月 2024 10:03:31 +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/02-correct/RevitCorrectHelper.cs |   45 +++++++++++++++++++++++++++++----------------
 1 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/Service/HStation.Service.Revit.Core/04-service/02-correct/RevitCorrectHelper.cs b/Service/HStation.Service.Revit.Core/04-service/02-correct/RevitCorrectHelper.cs
index dab1a35..d8fec0b 100644
--- a/Service/HStation.Service.Revit.Core/04-service/02-correct/RevitCorrectHelper.cs
+++ b/Service/HStation.Service.Revit.Core/04-service/02-correct/RevitCorrectHelper.cs
@@ -1,6 +1,4 @@
 锘縰sing HStation.Model;
-using Microsoft.VisualBasic;
-using System;
 
 namespace HStation.Service
 {
@@ -10,9 +8,8 @@
     public static class RevitCorrectHelper
     {
         /// <summary>
-        /// 淇(鏃犳硶淇浼氭姏鍑哄紓甯�)
+        /// 淇
         /// </summary>
-        /// <param name="rhs">RevitModel</param>
         public static bool Correct(this Model.RevitModel rhs, out string msg)
         {
             if (rhs == null)
@@ -47,7 +44,7 @@
         private static bool Zero(Model.RevitModel rhs, out string msg)
         {
             msg = string.Empty;
-            var allWaterSourceList = rhs.GetAllWaterSources();
+            var allWaterSourceList = rhs.GetAllSources();
             if (allWaterSourceList == null || allWaterSourceList.Count < 1)
             {
                 msg = "鏃犳按婧�";
@@ -152,13 +149,29 @@
                 {
                     if (exchanger.ConnectList != null && exchanger.ConnectList.Count > 0)
                     {
-                        foreach (var connect in exchanger.ConnectList)
+                        foreach (var connect in exchanger.ConnectList.ToList())
                         {
                             var connectParter = allParterList.Find(x => x.Id == connect.Id);
                             if (connectParter == null)
                             {
-                                msg = $"鎹㈢儹鍣細{exchanger.Id} 杩炴帴缁勪欢 {connect.Id} 涓嶅瓨鍦�";
-                                return false;
+                                exchanger.ConnectList.Remove(connect);
+                            }
+                            else
+                            {
+                                if (connectParter is RevitBlunthead blunthead)
+                                {
+                                    var decorator = new Model.RevitDecorator();
+                                    decorator.Id = blunthead.Id;
+                                    decorator.Code = blunthead.Code;
+                                    decorator.Name = blunthead.Name;
+                                    decorator.Category = RevitJsonCatalog.Blunthead;
+                                    decorator.Decoration = null;
+                                    decorator.Description = blunthead.Description;
+                                    rhs.Decorators.Add(decorator);
+
+                                    rhs.Bluntheads.Remove(blunthead);
+                                    allParterList.Remove(connectParter);
+                                }
                             }
                         }
 
@@ -185,7 +198,7 @@
                         foreach (var startConnect in startConnectList)
                         {
                             var startConnectParter = allParterList.Find(x => x.Id == startConnect.Id);
-                            if (startConnectParter is IRevitLink revitLink)
+                            if (startConnectParter is RevitLink revitLink)
                             {
                                 if (revitLink.StartCode == exchanger.Id)
                                 {
@@ -222,7 +235,7 @@
                         foreach (var endConnect in endConnectList)
                         {
                             var endConnectParter = allParterList.Find(x => x.Id == endConnect.Id);
-                            if (endConnectParter is IRevitLink revitLink)
+                            if (endConnectParter is RevitLink revitLink)
                             {
                                 if (revitLink.StartCode == exchanger.Id)
                                 {
@@ -276,7 +289,7 @@
             foreach (var link in allLinks)
             {
                 var startLinkParter = allParterList.Find(x => x.Code == link.StartCode);
-                if (startLinkParter is IRevitLink startLink)
+                if (startLinkParter is RevitLink startLink)
                 {
                     var junction = new Model.RevitJunction();
                     junction.Id = Yw.Untity.UniqueHelper.CreateFromFirst("junction", allParterList.Select(x => x.Code).ToList());
@@ -293,11 +306,11 @@
                     rhs.Junctions.Add(junction);
                     link.StartCode = junction.Code;
 
-                    if (startLink.StartCode == link.StartCode)
+                    if (startLink.StartCode == link.Code)
                     {
                         startLink.StartCode = junction.Code;
                     }
-                    else if (startLink.EndCode == link.StartCode)
+                    else if (startLink.EndCode == link.Code)
                     {
                         startLink.EndCode = junction.Code;
                     }
@@ -305,7 +318,7 @@
                 }
 
                 var endLinkParter = allParterList.Find(x => x.Code == link.EndCode);
-                if (endLinkParter is IRevitLink endLink)
+                if (endLinkParter is RevitLink endLink)
                 {
                     var junction = new Model.RevitJunction();
                     junction.Id = Yw.Untity.UniqueHelper.CreateFromFirst("junction", allParterList.Select(x => x.Code).ToList());
@@ -321,11 +334,11 @@
                     junction.DemandPattern = null;
                     rhs.Junctions.Add(junction);
                     link.EndCode = junction.Code;
-                    if (endLink.StartCode == link.EndCode)
+                    if (endLink.StartCode == link.Code)
                     {
                         endLink.StartCode = junction.Code;
                     }
-                    else if (endLink.EndCode == link.EndCode)
+                    else if (endLink.EndCode == link.Code)
                     {
                         endLink.EndCode = junction.Code;
                     }

--
Gitblit v1.9.3