Prechádzať zdrojové kódy

mxg:提取部件获取关联设备方法

mengxiangge 6 rokov pred
rodič
commit
0233d19878

+ 1 - 5
MBI/SAGA.MBI/DataArrange/DalEquipPart.cs

@@ -74,11 +74,7 @@ namespace SAGA.MBI.DataArrange
         /// <returns></returns>
         public static MEquipment GetPartParentElement(Element element)
         {
-            string code = element?.GetFamily().Name.Substring(0, 4); ;
-            if (code.IsNullOrEmpty()) return null;
-            //构件所关联的设备
-            var parentInst = element.Document.GetElements(new ElementIntersectsElementFilter(element))
-                .FirstOrDefault(t =>  !t.Id.IsEqual(element.Id) && t.GetFamilyCode() == code);
+            var parentInst = element.GetEquipPartParent();
             if (parentInst == null) return null;
             var equip = DalEquip.GetEquipment(parentInst);
             return equip;

+ 14 - 5
MBI/SAGA.MBI/Extend/ElementExtend.cs

@@ -201,11 +201,6 @@ namespace SAGA.MBI.Tools
                 //移除前面和后面的空格
                 code = code.Trim();
             }
-            else if (element is Wall wall)
-            {
-                if (wall.IsCurtaiWall())
-                    code = MBIConst.CurtainWallCode;
-            }
 
             return code;
         }
@@ -255,5 +250,19 @@ namespace SAGA.MBI.Tools
 
             return space;
         }
+        /// <summary>
+        /// 获取部件所关联的设备
+        /// </summary>
+        /// <param name="element"></param>
+        /// <returns></returns>
+        public static Element GetEquipPartParent(this Element element)
+        {
+            string code = element?.GetFamily().Name.Substring(0, 4); ;
+            if (code.IsNullOrEmpty()) return null;
+            //构件所关联的设备
+            var parentInst = element.Document.GetElements(new ElementIntersectsElementFilter(element))
+                .FirstOrDefault(t => !t.Id.IsEqual(element.Id) && t.GetFamilyCode() == code);
+            return parentInst;
+        }
     }
 }

+ 1 - 1
MBI/SAGA.Models/MBIItem/MBIBuiltInParameter.cs

@@ -83,7 +83,7 @@ namespace SAGA.Models
         /// <summary>
         /// 维修商
         /// </summary>
-        public readonly static string Maintainer = "	Maintainer";
+        public readonly static string Maintainer = "Maintainer";
         /// <summary>
         /// 保险商
         /// </summary>