Selaa lähdekoodia

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

xulisong 6 vuotta sitten
vanhempi
commit
953c689c15
39 muutettua tiedostoa jossa 328 lisäystä ja 132 poistoa
  1. BIN
      MBI/Dlls/FirmLibDll/FWindSoft.Wpf.dll
  2. BIN
      MBI/Dlls/FirmLibDll/FWindSoft.Wpf.pdb
  3. BIN
      MBI/Dlls/FirmLibDll/FWindSoft.pdb
  4. 2 0
      MBI/FirmLib/Com.FirmLib.UI/Manufacturer/VmBrandEditor.cs
  5. 1 1
      MBI/FirmLib/Com.FirmLib.UI/Manufacturer/WinBrandEditor.xaml
  6. 6 0
      MBI/FirmLib/Com.FirmLib.UI/Manufacturer/WinBrandEditor.xaml.cs
  7. BIN
      MBI/MBIResource/DataCheck/模型检查结果输出格式-模版.xlsx
  8. 16 3
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/EquipPowerRelationshipHandler.cs
  9. 1 1
      MBI/SAGA.MBI/Calc/ObjectCalc.cs
  10. 20 14
      MBI/SAGA.MBI/DataArrange/DalUploadFloor.cs
  11. 32 40
      MBI/SAGA.MBI/DataArrange/DalVisionOperate.cs
  12. 14 3
      MBI/SAGA.MBI/Extend/ElementExtend.cs
  13. 2 2
      MBI/SAGA.MBI/Html5Command.cs
  14. 2 1
      MBI/SAGA.MBI/Interaction/MBIDocumentSaved.cs
  15. 1 1
      MBI/SAGA.MBI/Model/MFloor.cs
  16. 31 34
      MBI/SAGA.MBI/ToolCommand.cs
  17. 55 0
      MBI/SAGA.MBI/ToolsData/CheckBase/CheckOperation.cs
  18. 29 0
      MBI/SAGA.MBI/ToolsData/CheckBase/DCNPOIExtend.cs
  19. 9 0
      MBI/SAGA.MBI/ToolsData/CheckBase/ICheckBase.cs
  20. 1 1
      MBI/SAGA.MBI/ToolsData/DataCheck/BIMDuplicationCheck.cs
  21. 1 1
      MBI/SAGA.MBI/ToolsData/DataCheck/DutyFMInfoCheck.cs
  22. 1 1
      MBI/SAGA.MBI/ToolsData/DataCheck/MissDutyOrModeCheck.cs
  23. 1 1
      MBI/SAGA.MBI/ToolsData/DataCheck/QRCodeContextCheck.cs
  24. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/ColumnCheck.cs
  25. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/ConnectorCheck.cs
  26. 11 0
      MBI/SAGA.MBI/ToolsData/ModeCheck/DCRExport.cs
  27. 4 3
      MBI/SAGA.MBI/ToolsData/ModeCheck/ElementRangeCheck.cs
  28. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/EquipmentInSpaceCheck.cs
  29. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/EquipmentPartRefEqCheck.cs
  30. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/FamilyNameCheck.cs
  31. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/SagaPositionCheck.cs
  32. 1 8
      MBI/SAGA.MBI/ToolsData/ModeCheck/SagaSignCheck.cs
  33. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/SystemCheck.cs
  34. 1 1
      MBI/SAGA.MBI/ToolsData/ModeCheck/UnitCheck.cs
  35. 2 0
      MBI/SAGA.MBI/WinView/Login/WinModeFileManage.xaml.cs
  36. 9 3
      MBI/SAGA.MBI/WinView/ModeInfoMaintenance/VMMatchFM.cs
  37. 1 1
      MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMatchFMTip_FMNoBimId.xaml
  38. 54 4
      MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMatchFMTip_FMNoBimId.xaml.cs
  39. 13 1
      MBI/SAGA.RevitUtils/Extends/SpaceExtend.cs

BIN
MBI/Dlls/FirmLibDll/FWindSoft.Wpf.dll


BIN
MBI/Dlls/FirmLibDll/FWindSoft.Wpf.pdb


BIN
MBI/Dlls/FirmLibDll/FWindSoft.pdb


+ 2 - 0
MBI/FirmLib/Com.FirmLib.UI/Manufacturer/VmBrandEditor.cs

@@ -42,6 +42,8 @@ namespace Com.FirmLib.UI.Manufacturer
         private void Init()
         {
             LogoKey = new NameValueItem<string>();
+            //为空可能引发遮罩异常
+            ImageBrush = new ImageBrush();
         }
         public void Init(LoadParameter parameter)
         {

+ 1 - 1
MBI/FirmLib/Com.FirmLib.UI/Manufacturer/WinBrandEditor.xaml

@@ -33,7 +33,7 @@
             </TextBox>
           
             <Label  Content="LOGO:"></Label>
-            <Border Height="100" Width="100" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Background="{Binding ImageBrush}"  MouseMove="Border_MouseMove">
+            <Border Height="100" Width="100" BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Background="{Binding ImageBrush}"  MouseMove="Border_MouseMove" MouseLeftButtonDown="Border_MouseLeftButtonDown">
                 <!--<Image Stretch="Uniform" x:Name="image"  >-->
                   
                     <fw:MaskOptions.MaskTemplate>

+ 6 - 0
MBI/FirmLib/Com.FirmLib.UI/Manufacturer/WinBrandEditor.xaml.cs

@@ -100,5 +100,11 @@ namespace Com.FirmLib.UI.Manufacturer
 
             MaskOptions.SetIsShow(element, true);
         }
+        private void Border_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
+        {
+            var element = sender as Border;
+
+            MaskOptions.SetIsShow(element, true);
+        }
     }
 }

BIN
MBI/MBIResource/DataCheck/模型检查结果输出格式-模版.xlsx


+ 16 - 3
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/EquipPowerRelationshipHandler.cs

@@ -54,15 +54,28 @@ namespace SAGA.GplotRelationComputerManage
             var originNodes = items.Select(i => context.ItemConvert(i)).ToList();
             #region 构建树形结构
             var tdls = originNodes.Where(t => t.Type ==MBIBuiltInCategory.TDLS).ToList();
-            var eqs = originNodes.Where(t => t.Type != MBIBuiltInCategory.TDLS).ToList();
+           // var eqs = originNodes.Where(t => t.Type != MBIBuiltInCategory.TDLS).ToList();
+            var eqs = originNodes.Where(t =>true).ToList();
             foreach (var dn in tdls)
             {
                  DataNodeUtil.BuildNode(dn, eqs);
             }
             #endregion
-            var allDataNodes = originNodes.Where(t => t.Childrens.Count == 0 || t.Childrens.Any(n => n.Type != MBIBuiltInCategory.TDLS))
+
+            List<DataNode> useNodes = new List<DataNode>();
+            List<DataNode> ignoreNodes = new List<DataNode>();
+            foreach (var originNode in originNodes)
+            {
+                if(originNode.Type==MBIBuiltInCategory.TDLS&&originNode.Childrens.Any()&&originNode.Childrens.All(c=>c.Type==MBIBuiltInCategory.TDLS))
+                {
+                    ignoreNodes.Add(originNode);
+                    continue;
+                }
+                useNodes.Add(originNode);
+            }
+            var allDataNodes = useNodes.Where(t => t.Childrens.Count == 0 || t.Childrens.Any(n => n.Type != MBIBuiltInCategory.TDLS))
               .ToList();
-            var incomingCabinet = allDataNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
+            var incomingCabinet = allDataNodes.Where(t => t.Childrens.Count != 0 &&(t.Parent == null||ignoreNodes.Contains(t.Parent))).ToList();
             var orphanNodes = allDataNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
             DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "EquipPower");
 

+ 1 - 1
MBI/SAGA.MBI/Calc/ObjectCalc.cs

@@ -59,7 +59,7 @@ namespace SAGA.MBI.Calc
             var spaces = context.RevitDoc.GetSpaces();
             foreach (Space space in spaces)
             {
-                if(!space.IsValidObject)continue;
+                if(!space.IsSpace())continue;
                 MSpace mspace = DalSpace.GetSpace(space);
                 if(mspace==null)continue;
                 mspace.Operator = DocumentChangedOperator.Add;

+ 20 - 14
MBI/SAGA.MBI/DataArrange/DalUploadFloor.cs

@@ -10,6 +10,7 @@ using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Mechanical;
 using SAGA.DotNetUtils;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Logger;
@@ -41,6 +42,8 @@ namespace SAGA.MBI.DataArrange
         {
             Log4Net.Debug("开始:检测是否需要下载模型,如果需要下载");
             if (!IsAllFloorClosed()) return;
+
+            Log4Net.Debug("中间:检测下载模型,如果需要下载");
             BeginDownLoadFile();
             Log4Net.Debug("结束:检测是否需要下载模型,如果需要下载");
         }
@@ -68,8 +71,6 @@ namespace SAGA.MBI.DataArrange
             if (count >= 1)
                 //下载完成提示窗体;文件服务器缺少文件,会出现进度条无法关闭的情况;
                 UpLoadFileRequest.CloseDownloadWin(count == i, hasTip: true);
-            //如果版本文件不存在,下载
-            DalVisionOperate.SaveLocalVision();
         }
         /// <summary>
         /// 重新下载模型文件
@@ -79,10 +80,10 @@ namespace SAGA.MBI.DataArrange
         public static bool? ReDownLoadFile(MFloor floor, ref string msg)
         {
             string fullPath = floor.FullPath;
-            Tuple<string, int, string> tuple = new Tuple<string, int, string>(fullPath, 2, floor.ToString());
             bool? downloadstate;
-            if (DalVisionOperate.IsFileChanged(fullPath))
+            if (DalVisionOperate.IsFileChanged(fullPath, floor.ToString()))
             {
+                Tuple<string, int, string> tuple = new Tuple<string, int, string>(fullPath, 2, floor.ToString());
                 //模型文件有改动,备份并下载
                 downloadstate = UpLoadFileRequest.DownLoadFileAsync(tuple, 1, 1);
                 msg = downloadstate == true ? "模型文件更新成功" : "模型文件更新失败";
@@ -219,7 +220,7 @@ namespace SAGA.MBI.DataArrange
             var allFloors = GetHasFileFloors();
             //获取MD5改变的文件
             var modifyFloors = new ObservableCollection<UploadFloor>(allFloors
-                .Where(t => DalVisionOperate.IsFileChanged(t.MFloor.FullPath)).ToList());
+                .Where(t => DalVisionOperate.IsFileChanged(t.MFloor.FullPath, t.MFloor.ToString())).ToList());
             //获取所有的拓扑图类型
             var topologyGriphs = GetAllTopologyGriphs();
             try
@@ -317,7 +318,7 @@ namespace SAGA.MBI.DataArrange
         {
             if (mode != null)
             {
-                mode.Operator = DocumentChangedOperator.DeleteSaveDuty; 
+                mode.Operator = DocumentChangedOperator.DeleteSaveDuty;
             }
         }
         /// <summary>
@@ -443,14 +444,19 @@ namespace SAGA.MBI.DataArrange
         private static bool OperateZeroSpace(MRevitEquipBase mode, Element elem)
         {
             bool isUselessSpace = false;
-            if (!elem.IsSpace()) return isUselessSpace;
-            //周长
-            double perimeter = elem.GetParameterDouble(BuiltInParameter.ROOM_PERIMETER);
-            //空间比较特殊,周长为零就相当于删除
-            isUselessSpace = (perimeter.IsZero());
-            //如果是无用空间,直接删除云平台对应数据
-            if (isUselessSpace && mode != null)
-                mode.Operator = DocumentChangedOperator.Delete;
+            if (elem is Space space)
+            {
+                if (space.IsDeleteSpace())
+                {
+                    isUselessSpace = true;
+                    if (mode != null)
+                    {
+                        //如果是无用空间,直接删除云平台对应数据
+                        mode.Operator = DocumentChangedOperator.Delete;
+                    }
+                }
+            }
+
             return isUselessSpace;
         }
         /// <summary>

+ 32 - 40
MBI/SAGA.MBI/DataArrange/DalVisionOperate.cs

@@ -81,8 +81,8 @@ namespace SAGA.MBI.DataArrange
             if (!File.Exists(path)) return result;
             try
             {
-                //关闭文档
-                DocExtend.CloseDoc(path);
+                //关闭文档,注释掉是害怕此处更改模型,mxg,20181218
+                //DocExtend.CloseDoc(path);
                 string floorid = path.GetFileName();
                 RevitFileVision cvision = GetCloudFileVision(floorid);
                 cvision.Vision = cvision.Vision + 1;
@@ -98,36 +98,16 @@ namespace SAGA.MBI.DataArrange
 
             return result;
         }
-
-        /// <summary>
-        /// 判断两个文件是否一样
-        /// 模型文件管理,不一样就可以替换
-        /// 只要对比新文件MD5和本地版本文件的Md5
-        /// </summary>
-        /// <param name="becopyPath">将要对比的文件</param>
-        /// <param name="floorid">旧文件的id,从本地版本配置中取Md5</param>
-        /// <returns></returns>
-        public static bool IsNotSameFile(string becopyPath, string floorid)
-        {
-            bool result = false;
-            if (!File.Exists(becopyPath)) return result;
-            //关闭文档
-            DocExtend.CloseDoc(becopyPath);
-            var newmd5 = MD5Tools.GetMD5HashFromFile(becopyPath);
-            if (newmd5.IsNullOrEmpty()) return result;
-            RevitFileVision lvision = GetLocalFileVision(floorid);
-            return (lvision?.MD5Code != newmd5);
-        }
         /// <summary>
         /// 上传之前先检查文件是否变化,变化才出现在上传列表中
         /// 直接对比,更新后Vision文件的md5值与revit文件的md5值
         /// </summary>
         /// <param name="path"></param>
         /// <returns></returns>
-        public static bool IsFileChanged(string path)
+        public static bool IsFileChanged(string path,string floorName)
         {
-            string floorid = path.GetFileName();
-            return IsNotSameFile(path, floorid);
+            var tuple = GetDownBackupState(path, floorName);
+            return (tuple?.Item2 == 1||tuple?.Item2 == 2 || tuple?.Item2 == 3);
         }
 
         /// <summary>
@@ -161,7 +141,9 @@ namespace SAGA.MBI.DataArrange
 
         /// <summary>
         /// 获取需要下载文件的状态
-        /// 1,下载;2,备份并下载
+        /// 1,下载;
+        /// 2,备份并下载
+        /// 3,文件改变了
         /// cloudvision初始值为1
         /// </summary>
         /// <param name="floorPath"></param>
@@ -175,11 +157,13 @@ namespace SAGA.MBI.DataArrange
             var lvision = GetLocalFileVision(floorid);
             if (!File.Exists(floorPath) && cvision.Vision != 0)
             {
-                //本文件不存在,服务器有文件。下载,不备份
+                //本文件不存在,服务器有文件。下载,不备份
                 tuple = new Tuple<string, int, string>(floorPath, 1, floorName);
             }
             else
             {
+                #region 求MD5前关闭Doc
+
                 try
                 {
                     //Revit启动前无法加载RevitAPI.dll报错
@@ -190,26 +174,34 @@ namespace SAGA.MBI.DataArrange
                 {
                     Console.WriteLine(e);
                 }
+
+                #endregion
                 var tempMd5 = MD5Tools.GetMD5HashFromFile(floorPath);
-                if (cvision.MD5Code != tempMd5 && cvision.Vision > lvision.Vision)
+                if (tempMd5.IsNotNullEmpty())
                 {
-                    if (tempMd5.IsNullOrEmpty()) return tuple;
-                    if (tempMd5 == lvision.MD5Code)
-                    {//本地文件没有进行过更改,不备份
-                        tuple = new Tuple<string, int, string>(floorPath, 1, floorName);
+                    //首先对比大版本号
+                    if (cvision.Vision > lvision.Vision)
+                    {
+                        //对比小版本号,判断文件是否更改。如果不一样,说明发生更改,需要备份
+                        if (tempMd5 == lvision.MD5Code)
+                        {//本地文件没有进行过更改,不备份
+                            tuple = new Tuple<string, int, string>(floorPath, 1, floorName);
+                        }
+                        else
+                        {//本地文件发生了更改,进行备份
+                            tuple = new Tuple<string, int, string>(floorPath, 2, floorName);
+                        }
                     }
                     else
-                    {//本地文件发生了更改,进行备份
-                        tuple = new Tuple<string, int, string>(floorPath, 2, floorName);
+                    {
+                        //大版本号不变,小版本号变了, 文件改变
+                        if (tempMd5 != lvision.MD5Code)
+                        {
+                            tuple = new Tuple<string, int, string>(floorPath, 3, floorName);
+                        }
                     }
                 }
             }
-            //不需要下载的文件,同步版本号
-            if (tuple == null)
-            {
-                lvision.Vision = cvision.Vision;
-                lvision.MD5Code = cvision.MD5Code;
-            }
             return tuple;
         }
         /// <summary>

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

@@ -67,15 +67,26 @@ namespace SAGA.MBI.Tools
             var family = elem.GetFamily().Name;
             return (Regex.IsMatch(family, MBIConst.BeaconFamilyName));
         }
+
         /// <summary>
-        /// 判断是否为空间
+        /// 判断是否为空间,判断周长是否为零
+        /// 如果周长为零,是删除的空间
         /// </summary>
         /// <param name="elem"></param>
+        /// <param name="ischeckzero">是否检查周长为零</param>
         /// <returns></returns>
-        public static bool IsSpace(this Element elem)
+        public static bool IsSpace(this Element elem, bool ischeckzero = true)
         {
-            return elem is Space;
+            var isspace = false;
+            if (elem is Space space)
+            {
+                //空间比较特殊,周长为零就相当于删除
+                isspace = !ischeckzero || !(space.IsDeleteSpace());
+            }
+
+            return isspace;
         }
+
         /// <summary>
         /// 获取云平台存储的BimId
         /// 文件名:Id

+ 2 - 2
MBI/SAGA.MBI/Html5Command.cs

@@ -259,8 +259,8 @@ namespace SAGA.MBI
         {
             try
             {
-                //http://172.16.0.181:8888/#/buildGraphy?projId=Pj1101080003&userId=25518428919955458
-                string url = $"{MBIConst.Html5ScanLocalHost}buildGraphy?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
+                //http://172.16.0.181:8888/#/buildGraphy?projId=Pj1101080003&userId=25518428919955458&secret=***
+                string url = $"{MBIConst.Html5ScanLocalHost}buildGraphy?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIConst.ProjectSecret}";
 
                 var win = WinBrowser.Instance;
                 win.Show(url, "楼层平面图管理");

+ 2 - 1
MBI/SAGA.MBI/Interaction/MBIDocumentSaved.cs

@@ -35,7 +35,8 @@ namespace SAGA.MBI.Interaction
              * 5、删除文件
              */
             var document = e.Document;
-            SaveVersion(document);
+            //模型的版本,用于外包校验版本,暂时用不到,先注释掉
+            //SaveVersion(document);
             SaveLog(document);
         }
 

+ 1 - 1
MBI/SAGA.MBI/Model/MFloor.cs

@@ -397,7 +397,7 @@ namespace SAGA.MBI.Model
                 }
                 else
                 {
-                    if (BeCopyPath.IsNotNullEmpty() && DalVisionOperate.IsNotSameFile(BeCopyPath, Id))
+                    if (BeCopyPath.IsNotNullEmpty())
                     {
                         if (FloorFileOperate.CopyFile(BeCopyPath, LocalPath, RevitName))
                             DalModeFileManange.UploadDataByIntersectOldAndNew(this);

+ 31 - 34
MBI/SAGA.MBI/ToolCommand.cs

@@ -3,6 +3,7 @@
  * 创 建 者:Garrett
  * 创建日期:2018/7/11 14:25:22
  * ==============================================================================*/
+
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -30,23 +31,37 @@ using WinModeCheckSetting = SAGA.MBI.ToolsData.ModeCheck.WinModeCheckSetting;
 
 namespace SAGA.MBI
 {
+
+    #region 工具
     /// <summary>
-    /// 导出不在空间中的设备
+    /// 批量删除无用的空间
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    public class ExportEquipNotInSpaceCommand : ExternalCommand
+    public class DeleteZeroSpaceCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             try
             {
-                var fi = ExternalDataWrapper.Current.UiApp.GetSelectedElement() as FamilyInstance;
-                var space = fi.GetReferenceSpace();
-                MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}");
-                //var tip = MessageShow.Question("确定要执行设备所在空间的检查?\r\n未在空间中的岗位将会被导出的excel中,由建模人员进行检查。");
-                //if (tip)
-                //    CheckEquipInSpace.Export();
+                var doc = ExternalDataWrapper.Current.Doc;
+                using (Transaction trans = new Transaction(doc, "删除"))
+                {
+                    trans.Start();
+                    try
+                    {
+                        var spaces = doc.GetSpaces().Where(t => t.IsDeleteSpace());
+                        doc.Delete(spaces.Select(t => t.Id).ToList());
+                        trans.Commit();
+                        MessageShowBase.Infomation("删除成功");
+                    }
+                    catch (Exception)
+                    {
+                        trans.RollBack();
+
+                    }
+                }
+
             }
             catch (Exception e)
             {
@@ -55,31 +70,21 @@ namespace SAGA.MBI
             }
             return Result.Succeeded;
         }
-
-
-        /// <summary>
-        /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
-        /// when a document is open.
-        /// </summary>
-        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
     }
     /// <summary>
-    /// 检查BimID是否重复,多个岗位对应一个模型
+    /// 报告设备所在空间
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
-    public class CheckDuplicationBIMIdCommand : ExternalCommand
+    public class ReportEquipInSpaceCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             try
             {
-                var tip = MessageShow.Question("确定要执行设备BIMID重复性检查?\r\n未在空间中的岗位将会被导出的excel中。");
-                if (tip)
-                    CheckDuplicationBIMId.CheckAll();
+                var fi = ExternalDataWrapper.Current.UiApp.GetSelectedElement() as FamilyInstance;
+                var space = fi.GetReferenceSpace();
+                MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}");
             }
             catch (Exception e)
             {
@@ -88,17 +93,9 @@ namespace SAGA.MBI
             }
             return Result.Succeeded;
         }
-
-
-        /// <summary>
-        /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
-        /// when a document is open.
-        /// </summary>
-        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
     }
+    #endregion
+
 
     /// <summary>
     /// 修正云平台族类型和本地族类型不一致
@@ -339,7 +336,7 @@ namespace SAGA.MBI
                 var checkType = CheckType.DataCheck;
                 var checkItems = CheckOperation.GetCheckItems(checkType);
 
-                WinDataCheckSetting win = new WinDataCheckSetting(checkItems,CheckType.DataCheck);
+                WinDataCheckSetting win = new WinDataCheckSetting(checkItems, CheckType.DataCheck);
                 if (win.ShowDialog() != true) return Result.Cancelled;
                 CheckOperation.Execute(checkItems, win.GetCheckContext());
             }

+ 55 - 0
MBI/SAGA.MBI/ToolsData/CheckBase/CheckOperation.cs

@@ -12,6 +12,8 @@ using NPOI.SS.UserModel;
 using SAGA.MBI.ToolsData.ModeCheck;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Logger;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.DataArrange;
 using SAGA.MBI.ToolsData.DataCheck;
 
 namespace SAGA.MBI.ToolsData.CheckBase
@@ -101,7 +103,10 @@ namespace SAGA.MBI.ToolsData.CheckBase
             DCRExport.ClearWorkbook();
             //保存
             list.ForEach(t => t.Export2());
+            ExportResultSummary(list);
             DCRExport.Save(context.SavePath, DCRExport.GetWorkbook());
+            //关闭所有窗体
+            DocumentQueue.CloseAll();
             DataCheckProgressBarClient.UpdateBigTip("结束");
         }
         /// <summary>
@@ -124,5 +129,55 @@ namespace SAGA.MBI.ToolsData.CheckBase
             }
             return path;
         }
+        /// <summary>
+        /// 检查结果汇总
+        /// </summary>
+        /// <param name="list"></param>
+        /// <param name="context"></param>
+        private static void ExportResultSummary(List<ICheckBase> list)
+        {
+            var mbuilding = DalProjectTree.GetSelectedBuilding();
+            string buildingName = mbuilding.ToString();
+            var floors = DalProjectTree.GetSelectedFloors();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                string sheetName = "检查结果汇总";
+                ISheet sheet = book.GetSheet(sheetName);
+                //本次检查的建筑体
+                var row0 = sheet.GetRow(0);
+                row0.AddCell(1,buildingName,hasStyle:false);
+                //本次检查楼层
+                var row1 = sheet.GetRow(1);
+                row1.AddCell(1,string.Join("、",floors.Select(t=>t.ToString())));
+
+                #region 添加数据
+                int index = 3;
+
+                foreach (var result in list)
+                {
+                    //数量过多,只显示有问题的
+                    //if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                    int i = 0;
+                    rowN.AddCell(i++, result.Name, DataCheckNPOIStyle.HyperLink,true);
+                    //链接到指定页签
+                    var cellN0 = rowN.GetCell(i-1);
+                    cellN0.Hyperlink = DCRExport.CreateLink(result.Name);
+                    rowN.AddCell(i++, result.RIsChecked?"是":"否", style);
+                    //检查,并且结果为不通过
+                    string rowN4 = !result.IsRight&&result.RIsChecked ? "包含问题数据" : "";
+                    rowN.AddCell(i++, rowN4, style);
+                }
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
     }
 }

+ 29 - 0
MBI/SAGA.MBI/ToolsData/CheckBase/DCNPOIExtend.cs

@@ -75,6 +75,9 @@ namespace SAGA.MBI.ToolsData.CheckBase
                 case DataCheckNPOIStyle.Error:
                     cellstyle = LeftCenterRedStyle(workbook);
                     break;
+                case DataCheckNPOIStyle.HyperLink:
+                    cellstyle = HyperLinkStyle(workbook);
+                    break;
                 default:
                     cellstyle = LeftCenterBlackStyle(workbook);
                     break;
@@ -82,6 +85,30 @@ namespace SAGA.MBI.ToolsData.CheckBase
             return cellstyle;
         }
         /// <summary>
+        /// 设置样式为超级链接
+        /// </summary>
+        /// <param name="workbook"></param>
+        /// <returns></returns>
+        private static ICellStyle HyperLinkStyle(IWorkbook workbook)
+        {
+            ICellStyle style = workbook.CreateCellStyle();
+            //设置单元格的样式:水平对齐左侧垂直居中
+            style.Alignment = HorizontalAlignment.Left;
+            style.VerticalAlignment = VerticalAlignment.Center;
+            //新建一个字体样式对象
+
+            IFont font = workbook.CreateFont();
+            font.Underline = FontUnderlineType.Single;
+            //设置字体颜色
+            font.Color = HSSFColor.Blue.Index;
+            font.FontHeight = 12;
+            //使用SetFont方法将字体样式添加到单元格样式中 
+
+            style.SetFont(font);
+            //将新的样式赋给单元格
+            return style;
+        }
+        /// <summary>
         /// 设置样式为水平左侧垂直居中,红色字体
         /// </summary>
         /// <param name="workbook"></param>
@@ -186,5 +213,7 @@ namespace SAGA.MBI.ToolsData.CheckBase
         Title,
         Content,
         Error,
+        HyperLink,
+        None
     }
 }

+ 9 - 0
MBI/SAGA.MBI/ToolsData/CheckBase/ICheckBase.cs

@@ -17,7 +17,16 @@ namespace SAGA.MBI.ToolsData.CheckBase
     public interface ICheckBase
     {
         string Name { get; set; }
+
+        /// <summary>
+        /// 是否检查
+        /// </summary>
         bool RIsChecked { get; set; }
+
+        /// <summary>
+        /// 是否通过较验
+        /// </summary>
+        bool IsRight { get; set; }
         void Check2(CheckContext context);
 
         void Export2();

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

@@ -61,7 +61,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
             var bybimidGroups = dutys.GroupBy(t => t.BimID);
             var exceptionGroups = bybimidGroups.Where(t => t.Count() >= 2 && !t.Key.IsOnlyDutyNoModelBIMID());
             Results.AddRange(GetCheckResult(exceptionGroups));
-            return Results.Count==0;
+            return Results.All(t => t.IsRight);
         }
 
         private List<BIMDuplicationCheckResult> GetCheckResult(IEnumerable<IGrouping<string, MRevitEquipBase>> groups)

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

@@ -92,7 +92,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
                     break;
                 }
             }
-            return result;
+            return Results.All(t => t.IsRight);
         }
         //忽略的信息点
         private List<string> m_IgnoreList=new List<string>(){ "EquipID" ,"EquipName"};

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

@@ -61,7 +61,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
             {
                 Results.AddRange(GetCheckResult(mfloor));
             }
-            return result;
+            return Results.All(t => t.IsRight);
         }
 
         private List<MissDutyOrModeCheckResult> GetCheckResult(MFloor mFloor)

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

@@ -87,7 +87,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
                     break;
                 }
             }
-            return result;
+            return Results.All(t => t.IsRight);
         }
 
         private QRCodeContextCheckResult GetCheckResult(MEquipFM fm,MQRCode qrcode)

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

@@ -57,7 +57,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     Results.Add(result);
                 }
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
 
         /// <summary>

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

@@ -58,7 +58,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                 var list = Check(signResult);
                 Results.AddRange(list);
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
 
         }
         /// <summary>

+ 11 - 0
MBI/SAGA.MBI/ToolsData/ModeCheck/DCRExport.cs

@@ -83,6 +83,17 @@ namespace SAGA.MBI.ToolsData.ModeCheck
             return m_ExportWorkBook;
         }
         /// <summary>
+        /// 联接到指定Sheet页
+        /// </summary>
+        /// <param name="sheetName"></param>
+        /// <returns></returns>
+        public static XSSFHyperlink CreateLink(string sheetName)
+        {
+            XSSFHyperlink link=new XSSFHyperlink(HyperlinkType.Document);
+            link.Address = $"'{sheetName}'!A1";
+            return link;
+        }
+        /// <summary>
         /// 重置workbook
         /// </summary>
         public static void ClearWorkbook()

+ 4 - 3
MBI/SAGA.MBI/ToolsData/ModeCheck/ElementRangeCheck.cs

@@ -56,7 +56,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
             {
                 CheckCurrentFloor(signResult);
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
         /// <summary>
         /// 检查当前层
@@ -217,8 +217,9 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                         result = null;
                     }
                 }
-                else if (element is Space space)
+                else if (element.IsSpace())
                 {
+                    var space = element as Space;
                     isBoxInst = true;
                     result.RType = DCElementType.Space;
                     zb = space.GetBaseStaticHeight();
@@ -313,7 +314,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     rowN.AddCell(6, rowN4, style);
                     rowN.AddCell(7, result.RMessage, style);
                 }
-         
+
                 #endregion
 
             }

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

@@ -60,7 +60,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     Results.Add(result);
                 }
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
 
         /// <summary>

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

@@ -60,7 +60,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     Results.Add(result);
                 }
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
 
         /// <summary>

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

@@ -96,7 +96,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
 
                 }
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
         /// <summary>
         /// 获取检测结果

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

@@ -68,7 +68,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                 Results.Add(tempResult);
             }
 
-            return sequenceResult;
+            return Results.All(t => t.IsRight);
         }
 
         public override void Correct()

+ 1 - 8
MBI/SAGA.MBI/ToolsData/ModeCheck/SagaSignCheck.cs

@@ -137,7 +137,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
 
                 }
             }
-            return allRight;
+            return Results.All(t => t.IsRight);
         }
 
         #endregion
@@ -192,12 +192,5 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                 MessageShowBase.Show(e);
             }
         }
-        /// <summary>
-        /// 关闭所有窗体
-        /// </summary>
-        public void CloseDoc()
-        {
-            DocumentQueue.CloseAll();
-        }
     }
 }

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

@@ -56,7 +56,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                 var list = Check(signResult);
                 Results.AddRange(list);
             }
-            return unitResult;
+            return Results.All(t => t.IsRight);
         }
 
         private List<DCR_MEPSystem> m_MEPSystems;

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

@@ -44,7 +44,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     unitResult = ismmUnit;
                 }
             }
-            IsRight = unitResult;
+            IsRight =  Results.All(t => t.IsRight); ;
             return IsRight;
         }
 

+ 2 - 0
MBI/SAGA.MBI/WinView/Login/WinModeFileManage.xaml.cs

@@ -44,6 +44,8 @@ namespace SAGA.MBI.Login
                 //执行下载操作
                 DalUploadFloor.CheckAndBeginDownLoadFile();
             }
+            //解除TreeView的绑定
+            this.DataContext = null;
         }
 
         #region 界面初始化

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

@@ -150,13 +150,17 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
                     DalCommon.Delete(FMData.FmCur.EquipmentId);
                     break;
                 case MatchOperateType.FMHasDutyNoBim3:
+                    var oldDutyId = FMData.FmCur.EquipmentId;
+                    var newDutyId = MEquipment.Id;
                     //取消1,2步.由于选择保留资产和资产的岗位关系--由于要清空“ctm-Location”信息点,所以还是更新一下
+                    //使用旧岗位id,更新对应资产的关系
+                    MEquipment.Id = oldDutyId;
                     MatchFMConvert.CreateRelationFMWithId(MEquipment, FMData.FmCur);
                     //3 更新此模型计算的各种关系中的岗位id
                     //更新设备所在空间 用旧id,替换新id,中的关系
-                    RelationConvert.UpdateEquipInSpaceRelation(MEquipment.Id, FMData.FmCur.EquipmentId);
+                    RelationConvert.UpdateEquipInSpaceRelation(newDutyId, oldDutyId);
                     //4,将当前模型BIMID添加到选中资产关联的原岗位上
-                    DalCommon.UpdateBimId(FMData.FmCur.EquipmentId, MEquipment.BimID);
+                    DalCommon.UpdateBimId(oldDutyId, MEquipment.BimID);
                     //5 按用户设定维护原岗位信息点
 
                     #region 合并信息点
@@ -171,10 +175,12 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
                             jo.Add(combine.Definition.CodeName, CommonTool.GetPropertyJArray(itemProperty.Value.ToString()));
                         }
                     }
-                    CommonConvert.UpdateInfosSigle(FMData.FmCur.EquipmentId, jo);
+                    CommonConvert.UpdateInfosSigle(oldDutyId, jo);
 
                     #endregion
                     //6,删除模型对应的新岗位
+                    //1,2替换为旧的id,这里替换回来
+                    MEquipment.Id = newDutyId;
                     MEquipment.DelObject();
                     break;
             }

+ 1 - 1
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMatchFMTip_FMNoBimId.xaml

@@ -39,7 +39,7 @@
 
         </Grid>
         <Canvas Grid.Row="3">
-            <Button Width="180"  Height="24" Content="确定" Canvas.Left="180" Canvas.Top="15" Click="BtnConfirm_OnClick"></Button>
+            <Button Width="150"  Height="24" Content="确定" Canvas.Left="150" Canvas.Top="15" Click="BtnConfirm_OnClick"></Button>
             <Button Width="80"  Height="24" Content="取消" Canvas.Left="350" Canvas.Top="15" Background="White" IsCancel="True"></Button>
         </Canvas>
     </Grid>

+ 54 - 4
MBI/SAGA.MBI/WinView/ModeInfoMaintenance/WinMatchFMTip_FMNoBimId.xaml.cs

@@ -1,7 +1,10 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.Linq;
 using System.Windows;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
 using SAGA.MBI.ModeInfoEdit;
 using SAGA.MBI.Model;
 using SAGA.MBI.RequestData;
@@ -12,7 +15,7 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
     /// <summary>
     /// WinUploadConfirmModify.xaml 的交互逻辑
     /// </summary>
-    public partial class WinMatchFMTip_FMNoBimId:INotifyPropertyChanged
+    public partial class WinMatchFMTip_FMNoBimId : INotifyPropertyChanged
     {
         private WinMatchFMTip_FMNoBimId()
         {
@@ -22,7 +25,7 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
         }
 
         private string m_Id1, m_Id2;
-        public WinMatchFMTip_FMNoBimId(string id1,string id2):this()
+        public WinMatchFMTip_FMNoBimId(string id1, string id2) : this()
         {
             m_Id1 = id1;
             m_Id2 = id2;
@@ -62,7 +65,7 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
             set
             {
                 m_Operate = value;
-                PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(Operate)));
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Operate)));
                 LoadData(m_Id1, m_Id2);
             }
         }
@@ -71,7 +74,54 @@ namespace SAGA.MBI.WinView.ModeInfoMaintenance
 
         private void BtnConfirm_OnClick(object sender, RoutedEventArgs e)
         {
-            this.DialogResult = true;
+            if (Operate == MatchOperateType.FMHasDutyNoBim3)
+            {
+                int nullItemsCount = GetNullItemsCount();
+                if (nullItemsCount > 0)
+                {
+                    WinPointMergeTip win = new WinPointMergeTip();
+                    if (win.Show(nullItemsCount))
+                    {
+                        this.DialogResult = true;
+                    }
+                }
+                else
+                {
+                    this.DialogResult = true;
+                }
+            }
+            else
+            {
+                this.DialogResult = true;
+            }
+
+        }
+        /// <summary>
+        /// 获取未赋值的项
+        /// </summary>
+        /// <returns></returns>
+        private int GetNullItemsCount()
+        {
+            var source = InfoGrid.ItemsSource;
+            var items = new List<ItemProperty>();
+            foreach (ItemProperty item in source)
+            {
+                GetAssigmentItems(item, items);
+            }
+            return items.Where(t => t.Value.ToString().IsNullOrEmpty()).GetCount();
+        }
+
+        private void GetAssigmentItems(ItemProperty item, List<ItemProperty> items)
+        {
+            if (item is AssigmentItemProperty)
+            {
+                items.Add(item);
+            }
+            foreach (ItemProperty subitem in item.Children)
+            {
+                GetAssigmentItems(subitem, items);
+            }
+
         }
     }
 }

+ 13 - 1
MBI/SAGA.RevitUtils/Extends/SpaceExtend.cs

@@ -10,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Autodesk.Revit.DB;
 using Autodesk.Revit.DB.Mechanical;
+using SAGA.DotNetUtils.Extend;
 
 namespace SAGA.RevitUtils.Extends
 {
@@ -178,7 +179,18 @@ namespace SAGA.RevitUtils.Extends
         {
             return space.GetTopLevel().Elevation + space.GetTopOffSet();
         }
-
+        /// <summary>
+        /// 手动删除的空间,仅在明细表中可见
+        /// </summary>
+        /// <param name="space"></param>
+        /// <returns></returns>
+        public static bool IsDeleteSpace(this Space space)
+        {
+            //周长
+            double perimeter = space.Perimeter;
+            //空间比较特殊,周长为零就相当于删除
+            return  (perimeter.IsZero());
+        }
 
     }
 }