Browse Source

Merge branch 'master' of http://dev.dp.sagacloud.cn:8886/r/Revit/SAGA.MBI

xulisong 6 years ago
parent
commit
c1664b7406

+ 1 - 1
MBI/SAGA.MBI/JsonConvert/MatchFMConvert.cs

@@ -142,7 +142,7 @@ namespace SAGA.MBI.JsonConvert
                         {
                             mEquipFm.ImageList.Add(new MServiceAttachment(imageObj.GetValueEx("key"), imageObj.GetValueEx("name"), imageObj.GetValueEx("type").ConvertToServiceImageType()));
                         }
-                        mEquipFm.DistantImage = mEquipFm.ImageList.FirstOrDefault(t => t.ImageName == distantImageStr);
+                        mEquipFm.DistantImage = mEquipFm.ImageList.FirstOrDefault(t => t.ImageName == distantImageStr)?? mEquipFm.ImageList.FirstOrDefault();
                     }
 
                     mEquipFm.FMJson = fmInfos.ToString();

+ 15 - 5
MBI/SAGA.MBI/Model/MFloor.cs

@@ -113,14 +113,24 @@ namespace SAGA.MBI.Model
         #region Path
 
         /// <summary>
-        /// 判断是否缺少文件依据是:本地该层的模型文件是否存在
+        /// 判断是否缺少文件依据是:
+        /// 1,该层的模型文件是否存在
+        /// 2,存在,不缺少
+        /// 3,不存在,判断是楼层顺序号是否为空
         /// </summary>
         public bool IsMissFile
         {
             get
             {
-                //由于每次登录时都下载,所以只需判断文件是否存在就可以了
-                return !File.Exists(FullPath);
+                bool result = false;
+                //首先判断文件是否存在
+                if (!File.Exists(FullPath))
+                {
+                    //判断云端是否存在版本信息
+                    var vision = DalVisionOperate.GetCloudFileVision(this.Id);
+                    result = vision.Vision == 0;
+                }
+                return result;
             }
             set => NotifyPropertyChanged(nameof(IsMissFile));
         }
@@ -443,7 +453,7 @@ namespace SAGA.MBI.Model
             string tip = $"请确认,本操作将从云端重新获取【{floorfullName}】最新的模型文件到本地,本地已有此楼层模型文件将被覆盖!";
             WinCommonTip winTip = new WinCommonTip();
             //默认为null,有提示
-            tipResult = winTip.Show(tip,"",title: "重要提示");
+            tipResult = winTip.Show(tip, "", title: "重要提示");
 
             #endregion
 
@@ -504,7 +514,7 @@ namespace SAGA.MBI.Model
             //刷新解锁按钮
             FloorLock = FloorLock;
             //刷新树的显示
-            var tv=DalModeFileManange.GetFloorTreeById(this.Id);
+            var tv = DalModeFileManange.GetFloorTreeById(this.Id);
             tv.Item.TvItemName = tv.Item.TvItemName;
             #endregion
         }

+ 1 - 1
MBI/SAGA.MBI/ToolsData/DataCheck/DataCheckBase.cs

@@ -99,7 +99,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
         {
             DCRExport.SetTemplatePath(Context.TemplatePath);
             Export();
-            SetSheetVisible();
+            //SetSheetVisible();
         }
         #endregion
 

+ 1 - 1
MBI/SAGA.MBI/ToolsData/ModeCheck/ModeCheckBase.cs

@@ -104,7 +104,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
         {
             DCRExport.SetTemplatePath(Context.TemplatePath);
             Export();
-            SetSheetVisible();
+            //SetSheetVisible();
         }
         #endregion
 

+ 1 - 2
MBI/SAGA.MBI/ToolsData/ModeCheck/WinModeCheckSetting.xaml

@@ -43,8 +43,7 @@
                                 <WrapPanel>
                                     <CheckBox IsChecked="{Binding Path=IsSelected,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}"
                                               Width="Auto" VerticalContentAlignment="Center" 
-                                              Checked="TreeItemChecked_OnChecked"
-                                              Unchecked="TreeItemChecked_OnChecked">
+                                              Click="TreeItemChecked_OnChecked">
                                     </CheckBox>
                                     <Label Content="{Binding Path=Item.TvItemName}"></Label>
                                 </WrapPanel>

+ 15 - 1
MBI/SAGA.MBI/ToolsData/ModeCheck/WinModeCheckSetting.xaml.cs

@@ -168,7 +168,21 @@ namespace SAGA.MBI.ToolsData.ModeCheck
         {
             if (node.Parent != null)
             {
-                node.Parent.IsSelected = state;
+                if (node.Parent.Item is MProject)
+                {
+                    if (state)
+                    {
+                        foreach (var child in node.Parent.Children)
+                        {
+                            if (child != node)
+                            {
+                                child.IsSelected = false;
+                                SetChildrenState(child, false);
+                            }
+                        }
+                    }
+                }
+                node.Parent.IsSelected = node.Parent.Children.Any(t=>t.IsSelected);
                 SetParentState(node.Parent, state);
             }
 

+ 35 - 12
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/VMMatchFM.cs

@@ -376,7 +376,26 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         /// </summary>
         public string FloorName { get; set; }
     }
-
+    /// <summary>
+    /// 由近到远进行排序
+    /// </summary>
+    public class RecommendByDistanceComparer : IComparer<MEquipFM>
+    {
+        private XYZ origin;
+        public RecommendByDistanceComparer(XYZ origin)
+        {
+            this.origin = origin;
+        }
+        public int Compare(MEquipFM x, MEquipFM y)
+        {
+            XYZ xXyz = x.Location.ToXyz();
+            XYZ yXyz = y.Location.ToXyz();
+            return origin.DistanceTo(xXyz).CompareTo(origin.DistanceTo(yXyz));
+        }
+    }
+    /// <summary>
+    /// 推荐
+    /// </summary>
     public class RecommendFMData : BaseFMData
     {
 
@@ -402,20 +421,21 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
             var tempList = list.Where(t => IsMathPlan1(t, equip));
             if (tempList.Any())
             {
+                List<MEquipFM> plan1List = new List<MEquipFM>();
                 var nodutyList = tempList.Where(t => t.EquipmentId.IsNotNullEmpty());
                 if (nodutyList.Any())
                 {
-                    foreach (MEquipFM fm in nodutyList)
-                    {
-                        FMList.Add(fm);
-                    }
+                    plan1List.AddRange(nodutyList);
                 }
                 else
                 {
-                    foreach (MEquipFM fm in tempList)
-                    {
-                        FMList.Add(fm);
-                    }
+                    plan1List.AddRange(tempList);
+                }
+                //按距离由近到远排序
+                plan1List.Sort(new RecommendByDistanceComparer(equip.Location.ToXyz()));
+                foreach (MEquipFM fm in plan1List)
+                {
+                    FMList.Add(fm);
                 }
             }
             else
@@ -428,7 +448,9 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
             }
         }
         /// <summary>
-        /// 推荐方案1,同设备族and距离近
+        /// 推荐方案1,
+        /// 同一楼层
+        /// 同设备族and距离近
         /// </summary>
         /// <param name="equipFm"></param>
         /// <param name="equip"></param>
@@ -437,12 +459,13 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         {
             bool result = false;
             List<Func<MEquipFM, MRevitEquipBase, bool>> funcs = new List<Func<MEquipFM, MRevitEquipBase, bool>>();
+            funcs.Add(IsSameFloor);
             funcs.Add(IsLocationNear);
             while (true)
             {
                 if (equipFm.FamilyCode != equip.Family.Code)
                     break;
-                result = funcs.Any(t => t(equipFm, equip));
+                result = funcs.All(t => t(equipFm, equip));
                 break;
             }
             return result;
@@ -572,7 +595,7 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         private bool IsLocationNear(MEquipFM equipFm, MRevitEquipBase equip)
         {
             //推荐坐标的冗余值
-            double redundancy = 2000d;
+            double redundancy = 20000d;
             XYZ fmXyz = equipFm.Location.ToXyz();
             XYZ dutyXyz = equip.Location.ToXyz();
             bool result = false;