Kaynağa Gözat

mxg:岗位合并时,信息点合并,空值不显示

mengxiangge 6 yıl önce
ebeveyn
işleme
468350033f

+ 11 - 0
MBI/SAGA.DotNetUtils/Extend/ObjectExtend.cs

@@ -34,5 +34,16 @@ namespace SAGA.DotNetUtils.Extend
             }
             return result;
         }
+
+        public static bool IsNullOrEmpty(this object obj)
+        {
+            return obj==null||((string) obj)=="";
+        }
+
+        public static bool IsNotNullEmpty(this object obj)
+        {
+            return !obj.IsNullOrEmpty();
+        }
+
     }
 }

+ 2 - 1
MBI/SAGA.MBI/RevitReference/RVTNoModeDutyOperate.cs

@@ -54,7 +54,8 @@ namespace SAGA.MBI.RevitReference
                             if (IsBasePointFamily(fs))
                             {
                                 //使用BIMLocation中的坐标,mm转为英寸
-                                XYZ xyz = mode.MEquipBase.Location.ToXyz().ConvertToApi();
+                                XYZ xyz = mode.MEquipBase.Location.ToXyz();
+                                xyz = xyz==null ? XYZ.Zero : xyz.ConvertToApi();
                                 var level = GetCurFloorLevel(doc);
                                 //传标高,z值设置为零
                                 xyz=xyz.NewZ(0);

+ 3 - 8
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/VMMatchFM.cs

@@ -432,11 +432,11 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
             //1.a,如果有值,过滤没有关联岗位的。
             //1.b,1.a有值,推荐1.a;没有值,推荐1;
             //2,1没有值,按方案2过滤
-            var tempList = list.Where(t => IsMathPlan1(t, equip));
+            var tempList = list.Where(t => IsMathPlan1(t, equip)).ToList();
             if (tempList.Any())
             {
                 List<MEquipFM> plan1List = new List<MEquipFM>();
-                var nodutyList = tempList.Where(t => t.EquipmentId.IsNotNullEmpty());
+                var nodutyList = tempList.Where(t => t.EquipmentId.IsNullOrEmpty()).ToList();
                 if (nodutyList.Any())
                 {
                     plan1List.AddRange(nodutyList);
@@ -471,16 +471,11 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         /// <returns></returns>
         private bool IsMathPlan1(MEquipFM equipFm, MRevitEquipBase equip)
         {
-            bool result = false;
             List<Func<MEquipFM, MRevitEquipBase, bool>> funcs = new List<Func<MEquipFM, MRevitEquipBase, bool>>();
             funcs.Add(IsSameFamilyCode);
             funcs.Add(IsSameFloor);
             funcs.Add(IsLocationNear);
-            while (true)
-            {
-                result = funcs.All(t => t(equipFm, equip));
-                break;
-            }
+            bool result = funcs.All(t => t(equipFm, equip));
             return result;
         }
         /// <summary>

+ 18 - 2
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMatchFMTip_FMNoBimId.xaml.cs

@@ -44,7 +44,7 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
             m_Items = originitems;
             if (originitems.Count > 0)
             {
-                InfoGrid.ItemsSource = new ObservableCollection<ItemProperty>(EquipmentCombineUtil.GetGroupProperties(originitems));
+                InfoGrid.ItemsSource = new ObservableCollection<ItemProperty>(EquipmentCombineUtil.GetGroupProperties(originitems).Where(t=>t.Children.All(tt=>tt.Value.IsNotNullEmpty())));
             }
         }
         private List<ItemProperty> m_Items;
@@ -54,7 +54,23 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         /// <returns></returns>
         public List<ItemProperty> GetCombineInfos()
         {
-            return m_Items;
+            var results= m_Items.Select(t =>
+            {
+                if (t.Value.IsNullOrEmpty())
+                {
+                    if (t.Children.All(tt => tt.Value.IsNotNullEmpty()))
+                    {
+                        
+                    }
+                    else
+                    {
+                        (t.Value) = t.Children.FirstOrDefault(tt => tt.Value.IsNotNullEmpty())?.Value;
+                    }
+
+                }
+                return t;
+            }).ToList();
+            return results;
         }
 
         private MatchOperateType m_Operate;