فهرست منبع

mxg:修正垃圾数据检查BIMId格式不正确报错bug

mengxiangge 6 سال پیش
والد
کامیت
7940f468b3

+ 1 - 0
MBI/SAGA.MBI/DataArrange/DalCommon.cs

@@ -447,6 +447,7 @@ namespace SAGA.MBI.DataArrange
             if (rbase == null)
             {
                 string floorId = bimId.GetFloorId();
+                if (floorId.IsNullOrEmpty()) return rbase;
                 string buildingId = DalProjectTree.GetBuildingIdByFloor(floorId);
                 m_AllRevitObjects = CommonConvert.CacheAllData(buildingId);
                 rbase = m_AllRevitObjects.FirstOrDefault(t => t.BimID == bimId);

+ 1 - 0
MBI/SAGA.MBI/DataArrange/DalSpace.cs

@@ -90,6 +90,7 @@ namespace SAGA.MBI.DataArrange
         {
             MISpace mSpace = null;
             var spaceId = RelationConvert.GetSpaceByRelationElementInSpace(equipId);
+
             mSpace = DalCommon.QueryObjectById(spaceId) as MISpace;
             return mSpace;
         }

+ 3 - 1
MBI/SAGA.MBI/Extend/StringExtend.cs

@@ -56,6 +56,7 @@ namespace SAGA.MBI.Tools
         /// <returns></returns>
         public static bool IsOnlyDutyNoModelBIMID(this string cbimId)
         {
+            if (cbimId == null) return true;
             var strs = cbimId.Split(':');
             return strs.Length != 2;
         }
@@ -66,7 +67,8 @@ namespace SAGA.MBI.Tools
         /// <returns></returns>
         public static string GetFloorId(this string cbimId)
         {
-            string bimId = cbimId;
+            if (cbimId == null) return cbimId;
+            string bimId = "";
             var strs = cbimId.Split(':');
             if (strs.Length > 1)
                 bimId = strs[0];

+ 1 - 0
MBI/SAGA.MBI/JsonConvert/CommonConvert.cs

@@ -193,6 +193,7 @@ namespace SAGA.MBI.RequestData
         /// <returns></returns>
         public static MRevitEquipBase QueryObjectById(string id)
         {
+            if (id.IsNullOrEmpty()) return null;
             string json = CommonRequest.QueryObjectById(id);
             if (!json.IsRequestHasItem()) return null;
             JObject jObject = JObject.Parse(json);

+ 1 - 1
MBI/SAGA.MBI/ToolsData/CorrectLossDuty.cs

@@ -170,7 +170,7 @@ namespace SAGA.MBI.ToolsData
             {
                 context.MEquipmentParts.Remove(equip);
             }
-            var nobimdutyBeacons = context.MBeacons.Where(t => t.BimID.IsOnlyDutyNoModelBIMID()).ToList();
+            var nobimdutyBeacons = context.MBeacons.Where(t =>  t.BimID.IsOnlyDutyNoModelBIMID()).ToList();
             foreach (var equip in nobimdutyBeacons)
             {
                 context.MBeacons.Remove(equip);

+ 5 - 3
MBI/SAGA.MBI/ToolsData/DataCheck/BIMDuplicationCheck.cs

@@ -87,8 +87,10 @@ namespace SAGA.MBI.ToolsData.DataCheck
             try
             {
                 string bimid = group.Key;
-                string revitId=bimid.GetBIMID().ToString();
+                var revitId=bimid.GetBIMID();
+                if (revitId == 0) return list;
                 string floorId = bimid.GetFloorId();
+                if (floorId.IsNullOrEmpty()) return list;
                 string floorName = DalProjectTree.GetFloorNameByFloorId(floorId);
                 foreach (MRevitEquipBase equipBase in group)
                 {
@@ -96,14 +98,14 @@ namespace SAGA.MBI.ToolsData.DataCheck
                     result.FloorName = floorName;
                     result.DutyId = equipBase.Id;
                     result.DutyName = equipBase.ToString();
-                    result.BIMID = revitId;
+                    result.BIMID = revitId.ToString();
                     result.IsRight = false;
                     list.Add(result);
                 }
             }
             catch (Exception e)
             {
-                Console.WriteLine(e);
+                MessageShowBase.Show(e);;
             }
             finally
             {

+ 1 - 0
MBI/SAGA.MBI/ToolsData/DataCheck/DutyModeCodeDiffCheck.cs

@@ -61,6 +61,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
             var floors = DalProjectTree.GetSelectedFloors(true);
             foreach (var mfloor in floors)
             {
+                if (mfloor.IsMissFile) continue;
                 Results.AddRange(GetCheckResult(mfloor));
             }
             return Results.All(t => t.IsRight);