Sfoglia il codice sorgente

mxg:添加数据检查命令

mengxiangge 6 anni fa
parent
commit
4427fa2d81
100 ha cambiato i file con 4766 aggiunte e 738 eliminazioni
  1. 4 0
      .gitignore
  2. 1 6
      Client/Class1.cs
  3. 0 9
      Client/Client.csproj
  4. 1 2
      Client/MessageHandler.cs
  5. 24 2
      Client/Start/RevitCmdExecutor.cs
  6. 3 2
      Client/Start/ServiceMBIClientHandler.cs
  7. 7 9
      Client/TaskHandler.cs
  8. 4 0
      Client/app.config
  9. 0 110
      ClientTests/ClientTests.csproj
  10. 0 32
      ClientTests/Start/RevitCmdExecutorTests.cs
  11. 0 67
      ClientTests/app.config
  12. 0 6
      ClientTests/packages.config
  13. BIN
      Dlls/R2016/AdWindows.dll
  14. BIN
      Dlls/R2016/RevitAPI.dll
  15. BIN
      Dlls/R2016/RevitAPIIFC.dll
  16. BIN
      Dlls/R2016/RevitAPILink.dll
  17. BIN
      Dlls/R2016/RevitAPIUI.dll
  18. BIN
      Dlls/R2016/RevitAPIUILink.dll
  19. BIN
      Dlls/SAGA.DotNetUtils.dll
  20. BIN
      Dlls/SAGA.Models.dll
  21. 121 0
      MBIUtility/Extend/DocExtend.cs
  22. 232 0
      MBIUtility/Extend/ElementExtend.cs
  23. 167 0
      MBIUtility/Extend/StringExtend.cs
  24. 69 0
      MBIUtility/MBIUtility.csproj
  25. 6 0
      MBIUtility/MBIUtility.csproj.user
  26. 7 7
      ClientTests/Properties/AssemblyInfo.cs
  27. 190 0
      MBIUtility/Tool/CommonTool.cs
  28. 11 0
      MBIUtility/app.config
  29. 4 0
      MBIUtility/packages.config
  30. 2 2
      NettyClient/SimpleMessageHandler.cs
  31. 1 1
      NettyClient/TaskNettyClient.cs
  32. 4 3
      NettyClient/proto/MessageProto.cs
  33. 1 2
      NettyClient/proto/MessageUtil.cs
  34. 1 2
      SAGA.Revit/App.xaml
  35. 2 8
      SAGA.Revit/App.xaml.cs
  36. 1 2
      SAGA.Revit/MainWindow.xaml
  37. 2 2
      SAGA.Revit/MainWindow.xaml.cs
  38. 1 1
      SAGA.Revit/Properties/Resources.Designer.cs
  39. 1 1
      SAGA.Revit/Properties/Settings.Designer.cs
  40. 1 3
      SAGA.RevitMenu/Configuration/ButtonStyles.cs
  41. 0 1
      SAGA.RevitMenu/Configuration/MenuConfig.cs
  42. 0 1
      SAGA.RevitMenu/Configuration/RevitRibbonOperate.cs
  43. 1 3
      SAGA.RevitMenu/Configuration/StackStyles.cs
  44. 1 7
      SAGA.RevitMenu/Configuration/TszButtonData.cs
  45. 0 1
      SAGA.RevitMenu/Configuration/TszPanelData.cs
  46. 0 1
      SAGA.RevitMenu/Configuration/TszTabData.cs
  47. 0 1
      SAGA.RevitMenu/Configuration/XmlMenuData.cs
  48. 13 22
      SAGA.RevitMenu/MenuApp.cs
  49. 0 89
      SAGA.RevitMenu/SAGA.RevitMenu.csproj
  50. 2 7
      SAGA.RevitMenu/Setting/StartSetting.cs
  51. 1 2
      SAGA.RevitMenu/ShortKey/ScreenMenuKeyBoardShortCut.cs
  52. 1 1
      SAGA.RevitMenu/app.config
  53. 0 50
      SAGA.RevitMenu/packages.config
  54. 1 1
      ServiceMBI.Modes/IServiceCommand.cs
  55. 5 4
      ServiceMBI.Modes/ServiceMBIBuiltInParameter.cs
  56. 36 0
      ServiceMBI.Request/Properties/AssemblyInfo.cs
  57. 46 0
      ServiceMBI.Request/ServiceMBI.Request.csproj
  58. 15 267
      ServiceMBI.sln
  59. 21 1
      ServiceMBI/App.config
  60. 60 0
      ServiceMBI/Check/CheckBase/CheckContext.cs
  61. 155 0
      ServiceMBI/Check/CheckBase/CheckOperation.cs
  62. 55 0
      ServiceMBI/Check/CheckBase/CheckProcessAspect.cs
  63. 56 0
      ServiceMBI/Check/CheckBase/CheckProgressBarClient.cs
  64. 27 0
      ServiceMBI/Check/CheckBase/CheckType.cs
  65. 31 0
      ServiceMBI/Check/CheckBase/DCElementType.cs
  66. 220 0
      ServiceMBI/Check/CheckBase/DCNPOIExtend.cs
  67. 31 0
      ServiceMBI/Check/CheckBase/ICheckBase.cs
  68. 41 0
      ServiceMBI/Check/CheckFloorInfoResult.cs
  69. 74 0
      ServiceMBI/Check/DocumentQueue.cs
  70. 73 0
      ServiceMBI/Check/ModeCheck/ColumnCheck.cs
  71. 19 0
      ServiceMBI/Check/ModeCheck/ColumnCheckResult.cs
  72. 251 0
      ServiceMBI/Check/ModeCheck/ConnectorCheck.cs
  73. 26 0
      ServiceMBI/Check/ModeCheck/ConnectorCheckResult.cs
  74. 143 0
      ServiceMBI/Check/ModeCheck/DCRExport.cs
  75. 163 0
      ServiceMBI/Check/ModeCheck/DataCheckRule.cs
  76. 325 0
      ServiceMBI/Check/ModeCheck/ElementRangeCheck.cs
  77. 36 0
      ServiceMBI/Check/ModeCheck/ElementRangeCheckResult.cs
  78. 207 0
      ServiceMBI/Check/ModeCheck/EquipReferSystemCheck.cs
  79. 30 0
      ServiceMBI/Check/ModeCheck/EquipReferSystemCheckResult.cs
  80. 141 0
      ServiceMBI/Check/ModeCheck/EquipmentInSpaceCheck.cs
  81. 23 0
      ServiceMBI/Check/ModeCheck/EquipmentInSpaceCheckResult.cs
  82. 72 0
      ServiceMBI/Check/ModeCheck/EquipmentPartRefEqCheck.cs
  83. 21 0
      ServiceMBI/Check/ModeCheck/EquipmentPartRefEqCheckResult.cs
  84. 194 0
      ServiceMBI/Check/ModeCheck/FamilyNameCheck.cs
  85. 32 0
      ServiceMBI/Check/ModeCheck/FamilyNameCheckResult.cs
  86. 259 0
      ServiceMBI/Check/ModeCheck/FloorMissCheck.cs
  87. 20 0
      ServiceMBI/Check/ModeCheck/FloorMissCheckResult.cs
  88. 134 0
      ServiceMBI/Check/ModeCheck/FloorSequenceCheck.cs
  89. 20 0
      ServiceMBI/Check/ModeCheck/FloorSequenceCheckResult.cs
  90. 170 0
      ServiceMBI/Check/ModeCheck/GridCheck.cs
  91. 16 0
      ServiceMBI/Check/ModeCheck/GridCheckResult.cs
  92. 117 0
      ServiceMBI/Check/ModeCheck/ModeCheckBase.cs
  93. 27 0
      ServiceMBI/Check/ModeCheck/ModeCheckResultBase.cs
  94. 75 0
      ServiceMBI/Check/ModeCheck/ModeCheckTool.cs
  95. 138 0
      ServiceMBI/Check/ModeCheck/ParameterIntegrityCheck.cs
  96. 25 0
      ServiceMBI/Check/ModeCheck/ParameterIntegrityCheckResult.cs
  97. 120 0
      ServiceMBI/Check/ModeCheck/SagaPositionCheck.cs
  98. 19 0
      ServiceMBI/Check/ModeCheck/SagaPositionCheckCheckResult.cs
  99. 109 0
      ServiceMBI/Check/ModeCheck/SagaSignCheck.cs
  100. 0 0
      ServiceMBI/Check/ModeCheck/SagaSignCheckResult.cs

+ 4 - 0
.gitignore

@@ -23,3 +23,7 @@
 /TaskDatabase/obj/Debug
 /testDll/bin/Debug
 /testDll/obj/Debug
+/MBIUtility/bin/Debug
+/MBIUtility/obj/Debug
+/ServiceMBI.Request/bin/Debug
+/ServiceMBI.Request/obj/Debug

+ 1 - 6
Client/Class1.cs

@@ -1,13 +1,8 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows.Forms;
 using Client.Start;
-using NettyClient;
 
-namespace testDll
+namespace Client
 {
     public class Class1
     {

+ 0 - 9
Client/Client.csproj

@@ -78,9 +78,6 @@
       <HintPath>..\Dlls\SAGA.DotNetUtils.dll</HintPath>
     </Reference>
     <Reference Include="System" />
-    <Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
-    </Reference>
     <Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
     </Reference>
@@ -93,9 +90,6 @@
     <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
     </Reference>
-    <Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
-    </Reference>
     <Reference Include="System.IO.Compression.FileSystem" />
     <Reference Include="System.Management" />
     <Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -108,9 +102,6 @@
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
-    </Reference>
     <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
     </Reference>

+ 1 - 2
Client/MessageHandler.cs

@@ -1,5 +1,4 @@
-using Cn.Sagacloud.Proto;
-using NettyClient;
+using NettyClient;
 using NettyClient.proto;
 using Newtonsoft.Json;
 using System;

+ 24 - 2
Client/Start/RevitCmdExecutor.cs

@@ -33,7 +33,7 @@ namespace Client.Start
             string combineParam = AddFilePathParam(param, filePathList, ref addMessage);
             if (addMessage?.Result == false) return addMessage.ResultMsg;
             string msg = "";
-            command.Execute(combineParam, ref msg);
+            msg=command.Execute(combineParam);
             return msg;
         }
         /// <summary>
@@ -71,8 +71,30 @@ namespace Client.Start
             message = new CustomMessage(true, "Add Success");
             try
             {
+
                 JObject jObject = JObject.Parse(param);
-                jObject.Add(floorskey, new JArray((filePathList ?? new HashSet<string>()).ToArray()));
+                //解析字符串获取Json存储树结构
+                var keys = ServiceMBIBuiltInParameter.ReferFloors.Split('.');
+                if (keys.Length == 2)
+                {
+                    JArray checkItemsJArray = new JArray();
+                    foreach (string filePath in filePathList)
+                    {
+                        checkItemsJArray.Add(filePath);
+                    }
+                    if (jObject.ContainsKey(keys[0]))
+                    {
+                        var jcriteria = (JObject)jObject[keys[0]];
+                        jcriteria.Add(keys[1], checkItemsJArray);
+                    }
+                    else
+                    {
+                        JObject checkItemsJObject = new JObject();
+                        checkItemsJObject.Add(keys[1], checkItemsJArray);
+                        jObject.Add(keys[0], checkItemsJObject);
+                    }
+                }
+
                 return jObject.ToString();
             }
             catch (Exception e)

+ 3 - 2
Client/Start/ServiceMBIClientHandler.cs

@@ -6,6 +6,8 @@
 
 using System;
 using System.Windows.Forms;
+using TaskDatabase;
+using TaskDatabase.Model;
 
 namespace Client.Start
 {
@@ -17,8 +19,7 @@ namespace Client.Start
         private static ClientApp m_Client;
         public static void Start()
         {
-            
-            m_Client = new ClientApp("172.16.0.183", 6666, "E:\\", 3, new RevitCmdExecutor(), 5);
+            m_Client = new ClientApp("172.16.0.131", 6666, "E:\\", 3, new RevitCmdExecutor(), 5);
             m_Client.Start();
             //Console.ReadKey();
         }

+ 7 - 9
Client/TaskHandler.cs

@@ -1,13 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using HttpDownload;
+using HttpDownload;
 using NettyClient;
 using NettyClient.proto;
 using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Threading;
 using TaskDatabase;
 using TaskDatabase.Model;
 
@@ -151,7 +148,7 @@ namespace Client
             this.defaultFileDir = defaultFileDir;
             this.revitCommandExcutor = revitCommandExcutor;
         }
-
+    
         internal void SyncAllTask()
         {
             IList<TaskModel> tasks = taskService.GetTasksByStatus(0); // 任务状态 0 未执行完的任务, 1 执行完成  -1 下载出错  -2 revit命令执行异常
@@ -170,7 +167,8 @@ namespace Client
                 }
                 return true;
             }
-            catch {
+            catch(Exception ex) {
+                Console.WriteLine(ex.Message+ex.StackTrace);
                 return false;
             }
         }

+ 4 - 0
Client/app.config

@@ -62,6 +62,10 @@
         <assemblyIdentity name="DotNetty.Codecs" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-0.6.0.0" newVersion="0.6.0.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
 </configuration>

+ 0 - 110
ClientTests/ClientTests.csproj

@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>ClientTests</RootNamespace>
-    <AssemblyName>ClientTests</AssemblyName>
-    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
-    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
-    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
-    <IsCodedUITest>False</IsCodedUITest>
-    <TestProjectType>UnitTest</TestProjectType>
-    <TargetFrameworkProfile />
-    <NuGetPackageImportStamp>
-    </NuGetPackageImportStamp>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>..\OutputDll\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
-    </Reference>
-    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
-      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-  </ItemGroup>
-  <Choose>
-    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
-      </ItemGroup>
-    </When>
-    <Otherwise />
-  </Choose>
-  <ItemGroup>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Start\RevitCmdExecutorTests.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="app.config" />
-    <None Include="packages.config" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Client\Client.csproj">
-      <Project>{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}</Project>
-      <Name>Client</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Choose>
-    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
-      <ItemGroup>
-        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-          <Private>False</Private>
-        </Reference>
-      </ItemGroup>
-    </When>
-  </Choose>
-  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
-    <PropertyGroup>
-      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
-    </PropertyGroup>
-    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props'))" />
-    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets'))" />
-  </Target>
-  <Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 32
ClientTests/Start/RevitCmdExecutorTests.cs

@@ -1,32 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Client.Start;
-/* ==============================================================================
-* 功能描述:RevitCmdExecutorTests  
-* 创 建 者:Garrett
-* 创建日期:2019/4/16 14:40:52
-* ==============================================================================*/
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Newtonsoft.Json.Linq;
-
-namespace Client.Start.Tests
-{
-    [TestClass()]
-    public class RevitCmdExecutorTests
-    {
-        [TestMethod()]
-        public void ExecuteCmdTest()
-        {
-            JObject jObject=new JObject();
-            jObject.Add("ProjectId", "Pj4201050001");
-            jObject.Add("UserId", "18612660722");
-            string json = jObject.ToString();
-            var executor=new RevitCmdExecutor();
-            executor.ExecuteCmd("DataCheckCommand", json, new HashSet<string>());
-            Assert.Fail();
-        }
-    }
-}

+ 0 - 67
ClientTests/app.config

@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <runtime>
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-      <dependentAssembly>
-        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-3.2.0.0" newVersion="3.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Options.ConfigurationExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="DotNetty.Transport" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-0.6.0.0" newVersion="0.6.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="DotNetty.Buffers" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-0.6.0.0" newVersion="0.6.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="DotNetty.Common" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-0.6.0.0" newVersion="0.6.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="DotNetty.Codecs" publicKeyToken="bc13ca065fa06c29" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-0.6.0.0" newVersion="0.6.0.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
-</configuration>

+ 0 - 6
ClientTests/packages.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="MSTest.TestAdapter" version="1.1.18" targetFramework="net461" />
-  <package id="MSTest.TestFramework" version="1.1.18" targetFramework="net461" />
-  <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
-</packages>

BIN
Dlls/R2016/AdWindows.dll


BIN
Dlls/R2016/RevitAPI.dll


BIN
Dlls/R2016/RevitAPIIFC.dll


BIN
Dlls/R2016/RevitAPILink.dll


BIN
Dlls/R2016/RevitAPIUI.dll


BIN
Dlls/R2016/RevitAPIUILink.dll


BIN
Dlls/SAGA.DotNetUtils.dll


BIN
Dlls/SAGA.Models.dll


+ 121 - 0
MBIUtility/Extend/DocExtend.cs

@@ -0,0 +1,121 @@
+/* ==============================================================================
+ * 功能描述:DocExtend  
+ * 创 建 者:Garrett
+ * 创建日期:2018/6/11 16:00:53
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Autodesk.Revit.DB;
+using SAGA.DotNetUtils;
+using SAGA.RevitUtils.Extends;
+
+namespace MBIUtility.Extend
+{
+    /// <summary>
+    /// DocExtend
+    /// </summary>
+    public static class DocExtend
+    {
+
+        public static readonly string MBIResourcePath = Path.Combine(AppBaseInfo.AppRunPath, "MBIResource");
+        public static readonly string EmptyFilePath = Path.Combine(MBIResourcePath, "EmptyFile\\EmptyProject.rvt");
+        /// <summary>
+        /// 关闭文档
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        public static bool CloseDoc(string path)
+        {
+            if (path == null || !File.Exists(path)) return false;
+            bool result = true;
+            try
+            {
+                //打开空文件并激活
+                var placeholderFile = EmptyFilePath;
+                var uiApp = ExternalDataWrapper.Current.UiApp;
+                var docs = uiApp.Application.Documents;
+                if (docs.IsEmpty) return result;
+                if (uiApp.ActiveUIDocument != null && uiApp.ActiveUIDocument.Document.PathName == path)
+                {
+                    var docCur = uiApp.ActiveUIDocument;
+                    uiApp.OpenAndActivateDocument(placeholderFile);
+                    result = docCur.SaveAndClose();
+                }
+                else
+                {
+                    foreach (Document doc in docs)
+                    {
+                        if (doc.PathName == path)
+                        {
+                            //版本升级,保存
+                            var verionName = doc.Application.VersionName;
+                            var info = BasicFileInfo.Extract(doc.PathName);
+                            var savedInVersion = info.SavedInVersion; //<==Autodesk Revit 2014  
+                            result = doc.Close(verionName != savedInVersion || doc.IsModified);
+                        }
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+            }
+
+
+            return result;
+        }
+        /// <summary>
+        /// 关闭文档
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        public static bool CloseDoc(this Document doc)
+        {
+            return CloseDoc(doc?.PathName);
+        }
+        /// <summary>
+        /// 简单关闭模型不保存
+        /// </summary>
+        /// <param name="doc"></param>
+        /// <returns></returns>
+        public static bool CloseDocSimple(this Document doc)
+        {
+            bool result = true;
+            var basePath = doc.PathName;
+            var uiApp = ExternalDataWrapper.Current.UiApp;
+            if (uiApp.ActiveUIDocument != null && uiApp.ActiveUIDocument.Document.PathName == basePath)
+            {
+                result= false;
+            }
+            else
+            {
+                result= doc.Close();
+            }
+            return result;
+        }
+        /// <summary>
+        /// 由code获取FamilySymbol
+        /// </summary>
+        /// <param name="doc"></param>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        public static FamilySymbol GetFamilySymbol(this Document doc, string code)
+        {
+            Func<string, bool> filterFamily = (t) =>
+            {
+                return Regex.IsMatch(t, $@"{code}\s*-\s*\S*");
+            };
+            List<Family> listFamily = doc.GetFamilys();
+            var fa = listFamily.FirstOrDefault(t => filterFamily(t.Name));
+            List<FamilySymbol> symbolList = fa?.GetFamilySymbols();
+            var fs= symbolList?.FirstOrDefault();
+            if (fs!=null&&!fs.IsActive)
+                fs.Activate();
+            return fs;
+        }
+    }
+}

+ 232 - 0
MBIUtility/Extend/ElementExtend.cs

@@ -0,0 +1,232 @@
+/* ==============================================================================
+ * 功能描述:ElementExtend  
+ * 创 建 者:Garrett
+ * 创建日期:2018/5/28 16:41:22
+ * ==============================================================================*/
+
+using System.Linq;
+using System.Text.RegularExpressions;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Mechanical;
+using MBIUtility.Tool;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
+using SAGA.RevitUtils.Extends;
+
+namespace MBIUtility.Extend
+{
+    /// <summary>
+    /// ElementExtend
+    /// </summary>
+    public static class ElementExtend
+    {
+        //信标族名称
+        public static string BeaconFamilyName = "Beacon";
+        /// <summary>
+        /// 判断是否为设备 设备族为4位
+        /// ATVR - 多联机 - 室内机 - 双向气流 - 天花板嵌入式
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        public static bool IsEquipment(this FamilyInstance fi)
+        {
+            var family = fi.GetFamily().Name;
+            return Regex.IsMatch(family, @"^[A-Z]{4}\s*-\s*\S*");
+        }
+        /// <summary>
+        /// 判断是否为设备部件 设备族为6位
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        public static bool IsEquipmentPart(this FamilyInstance fi)
+        {
+            var family = fi.GetFamily().Name;
+            return Regex.IsMatch(family, @"^[A-Z]{6}\s*-\s*\S*");
+        }
+        /// <summary>
+        /// 设备mbi设备名称解析
+        /// </summary>
+        /// <param name="family"></param>
+        /// <returns></returns>
+        public static bool IsMbiEquipment(this Family family)
+        {
+            var familyName = family.Name;
+            if (string.IsNullOrEmpty(familyName))
+                return false;
+            return Regex.IsMatch(familyName, @"^[A-Z]{4}\s*-\s*\S*") || Regex.IsMatch(familyName, @"^[A-Z]{6}\s*-\s*\S*");
+        }
+        /// <summary>
+        /// 判断是否为信标
+        /// </summary>
+        /// <param name="elem"></param>
+        /// <returns></returns>
+        public static bool IsBeacon(this FamilyInstance elem)
+        {
+            var family = elem.GetFamily().Name;
+            return (Regex.IsMatch(family, BeaconFamilyName));
+        }
+
+        /// <summary>
+        /// 判断是否为空间,判断周长是否为零
+        /// 如果周长为零,是删除的空间
+        /// </summary>
+        /// <param name="elem"></param>
+        /// <param name="ischeckzero">是否检查周长为零</param>
+        /// <returns></returns>
+        public static bool IsSpace(this Element elem, bool ischeckzero = true)
+        {
+            var isspace = false;
+            if (elem is Space space)
+            {
+                //空间比较特殊,周长为零就相当于删除
+                isspace = !ischeckzero || !(space.IsDeleteSpace());
+                //限制所用空间的阶段
+                //isspace = isspace && space.IsPhase1Space();
+            }
+
+            return isspace;
+        }
+
+        /// <summary>
+        /// 获取云平台存储的BimId
+        /// 文件名:Id
+        /// </summary>
+        /// <param name="elem"></param>
+        /// <returns></returns>
+        public static string GetCloudBIMId(this Element elem)
+        {
+            var doc = elem.Document;
+            var pathName = doc.PathName;
+            //楼层文件名称,无后缀
+            var docName = pathName.GetFileName();
+            var id = elem.Id.ToString();
+            return CommonTool.GetCloudBIMId(docName, id);
+        }
+        /// <summary>
+        /// 获取MBI的定位点
+        /// </summary>
+        /// <param name="element"></param>
+        /// <returns></returns>
+        public static XYZ GetLocationPointMBIXYZ(this Element element)
+        {
+            ////定位点不可靠,未来可能会更改为Box的中心点
+            //XYZ bimXyz = element.GetLocationPoint();
+            //if (element is FamilyInstance fi)
+            //{
+            //    var family = fi.GetFamily();
+            //    if (family.IsInPlace)
+            //    {
+            //        bimXyz = fi.GetBoxCenter();
+            //    }
+            //}
+            //定位点改为Box中心点 
+            XYZ bimXyz = element.GetBoxCenter();
+
+            return bimXyz;
+        }
+        /// <summary>
+        /// 获取MBI存储的位置信息
+        /// </summary>
+        /// <returns></returns>
+        public static string GetLocationPointMBI(this Element element)
+        {
+            string str = ",,";
+            XYZ bimXyz = element.GetLocationPointMBIXYZ();
+            if (bimXyz != null)
+            {
+                str = bimXyz.FromApi().ToString(null);
+            };
+            //JObject jObject = new JObject();
+            //jObject.Add("X", bimXyz.X);
+            //jObject.Add("Y", bimXyz.Y);
+            //jObject.Add("Z", bimXyz.Z);
+            //return (new JArray(jObject)).ToString();
+            return str;
+        }
+        /// <summary>
+        /// 获取MBI存储的位置信息
+        /// </summary>
+        /// <returns></returns>
+        public static XYZ ToXyz(this string xyzstr)
+        {
+            XYZ xyz = null;
+            var strs = xyzstr.Split(',');
+            if (strs.Length == 3)
+            {
+                xyz = new XYZ(strs[0].ToDouble(), strs[1].ToDouble(), strs[2].ToDouble());
+            }
+            //JObject jObject = new JObject();
+            //jObject.Add("X", bimXyz.X);
+            //jObject.Add("Y", bimXyz.Y);
+            //jObject.Add("Z", bimXyz.Z);
+            //return (new JArray(jObject)).ToString();
+            return xyz;
+        }
+
+        /// <summary>
+        /// 获取设备的种族类型编码 ATFC
+        /// 族名称的命名规则:ATFC-风机盘管
+        /// </summary>
+        /// <returns></returns>
+        public static string GetFamilyCode(this Element fi)
+        {
+            string code = "";
+            string familyName = fi.GetFamily()?.Name;
+            if (familyName == null) return code;
+            //族名称的命名规则:ATFC-风机盘管
+            int index = familyName.IndexOf('-');
+            if (index != -1 && index + 1 != familyName.Length)
+                code = familyName.Substring(0, familyName.IndexOf('-'));
+            //移除前面和后面的空格
+            return code.Trim();
+        }
+        /// <summary>
+        /// 获取关联的空间
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        public static Space GetReferenceSpace(this FamilyInstance fi)
+        {
+            Space space = fi.Space;
+            if (space != null) return space;
+            var spaces = fi.Document.GetSpaces().Where(t => t.IsValidObject).ToList();
+            Space temSpace2 = null;
+            var origin1 = fi.GetLocationPointMBIXYZ();
+            var origin2 = fi.GetBoxCenter();
+            foreach (Space tempSpace in spaces)
+            {
+                //没有Space属性,取定位点,判断定位点所在空间
+                if (tempSpace.IsPointInSpace(origin1))
+                {
+                    space = tempSpace;
+                    break;
+                }
+
+                //还没有找到空间,取Box中心点,判断点所在空间
+                if (temSpace2 != null) continue;
+                if (tempSpace.IsPointInSpace(origin2))
+                {
+                    temSpace2 = tempSpace;
+                }
+            }
+
+            return space ?? (temSpace2);
+        }
+
+        /// <summary>
+        /// 获取部件所关联的设备
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        public static FamilyInstance GetPartParentInstance(this FamilyInstance fi)
+        {
+            Document doc = fi.Document;
+            string family = fi.GetFamily().Name.Substring(0, 4);
+            //构件所关联的设备
+            var parentInst = doc.GetElements(new ElementIntersectsElementFilter(fi))
+                .FirstOrDefault(t => t is FamilyInstance && !t.Id.IsEqual(fi.Id) && t.GetFamilyCode() == family);
+            
+            return parentInst as FamilyInstance;
+        }
+    }
+}

+ 167 - 0
MBIUtility/Extend/StringExtend.cs

@@ -0,0 +1,167 @@
+/* ==============================================================================
+ * 功能描述:StringExtend  
+ * 创 建 者:Garrett
+ * 创建日期:2018/5/29 10:51:45
+ * ==============================================================================*/
+
+using System;
+using Newtonsoft.Json.Linq;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
+
+namespace MBIUtility.Extend
+{
+    /// <summary>
+    /// StringExtend
+    /// </summary>
+    public static class StringExtend
+    {
+
+        /// <summary>
+        /// 云平台BIMId转化为Revit Id
+        /// 去掉文件名前缀,找不到返回值为0
+        /// </summary>
+        /// <returns></returns>
+        public static int GetBIMID(this string cbimId)
+        {
+            try
+            {
+                string bimId = cbimId;
+                var strs = cbimId.Split(':');
+                if (strs.Length > 1)
+                    bimId = strs[1];
+                return bimId.ToInt();
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+                return 0;
+            }
+
+        }
+
+        /// <summary>
+        /// 仅保留岗位,没有对应模型的bimid
+        /// 格式为:
+        /// a,只有楼层 id,没有模型bimid
+        /// b,""
+        /// </summary>
+        /// <returns></returns>
+        public static bool IsOnlyDutyNoModelBIMID(this string cbimId)
+        {
+            var strs = cbimId.Split(':');
+            return strs.Length != 2;
+        }
+        /// <summary>
+        /// 云平台BIMId转化为Floor Id
+        /// 去掉文件名后缀
+        /// </summary>
+        /// <returns></returns>
+        public static string GetFloorId(this string cbimId)
+        {
+            string bimId = cbimId;
+            var strs = cbimId.Split(':');
+            if (strs.Length > 1)
+                bimId = strs[0];
+            return bimId;
+        }
+
+      
+        /// <summary>
+        /// 返回数据是验证-带message
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public static bool IsSuccessRequest(this string request, ref string msg)
+        {
+            bool result = false;
+            if (request.IsNullOrEmpty()) return result;
+            try
+            {
+                JObject jObject = JObject.Parse(request);
+                result = jObject["Result"].ToString() == "success";
+                msg = jObject["ResultMsg"].ToString();
+            }
+            catch (Exception e)
+            {
+                result = false;
+                msg = e.StackTrace;
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 返回数据是验证
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public static bool IsSuccessRequest(this string request)
+        {
+            bool result = false;
+            if (request.IsNullOrEmpty()) return result;
+            try
+            {
+                JObject jObject = JObject.Parse(request);
+                result = jObject["Result"].ToString() == "success";
+            }
+            catch (Exception e)
+            {
+                result = false;
+            }
+            return result;
+        }
+        /// <summary>
+        /// 返回数据是否正确
+        /// 数据格式为result,message
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public static bool IsSuccessRequest2(this string request, ref string msg)
+        {
+            bool result = false;
+            if (request.IsNullOrEmpty()) return result;
+            try
+            {
+                JObject jObject = JObject.Parse(request);
+                result = jObject["result"].ToString() == "success";
+                msg = jObject["message"].ToString();
+            }
+            catch (Exception e)
+            {
+                result = false;
+            }
+            return result;
+        }
+
+        /// <summary>
+        /// 返回的集合不为空集合
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public static bool IsRequestHasItem(this string request)
+        {
+            bool result = false;
+            if (IsSuccessRequest(request))
+            {
+                try
+                {
+                    JObject jObject = JObject.Parse(request);
+                    if (jObject.IsContainKeyEx("Count"))
+                    {
+                        result = jObject.GetValueEx("Count").ToInt() != 0;
+                    }
+                    else
+                    {
+                        if (jObject.IsContainKeyEx("Content"))
+                            result = ((JArray)jObject["Content"]).Count != 0;
+                    }
+                }
+                catch (Exception e)
+                {
+                    result = false;
+                }
+            }
+            return result;
+        }
+    }
+}

+ 69 - 0
MBIUtility/MBIUtility.csproj

@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{E7596286-A66B-4A61-B6AC-480512E978A4}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MBIUtility</RootNamespace>
+    <AssemblyName>MBIUtility</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="RevitAPI">
+      <HintPath>..\Dlls\RevitRefDll\RevitAPI.dll</HintPath>
+    </Reference>
+    <Reference Include="RevitAPIUI">
+      <HintPath>..\Dlls\RevitRefDll\RevitAPIUI.dll</HintPath>
+    </Reference>
+    <Reference Include="SAGA.DotNetUtils">
+      <HintPath>..\Dlls\SAGA.DotNetUtils.dll</HintPath>
+    </Reference>
+    <Reference Include="SAGA.RevitUtils">
+      <HintPath>..\Dlls\SAGA.RevitUtils.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Extend\DocExtend.cs" />
+    <Compile Include="Extend\ElementExtend.cs" />
+    <Compile Include="Extend\StringExtend.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Tool\CommonTool.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="app.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 6 - 0
MBIUtility/MBIUtility.csproj.user

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectView>ShowAllFiles</ProjectView>
+  </PropertyGroup>
+</Project>

+ 7 - 7
ClientTests/Properties/AssemblyInfo.cs

@@ -5,22 +5,22 @@ using System.Runtime.InteropServices;
 // 有关程序集的一般信息由以下
 // 控制。更改这些特性值可修改
 // 与程序集关联的信息。
-[assembly: AssemblyTitle("ClientTests")]
+[assembly: AssemblyTitle("MBIUtility")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("ClientTests")]
+[assembly: AssemblyProduct("MBIUtility")]
 [assembly: AssemblyCopyright("Copyright ©  2019")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 
-//将 ComVisible 设置为 false 将使此程序集中的类型
-//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
 //请将此类型的 ComVisible 特性设置为 true。
 [assembly: ComVisible(false)]
 
 // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("5efc2c05-9af3-4b1a-878a-b6e7599c43fe")]
+[assembly: Guid("e7596286-a66b-4a61-b6ac-480512e978a4")]
 
 // 程序集的版本信息由下列四个值组成: 
 //
@@ -29,8 +29,8 @@ using System.Runtime.InteropServices;
 //      生成号
 //      修订号
 //
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: :
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
 // [assembly: AssemblyVersion("1.0.*")]
 [assembly: AssemblyVersion("1.0.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 190 - 0
MBIUtility/Tool/CommonTool.cs

@@ -0,0 +1,190 @@
+/* ==============================================================================
+ * 功能描述:CommonTool  
+ * 创 建 者:Garrett
+ * 创建日期:2018/3/13 17:26:29
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Autodesk.Revit.DB;
+using Newtonsoft.Json.Linq;
+using SAGA.DotNetUtils.Extend;
+
+namespace MBIUtility.Tool
+{
+    /// <summary>
+    /// CommonTool
+    /// </summary>
+    public class CommonTool
+    {
+     
+        /// <summary>
+        /// 获取楼层顺序号
+        /// </summary>
+        /// <param name="cur">当前顺序号</param>
+        /// <param name="seed">上面增加(1)下面增加是(-1)</param>
+        /// <returns></returns>
+        public static int GetNewSequence(int cur, int seed)
+        {
+            if (seed == -1)
+            {
+                cur = cur < 0 ? cur + seed : cur;
+            }
+            else
+            {
+                cur = cur < 0 ? cur : cur + seed;
+            }
+
+            return cur;
+        }
+        /// <summary>
+        /// 获取楼层顺序号
+        /// </summary>
+        /// <param name="cur">当前顺序号</param>
+        /// <param name="seed">上面增加(1)下面增加是(-1)</param>
+        /// <returns></returns>
+        public static int GetNextSequence(int cur)
+        {
+            cur = cur > 0 ? cur + 1 : cur - 1;
+
+            return cur;
+        }
+
+        /// <summary>
+        /// 由楼层顺序号获取生成revit文件的文件名称;
+        /// 默认为B1,B2,F1,F2...
+        /// </summary>
+        /// <param name="sequence"></param>
+        /// <returns></returns>
+        public static string GetFloorRevitFileName(int sequence)
+        {
+            if (sequence > 0)
+                return "F" + sequence;
+            else
+            {
+                return "B" + Math.Abs(sequence);
+            }
+        }
+        /// <summary>
+        /// 信息点置为null
+        /// </summary>
+        public readonly  static string NullStr="Nlul";
+        public static JArray GetPropertyJArray(string value)
+        {
+            JArray jArray = new JArray();
+            if (value == null)
+                return jArray;
+            JObject valueJObject = new JObject();
+            if (value.Equals(NullStr))
+            {
+                valueJObject.Add("value", null);
+            }
+            else
+            {
+                valueJObject.Add("value", value);
+            }
+            jArray.Add(valueJObject);
+            return jArray;
+        }
+        /// <summary>
+        /// 获取信息点更新是传递的数据结构
+        /// </summary>
+        /// <param name="code"></param>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static JObject GetPropertyJObject(string code,string value)
+        {
+            #region 构建array
+            JArray jArray = new JArray();
+            JObject valueJObject = new JObject();
+            valueJObject.Add("value", value);
+            jArray.Add(valueJObject);
+            #endregion
+            JObject jObject = new JObject();
+            jObject.Add(code, jArray);
+            return jObject;
+        }
+        public static JArray GetPropertyJArray(string time, string value)
+        {
+            JArray jArray = new JArray();
+            JObject valueJObject = new JObject();
+            valueJObject.Add("time", time);
+            valueJObject.Add("value", value);
+            jArray.Add(valueJObject);
+            return jArray;
+        }
+        public static JArray GetPropertyJArray(JToken value)
+        {
+            JArray jArray = new JArray();
+            JObject valueJObject = new JObject();
+            valueJObject.Add("value", value);
+            jArray.Add(valueJObject);
+            return jArray;
+        }
+        /// <summary>
+        /// 由文件的全路径获取云端文件名
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        public static string GetCloudRevitName(string path)
+        {
+            var strs = path.Split('\\', ':');
+            List<string> last3Strs = new List<string>();
+            for (int i = strs.Length - 3; i < strs.Length; i++)
+            {
+                last3Strs.Add(strs[i]);
+            }
+            string fileName = string.Join("_", last3Strs.ToArray());
+            return fileName;
+        }
+
+        /// <summary>
+        /// 将点按 “;”进行分组
+        /// </summary>
+        /// <param name="xyzs"></param>
+        /// <returns></returns>
+        public static string ConvertSpaceEdgesToStr(List<XYZ> xyzs)
+        {
+            var strs = xyzs.Select(t => t.X + "," + t.Y);
+            var str = string.Join(";", strs.ToArray());
+            return str;
+        }
+
+      
+        /// <summary>
+        /// 创建个资产id
+        /// id为Pe+uuid(去掉横线)
+        /// </summary>
+        /// <returns></returns>
+        public static string CreateNewFmId()
+        {
+            string id = System.Guid.NewGuid().ToString("N");
+            return "Pe" + id;
+        }
+        /// <summary>
+        /// 获取BIMId
+        /// </summary>
+        /// <param name="docName"></param>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public static string GetCloudBIMId(string docName, string id)
+        {
+            return $"{docName}:{id}";
+        }
+
+    
+        /// <summary>
+        /// 由视频预览图--获取视频的名称
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        public static string GetVideoKeyByImageKey(string name)
+        {
+            string videoSuffix = ".mp4";
+            return name.GetAppointSuffixPath(videoSuffix);
+        }
+    
+    }
+}

+ 11 - 0
MBIUtility/app.config

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 4 - 0
MBIUtility/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
+</packages>

+ 2 - 2
NettyClient/SimpleMessageHandler.cs

@@ -2,7 +2,7 @@
 using System;
 using System.Collections.Concurrent;
 using System.Windows.Forms;
-using Message = Cn.Sagacloud.Proto.Message;
+using Message = NettyClient.proto.Message;
 
 namespace NettyClient
 {
@@ -60,7 +60,7 @@ namespace NettyClient
 
         public void toString(Message msg)
         {
-            MessageBox.Show("Received from server: cmd : " + msg.Cmd + ", taskId : " + msg.TaskId + ", content : " + msg.Content);
+            Console.WriteLine("Received from server: cmd : " + msg.Cmd + ", taskId : " + msg.TaskId + ", content : " + msg.Content);
         }
         public bool WriteMessage(Message message)
         {

+ 1 - 1
NettyClient/TaskNettyClient.cs

@@ -7,7 +7,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using DotNetty.Codecs.Protobuf;
-using Message = Cn.Sagacloud.Proto.Message;
+using Message = NettyClient.proto.Message;
 
 namespace NettyClient
 {

+ 4 - 3
NettyClient/proto/MessageProto.cs

@@ -4,9 +4,10 @@
 // </auto-generated>
 #pragma warning disable 1591, 0612, 3021
 #region Designer generated code
+
 using pb = Google.Protobuf;
 using pbr = Google.Protobuf.Reflection;
-namespace Cn.Sagacloud.Proto
+namespace NettyClient.proto
 {
 
     /// <summary>Holder for reflection information generated from MessageProto.proto</summary>
@@ -28,7 +29,7 @@ namespace Cn.Sagacloud.Proto
       descriptor = pbr.FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr.FileDescriptor[] { },
           new pbr.GeneratedClrTypeInfo(null, new pbr.GeneratedClrTypeInfo[] {
-            new pbr.GeneratedClrTypeInfo(typeof(Cn.Sagacloud.Proto.Message), Cn.Sagacloud.Proto.Message.Parser, new[]{ "Cmd", "TaskId", "Content" }, null, null, null)
+            new pbr.GeneratedClrTypeInfo(typeof(Message), Message.Parser, new[]{ "Cmd", "TaskId", "Content" }, null, null, null)
           }));
     }
     #endregion
@@ -43,7 +44,7 @@ namespace Cn.Sagacloud.Proto
 
     [System.Diagnostics.DebuggerNonUserCodeAttribute]
     public static pbr.MessageDescriptor Descriptor {
-      get { return Cn.Sagacloud.Proto.MessageProtoReflection.Descriptor.MessageTypes[0]; }
+      get { return MessageProtoReflection.Descriptor.MessageTypes[0]; }
     }
 
     [System.Diagnostics.DebuggerNonUserCodeAttribute]

+ 1 - 2
NettyClient/proto/MessageUtil.cs

@@ -1,5 +1,4 @@
-using Cn.Sagacloud.Proto;
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;

+ 1 - 2
SAGA.Revit/App.xaml

@@ -1,7 +1,6 @@
-<Application x:Class="SAGA.Revit.App"
+<Application x:Class="SAGY.Revit.App"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:local="clr-namespace:SAGA.Revit"
              StartupUri="MainWindow.xaml">
     <Application.Resources>
          

+ 2 - 8
SAGA.Revit/App.xaml.cs

@@ -1,12 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows;
+using System.Windows;
 
-namespace SAGA.Revit
+namespace SAGY.Revit
 {
     /// <summary>
     /// App.xaml 的交互逻辑

+ 1 - 2
SAGA.Revit/MainWindow.xaml

@@ -1,9 +1,8 @@
-<Window x:Class="SAGA.Revit.MainWindow"
+<Window x:Class="SAGY.Revit.MainWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-        xmlns:local="clr-namespace:SAGA.Revit"
         mc:Ignorable="d"
         Title="上格云BIM" Height="300" Width="300">
 

+ 2 - 2
SAGA.Revit/MainWindow.xaml.cs

@@ -4,12 +4,12 @@
  * 创 建 者:SAGACLOUD
  * 创建日期:2017/9/17 
  * ==============================================================================*/
- 
+
 using System.Collections.Generic;
 using System.Windows;
 using SAGA.RevitMenu.Addin;
 
-namespace SAGA.Revit
+namespace SAGY.Revit
 {
     /// <summary>
     /// MainWindow.xaml 的交互逻辑

+ 1 - 1
SAGA.Revit/Properties/Resources.Designer.cs

@@ -8,7 +8,7 @@
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace SAGA.Revit.Properties
+namespace SAGY.Revit.Properties
 {
 
 

+ 1 - 1
SAGA.Revit/Properties/Settings.Designer.cs

@@ -8,7 +8,7 @@
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace SAGA.Revit.Properties
+namespace SAGY.Revit.Properties
 {
 
 

+ 1 - 3
SAGA.RevitMenu/Configuration/ButtonStyles.cs

@@ -1,7 +1,5 @@
-namespace TSZ.RevitMenu.Configuration
+namespace SAGA.RevitMenu.Configuration
 {
-    using System;
-
     public enum ButtonStyles
     {
         Separator,

+ 0 - 1
SAGA.RevitMenu/Configuration/MenuConfig.cs

@@ -18,7 +18,6 @@ using Autodesk.Windows;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Others;
 using SAGA.RevitMenu.Addin;
-using TSZ.RevitMenu.Configuration;
 using RibbonItem = Autodesk.Revit.UI.RibbonItem;
 using RibbonPanel = Autodesk.Revit.UI.RibbonPanel;
 

+ 0 - 1
SAGA.RevitMenu/Configuration/RevitRibbonOperate.cs

@@ -13,7 +13,6 @@ using System.Windows.Media.Imaging;
 using Autodesk.Revit.UI;
 using Autodesk.Windows;
 using SAGA.RevitUtils;
-using TSZ.RevitMenu.Configuration;
 using RibbonItem = Autodesk.Revit.UI.RibbonItem;
 using RibbonPanel = Autodesk.Revit.UI.RibbonPanel;
 

+ 1 - 3
SAGA.RevitMenu/Configuration/StackStyles.cs

@@ -1,7 +1,5 @@
-namespace TSZ.RevitMenu.Configuration
+namespace SAGA.RevitMenu.Configuration
 {
-    using System;
-
     public enum StackStyles
     {
         Normal,

+ 1 - 7
SAGA.RevitMenu/Configuration/TszButtonData.cs

@@ -1,11 +1,5 @@
-using SAGA.DotNetUtils;
-using SAGA.RevitMenu.Configuration;
-
-namespace TSZ.RevitMenu.Configuration
+namespace SAGA.RevitMenu.Configuration
 {
-    using System;
-    using System.Runtime.CompilerServices;
-
     public class TszButtonData
     {
         public TszButtonData(string menuTab)

+ 0 - 1
SAGA.RevitMenu/Configuration/TszPanelData.cs

@@ -3,7 +3,6 @@ using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using SAGA.RevitUtils;
-using TSZ.RevitMenu.Configuration;
 
 namespace SAGA.RevitMenu.Configuration
 {

+ 0 - 1
SAGA.RevitMenu/Configuration/TszTabData.cs

@@ -7,7 +7,6 @@
 
 using System.Collections.Generic;
 using System.Linq;
-using TSZ.RevitMenu.Configuration;
 
 namespace SAGA.RevitMenu.Configuration
 {

+ 0 - 1
SAGA.RevitMenu/Configuration/XmlMenuData.cs

@@ -13,7 +13,6 @@ using System.Xml;
 using SAGA.DotNetUtils;
 using SAGA.DotNetUtils.Others;
 using SAGA.RevitUtils;
-using TSZ.RevitMenu.Configuration;
 
 namespace SAGA.RevitMenu.Configuration
 {

+ 13 - 22
SAGA.RevitMenu/MenuApp.cs

@@ -5,21 +5,12 @@
  * 创建日期:2017/8/30
  * ==============================================================================*/
 
+using System;
 using Autodesk.Revit.Attributes;
 using Autodesk.Revit.DB;
 using Autodesk.Revit.UI;
-using Client;
-using SAGA.DotNetUtils;
-using SAGA.DotNetUtils.Others;
-using SAGA.RevitUtils;
+using SAGA.RevitUtils.ErrorSupports;
 using SAGA.RevitUtils.Extends;
-using ServiceMBI.Modes;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using Client.Start;
-using Microsoft.Extensions.Logging.Abstractions;
 
 namespace SAGA.RevitMenu
 {
@@ -31,8 +22,7 @@ namespace SAGA.RevitMenu
 
         public override Result OnShutdown(UIControlledApplication application)
         {
-            //ErrorHandlers.Stop();
-            //RevitEventsBingding.RemoveEvents(application);
+            ErrorHandlers.Stop();
             base.OnShutdown(application);
 
             #region 关闭ServiceMBI服务
@@ -47,21 +37,22 @@ namespace SAGA.RevitMenu
 
         public override Result OnStartup(UIControlledApplication application)
         {
-            //ErrorHandlers.Start();
+            ErrorHandlers.Start();
             base.OnStartup(application);
-            //Class1.Show();
-            //RevitEventsBingding.AddEvents(application);
             //删除Addin文件
             //MenuConfig.ClearAddInFile(application);
 
-            //MessageShowBase.Infomation("PreStart");
-            //NettyClient.TaskNettyClient client = new NettyClient.TaskNettyClient("172.16.0.183", 6666);
-            //client.RunClientAsync(new NettyClient.SimpleMessageHandler()).Wait();
-            //MessageShowBase.Infomation("Start");
-
             #region 启动ServiceMBI服务
 
-            Client.Start.ServiceMBIClientHandler.Start();
+            try
+            {
+
+             Client.Start.ServiceMBIClientHandler.Start();
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+            }
            
             #endregion
 

+ 0 - 89
SAGA.RevitMenu/SAGA.RevitMenu.csproj

@@ -152,34 +152,6 @@
     <Reference Include="AdWindows">
       <HintPath>..\Dlls\RevitRefDll\AdWindows.dll</HintPath>
     </Reference>
-    <Reference Include="DotNetty.Buffers, Version=0.6.0.0, Culture=neutral, PublicKeyToken=bc13ca065fa06c29, processorArchitecture=MSIL">
-      <HintPath>..\packages\DotNetty.Buffers.0.6.0\lib\net45\DotNetty.Buffers.dll</HintPath>
-    </Reference>
-    <Reference Include="DotNetty.Codecs, Version=0.6.0.0, Culture=neutral, PublicKeyToken=bc13ca065fa06c29, processorArchitecture=MSIL">
-      <HintPath>..\packages\DotNetty.Codecs.0.6.0\lib\net45\DotNetty.Codecs.dll</HintPath>
-    </Reference>
-    <Reference Include="DotNetty.Common, Version=0.6.0.0, Culture=neutral, PublicKeyToken=bc13ca065fa06c29, processorArchitecture=MSIL">
-      <HintPath>..\packages\DotNetty.Common.0.6.0\lib\net45\DotNetty.Common.dll</HintPath>
-    </Reference>
-    <Reference Include="DotNetty.Transport, Version=0.6.0.0, Culture=neutral, PublicKeyToken=bc13ca065fa06c29, processorArchitecture=MSIL">
-      <HintPath>..\packages\DotNetty.Transport.0.6.0\lib\net45\DotNetty.Transport.dll</HintPath>
-    </Reference>
-    <Reference Include="Google.Protobuf, Version=3.7.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
-      <HintPath>..\packages\Google.Protobuf.3.7.0\lib\net45\Google.Protobuf.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.1.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Extensions.Logging, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Extensions.Logging.1.1.1\lib\netstandard1.1\Microsoft.Extensions.Logging.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
-      <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.1.1.0\lib\netstandard1.1\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
-    </Reference>
-    <Reference Include="Microsoft.Win32.Primitives">
-      <HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
@@ -204,10 +176,6 @@
       <HintPath>..\Dlls\SAGA.RevitUtils.dll</HintPath>
     </Reference>
     <Reference Include="System" />
-    <Reference Include="System.AppContext">
-      <HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
     </Reference>
@@ -215,70 +183,18 @@
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration.Install" />
-    <Reference Include="System.Console">
-      <HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.Core" />
     <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
     </Reference>
     <Reference Include="System.Drawing" />
     <Reference Include="System.Drawing.Design" />
-    <Reference Include="System.Globalization.Calendars">
-      <HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.IO.Compression">
-      <HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.IO.Compression.FileSystem" />
-    <Reference Include="System.IO.Compression.ZipFile">
-      <HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.IO.FileSystem">
-      <HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.IO.FileSystem.Primitives">
-      <HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.Management" />
-    <Reference Include="System.Net.Http">
-      <HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.Net.Sockets">
-      <HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.Numerics" />
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.InteropServices.RuntimeInformation">
-      <HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.Security.Cryptography.Algorithms">
-      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.Security.Cryptography.Encoding">
-      <HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.Security.Cryptography.Primitives">
-      <HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
-    <Reference Include="System.Security.Cryptography.X509Certificates">
-      <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -291,10 +207,6 @@
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />
-    <Reference Include="System.Xml.ReaderWriter">
-      <HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
-      <Private>True</Private>
-    </Reference>
     <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
@@ -327,7 +239,6 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />
-    <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Client\Client.csproj">

+ 2 - 7
SAGA.RevitMenu/Setting/StartSetting.cs

@@ -3,18 +3,13 @@
  * 创 建 者:Garrett
  * 创建日期:2017/9/28 15:47:34
  * ==============================================================================*/
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
+
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using Autodesk.Internal.Windows;
 using Autodesk.Revit.UI;
 using Autodesk.Windows;
-using SAGA.RevitUtils.Extends;
 
-namespace SAGA.RevitMenu.Dockpane
+namespace SAGA.RevitMenu.Setting
 {
     /// <summary>
     /// RegisterDockPaneBll

+ 1 - 2
SAGA.RevitMenu/ShortKey/ScreenMenuKeyBoardShortCut.cs

@@ -2,10 +2,9 @@
 using System.IO;
 using System.Xml;
 using SAGA.DotNetUtils;
-using SAGA.RevitMenu.ShortKey;
 using SAGA.RevitUtils;
 
-namespace SAGA.RevitMenu
+namespace SAGA.RevitMenu.ShortKey
 {
     public class ScreenMenuKeyBoardShortCut
     {

+ 1 - 1
SAGA.RevitMenu/app.config

@@ -24,7 +24,7 @@
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
+        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
       </dependentAssembly>
       <dependentAssembly>
         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />

+ 0 - 50
SAGA.RevitMenu/packages.config

@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
-  <package id="Microsoft.Extensions.Logging.Abstractions" version="1.1.0" targetFramework="net461" />
-  <package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
-  <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
-  <package id="NETStandard.Library" version="1.6.1" targetFramework="net461" />
-  <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
-  <package id="System.Collections" version="4.3.0" targetFramework="net461" />
-  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
-  <package id="System.Console" version="4.3.0" targetFramework="net461" />
-  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
-  <package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net461" />
-  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
-  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net461" />
-  <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
-  <package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net461" />
-  <package id="System.IO" version="4.3.0" targetFramework="net461" />
-  <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
-  <package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net461" />
-  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
-  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
-  <package id="System.Linq" version="4.3.0" targetFramework="net461" />
-  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
-  <package id="System.Net.Http" version="4.3.0" targetFramework="net461" />
-  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net461" />
-  <package id="System.Net.Sockets" version="4.3.0" targetFramework="net461" />
-  <package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
-  <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
-  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
-  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
-  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime.Handles" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
-  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
-  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
-  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
-  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
-  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
-  <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
-  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
-  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
-  <package id="System.Threading" version="4.3.0" targetFramework="net461" />
-  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
-  <package id="System.Threading.Timer" version="4.3.0" targetFramework="net461" />
-  <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
-  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
-</packages>

+ 1 - 1
ServiceMBI.Modes/IServiceCommand.cs

@@ -19,7 +19,7 @@ namespace ServiceMBI.Modes
     public interface IServiceCommand
     {
 
-        bool Execute(string param, ref string msg);
+        string Execute(string param);
 
     }
 }

+ 5 - 4
ServiceMBI.Modes/ServiceMBIBuiltInParameter.cs

@@ -19,20 +19,21 @@ namespace ServiceMBI.Modes
         /// <summary>
         /// 项目ID
         /// </summary>
-        public   const string ProjectId = "ProjectId";
+        public   const string ProjectId = "projectId";
         /// <summary>
         /// 用户名
         /// </summary>
-        public const string UserId = "UserId";
+        public const string UserId = "userId";
 
         /// <summary>
         /// 参考楼层
         /// </summary>
-        public const string ReferFloors = "ReferFloors";
+        public const string ReferFloors = "criteria.referFloors";
 
         /// <summary>
         /// 检查项
         /// </summary>
-        public const string CheckItems = "CheckItems";
+        public const string CheckItems = "criteria.checkItems";
+        
     }
 }

+ 36 - 0
ServiceMBI.Request/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("ServiceMBI.Request")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ServiceMBI.Request")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
+[assembly: Guid("c6ae336f-751f-412e-8b14-3caca781cf6c")]
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 46 - 0
ServiceMBI.Request/ServiceMBI.Request.csproj

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{C6AE336F-751F-412E-8B14-3CACA781CF6C}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ServiceMBI.Request</RootNamespace>
+    <AssemblyName>ServiceMBI.Request</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

+ 15 - 267
ServiceMBI.sln

@@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceMBI.Modes", "Service
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SAGA.Revit", "SAGA.Revit\SAGA.Revit.csproj", "{26C0661D-086C-4352-84B0-03B5D493EC77}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testDll", "testDll\testDll.csproj", "{146A0BCF-3995-4875-99EF-FCA0B4CFB663}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HttpDownload", "HttpDownload\HttpDownload.csproj", "{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}"
@@ -21,25 +19,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NettyClient", "NettyClient\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskDatabase", "TaskDatabase\TaskDatabase.csproj", "{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientTests", "ClientTests\ClientTests.csproj", "{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBIUtility", "MBIUtility\MBIUtility.csproj", "{E7596286-A66B-4A61-B6AC-480512E978A4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceMBI.Request", "ServiceMBI.Request\ServiceMBI.Request.csproj", "{C6AE336F-751F-412E-8B14-3CACA781CF6C}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
 		Debug|x64 = Debug|x64
 		Debug|x86 = Debug|x86
-		R17|Any CPU = R17|Any CPU
-		R17|x64 = R17|x64
-		R17|x86 = R17|x86
-		R18|Any CPU = R18|Any CPU
-		R18|x64 = R18|x64
-		R18|x86 = R18|x86
-		Release|Any CPU = Release|Any CPU
-		Release|x64 = Release|x64
-		Release|x86 = Release|x86
-		RR17|Any CPU = RR17|Any CPU
-		RR17|x64 = RR17|x64
-		RR17|x86 = RR17|x86
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -48,300 +36,60 @@ Global
 		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Debug|x64.Build.0 = Debug|Any CPU
 		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Debug|x86.Build.0 = Debug|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|Any CPU.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|x64.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|x64.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|x86.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R17|x86.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|Any CPU.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|x64.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|x64.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|x86.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.R18|x86.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|Any CPU.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|x64.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|x64.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|x86.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.Release|x86.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|x64.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|x64.Build.0 = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|x86.ActiveCfg = Release|Any CPU
-		{B57D1A6F-DCA8-4122-BD69-0EB97F7371EA}.RR17|x86.Build.0 = Release|Any CPU
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|x64.ActiveCfg = Debug|x64
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|x64.Build.0 = Debug|x64
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|x86.ActiveCfg = Debug|x86
 		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Debug|x86.Build.0 = Debug|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|Any CPU.ActiveCfg = R17|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|Any CPU.Build.0 = R17|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|x64.ActiveCfg = R17|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|x64.Build.0 = R17|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|x86.ActiveCfg = R17|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R17|x86.Build.0 = R17|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|Any CPU.ActiveCfg = R18|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|Any CPU.Build.0 = R18|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|x64.ActiveCfg = R18|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|x64.Build.0 = R18|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|x86.ActiveCfg = R18|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.R18|x86.Build.0 = R18|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|Any CPU.Build.0 = Release|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|x64.ActiveCfg = Release|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|x64.Build.0 = Release|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|x86.ActiveCfg = Release|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.Release|x86.Build.0 = Release|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|Any CPU.ActiveCfg = RR17|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|Any CPU.Build.0 = RR17|Any CPU
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|x64.ActiveCfg = RR17|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|x64.Build.0 = RR17|x64
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|x86.ActiveCfg = RR17|x86
-		{066EC682-BAA8-4CF8-AAE0-F08B962BA1DD}.RR17|x86.Build.0 = RR17|x86
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|x64.Build.0 = Debug|Any CPU
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Debug|x86.Build.0 = Debug|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|Any CPU.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|x64.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|x64.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|x86.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R17|x86.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|Any CPU.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|x64.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|x64.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|x86.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.R18|x86.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|x64.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|x64.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|x86.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.Release|x86.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|x64.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|x64.Build.0 = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|x86.ActiveCfg = Release|Any CPU
-		{676F1602-6F8A-44C7-BB81-2172D963AC1A}.RR17|x86.Build.0 = Release|Any CPU
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|x64.ActiveCfg = Debug|x64
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|x64.Build.0 = Debug|x64
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|x86.ActiveCfg = Debug|x86
 		{26C0661D-086C-4352-84B0-03B5D493EC77}.Debug|x86.Build.0 = Debug|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|Any CPU.ActiveCfg = R17|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|Any CPU.Build.0 = R17|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|x64.ActiveCfg = R17|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|x64.Build.0 = R17|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|x86.ActiveCfg = R17|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R17|x86.Build.0 = R17|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|Any CPU.ActiveCfg = R18|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|Any CPU.Build.0 = R18|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|x64.ActiveCfg = R18|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|x64.Build.0 = R18|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|x86.ActiveCfg = R18|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.R18|x86.Build.0 = R18|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|Any CPU.Build.0 = Release|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|x64.ActiveCfg = Release|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|x64.Build.0 = Release|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|x86.ActiveCfg = Release|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.Release|x86.Build.0 = Release|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|Any CPU.ActiveCfg = RR17|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|Any CPU.Build.0 = RR17|Any CPU
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|x64.ActiveCfg = RR17|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|x64.Build.0 = RR17|x64
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|x86.ActiveCfg = RR17|x86
-		{26C0661D-086C-4352-84B0-03B5D493EC77}.RR17|x86.Build.0 = RR17|x86
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|x64.Build.0 = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Debug|x86.Build.0 = Debug|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|Any CPU.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|x64.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|x64.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|x86.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R17|x86.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|Any CPU.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|x64.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|x64.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|x86.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.R18|x86.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|Any CPU.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|x64.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|x64.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|x86.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.Release|x86.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|x64.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|x64.Build.0 = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|x86.ActiveCfg = Release|Any CPU
-		{146A0BCF-3995-4875-99EF-FCA0B4CFB663}.RR17|x86.Build.0 = Release|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|x64.Build.0 = Debug|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Debug|x86.Build.0 = Debug|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|Any CPU.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|x64.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|x64.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|x86.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R17|x86.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|Any CPU.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|x64.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|x64.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|x86.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.R18|x86.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|x64.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|x64.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|x86.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.Release|x86.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|x64.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|x64.Build.0 = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|x86.ActiveCfg = Release|Any CPU
-		{6A52AF44-63C6-4AB6-92D4-2A05173D45FB}.RR17|x86.Build.0 = Release|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|x64.Build.0 = Debug|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Debug|x86.Build.0 = Debug|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|Any CPU.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|x64.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|x64.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|x86.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R17|x86.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|Any CPU.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|x64.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|x64.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|x86.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.R18|x86.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|x64.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|x64.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|x86.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.Release|x86.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|x64.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|x64.Build.0 = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|x86.ActiveCfg = Release|Any CPU
-		{9F423033-98A9-4B6B-9BB1-F1AA8C648A02}.RR17|x86.Build.0 = Release|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|x64.Build.0 = Debug|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Debug|x86.Build.0 = Debug|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|Any CPU.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|x64.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|x64.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|x86.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R17|x86.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|Any CPU.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|x64.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|x64.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|x86.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.R18|x86.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|Any CPU.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|x64.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|x64.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|x86.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.Release|x86.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|x64.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|x64.Build.0 = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|x86.ActiveCfg = Release|Any CPU
-		{7A08D4E8-A171-47BD-A527-BC9BA1833305}.RR17|x86.Build.0 = Release|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|x64.Build.0 = Debug|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|x86.ActiveCfg = Debug|Any CPU
 		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Debug|x86.Build.0 = Debug|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|Any CPU.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|x64.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|x64.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|x86.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R17|x86.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|Any CPU.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|x64.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|x64.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|x86.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.R18|x86.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|Any CPU.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|x64.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|x64.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|x86.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.Release|x86.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|x64.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|x64.Build.0 = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|x86.ActiveCfg = Release|Any CPU
-		{ADE36AA5-FCA8-4E5B-A27E-2360884404B3}.RR17|x86.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|x64.Build.0 = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Debug|x86.Build.0 = Debug|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|Any CPU.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|Any CPU.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|x64.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|x64.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|x86.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R17|x86.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|Any CPU.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|Any CPU.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|x64.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|x64.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|x86.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.R18|x86.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|x64.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|x64.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|x86.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.Release|x86.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|Any CPU.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|Any CPU.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|x64.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|x64.Build.0 = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|x86.ActiveCfg = Release|Any CPU
-		{5EFC2C05-9AF3-4B1A-878A-B6E7599C43FE}.RR17|x86.Build.0 = Release|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|x64.Build.0 = Debug|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{E7596286-A66B-4A61-B6AC-480512E978A4}.Debug|x86.Build.0 = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|x64.Build.0 = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{C6AE336F-751F-412E-8B14-3CACA781CF6C}.Debug|x86.Build.0 = Debug|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 21 - 1
ServiceMBI/App.config

@@ -1,6 +1,26 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
     <startup> 
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
     </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.0.0.999" newVersion="1.0.0.999" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="NPOI" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.4.1.0" newVersion="2.4.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="NPOI.OOXML" publicKeyToken="0df73ec7942b34e1" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-2.4.1.0" newVersion="2.4.1.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
 </configuration>

+ 60 - 0
ServiceMBI/Check/CheckBase/CheckContext.cs

@@ -0,0 +1,60 @@
+/* ==============================================================================
+ * 功能描述:DataCheckContext  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/29 14:43:26
+ * ==============================================================================*/
+
+using System.Collections.Generic;
+using SAGA.MBI.Model;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// DataCheckContext
+    /// </summary>
+    public class CheckContext
+    {
+        /// <summary>
+        /// 检查类型
+        /// </summary>
+        public CheckType CheckType { get; set; }
+        
+
+        private MProject m_MProject;
+
+        public MProject MProject
+        {
+            get { return m_MProject; }
+            set { m_MProject = value; }
+        }
+
+
+        private MBuilding m_Building;
+
+        public MBuilding Building
+        {
+            get { return m_Building; }
+            set { m_Building = value; }
+        }
+
+        private List<string> m_Floors;
+         /// <summary>
+         /// 检查的楼层
+         /// </summary>
+        public List<string> Floors
+        {
+            get { return m_Floors; }
+            set { m_Floors = value; }
+        }
+
+        private List<ICheckBase> m_CheckItems;
+        /// <summary>
+        /// 检查项
+        /// </summary>
+        public List<ICheckBase> CheckItems
+        {
+            get { return m_CheckItems; }
+            set { m_CheckItems = value; }
+        }
+    }
+}

+ 155 - 0
ServiceMBI/Check/CheckBase/CheckOperation.cs

@@ -0,0 +1,155 @@
+/* ==============================================================================
+ * 功能描述:CheckOperation  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/29 17:22:05
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Encrypt;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.Model;
+using ServiceMBI.Check.ModeCheck;
+using ServiceMBI.Commands;
+using ServiceMBI.Modes;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// CheckOperation
+    /// </summary>
+    public class CheckOperation
+    {
+        ///// <summary>
+        ///// 获取检查项
+        ///// </summary>
+        ///// <param name="type"></param>
+        ///// <returns></returns>
+        //public static List<ICheckBase> GetCheckItems(CheckType type,List<string> checkItems)
+        //{
+        //    List<ICheckBase> list = new List<ICheckBase>();
+        //    switch (type)
+        //    {
+        //        case CheckType.ModeCheck:
+        //            list = GetModeCheckItems(type.ToString(),checkItems);
+        //            break;
+        //        case CheckType.DataCheck:
+        //            break;
+        //    }
+        //    return list;
+        //}
+        public static CheckContext GetCheckContext(CheckCommandArgs args, CheckType type)
+        {
+            if (args == null) return null;
+            CheckContext context=new CheckContext();
+            context.CheckType = type;
+            context.Floors = args.ReferFloors;
+            context.CheckItems = GetCheckItems(context.CheckType, args.CheckItems);
+            return context;
+        }
+        /// <summary>
+        /// 获取模型检查的检查项
+        /// </summary>
+        /// <returns></returns>
+        public static List<ICheckBase> GetCheckItems(CheckType type, List<string> checkItems)
+        {
+            List<ModeCheckBase> list = new List<ModeCheckBase>();
+            foreach (var checkItem in checkItems)
+            {
+                string className = "ServiceMBI.Check."+ type+"." + checkItem;
+                Assembly tempAsembly = Assembly.GetExecutingAssembly();
+                var item = (tempAsembly.CreateInstance(className)) as ModeCheckBase;
+                if(item!=null)
+                    list.Add(item);
+            }
+            //var checkBase = new SagaSignCheck();
+            //list.Add(new FloorMiss());
+            //list.Add(new FloorSequenceCheck());
+            //list.Add(new UnitCheck());
+            //list.Add(new GridCheck());
+            //list.Add(new FamilyNameCheck());
+            //list.Add(new EquipmentPartRefEqCheck());
+            //list.Add(new ColumnCheck());
+            //list.Add(new ElementRangeCheck());
+            //list.Add(new SagaPositionCheck());
+            //list.Add(new ConnectorCheck());
+            //list.Add(new SystemCheck());
+            //list.Add(new EquipmentInSpaceCheck());
+            //list.Add(new EquipReferSystemCheck());
+            //list.Add(new ParameterIntegrityCheck());
+            //list.ForEach(t =>
+            //{
+            //    t.SetBaseCheck(checkBase);
+            //    t.RIsChecked = true;
+            //});
+            //list.Insert(0, checkBase);
+            return list.ToList<ICheckBase>();
+        }
+
+        /// <summary>
+        /// 执行检查并保存
+        /// </summary>
+        /// <param name="list"></param>
+        /// <param name="context"></param>
+        public static string Execute(CheckContext context)
+        {
+            JObject jObject=new JObject();
+            JArray jArray=new JArray();
+            jObject.Add("Result",jArray);
+            var list = context.CheckItems;
+            foreach (var floor in context.Floors)
+            {
+                string fullPath = floor;
+                //检查
+                list.ForEach(t => t.Check2(context,fullPath));
+
+                jArray.Add(SummaryResult(floor, list));
+            }
+            //关闭所有窗体
+            DocumentQueue.CloseAll();
+            return jObject.ToString();
+        }
+        
+        /// <summary>
+        /// 单层-检查结果汇总
+        /// </summary>
+        /// <param name="list"></param>
+        /// <param name="context"></param>
+        private static JObject SummaryResult(string floor,List<ICheckBase> list)
+        {
+            JObject jObject = null;
+            try
+            {
+                CheckFloorInfoResult floorInfo=new CheckFloorInfoResult();
+                floorInfo.FloorId = floor;
+                floorInfo.FloorName = floor.ToString();
+                floorInfo.LocalPath = floor;
+                //floorInfo.MD5 = MD5Tools.GetMD5HashFromFile(floorInfo.LocalPath);
+                jObject = JObject.Parse(JsonConvert.SerializeObject(floorInfo));
+                if (jObject != null)
+                {
+                    foreach (ICheckBase checkBase in list)
+                    {
+                        JProperty jProperty = checkBase.Export2();
+                        if (jProperty != null)
+                            jObject.Add(jProperty);
+                    }
+                }
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+
+            return jObject;
+        }
+    }
+}

+ 55 - 0
ServiceMBI/Check/CheckBase/CheckProcessAspect.cs

@@ -0,0 +1,55 @@
+/* ==============================================================================
+ * 功能描述:MyAspect  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/13 10:08:39
+ * ==============================================================================*/
+
+using System;
+using ArxOne.MrAdvice.Advice;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    [Serializable]
+    public class DataCheckProcessAspect :Attribute,IMethodAdvice //, OnMethodBoundaryAspect
+    {
+        private DateTime startTime;
+
+        public void Advise(MethodAdviceContext context)
+        {
+            OnEntry(context);
+            context.Proceed();
+            OnExit(context);
+        }
+
+        public  void OnEntry(MethodAdviceContext context)
+        {
+            
+            //base.OnExit(args);
+            var icheck = context.Target as ICheckBase;
+            if (icheck == null) return;
+            string name = icheck?.Name;
+            CheckProgressBarClient.Increase(name);
+            startTime = DateTime.Now;
+            CheckProgressBarClient.UpdataLog($"{name}:");
+            CheckProgressBarClient.UpdataLog($"\t开始时间:{DateTime.Now}");
+            //Thread.Sleep(500);
+        }
+
+        public  void OnExit(MethodAdviceContext context)
+        {
+            //base.OnExit(args);
+
+            var icheck = context.Target as ICheckBase;
+            if (icheck == null) return;
+            var duringTime = (DateTime.Now - startTime);
+            CheckProgressBarClient.UpdataLog($"\t结束时间:{DateTime.Now}");
+            CheckProgressBarClient.UpdataLog(string.Format("\t耗时:{0}{1}{2}{3}"
+                , duringTime.Hours == 0 ? "" : $"{duringTime.Hours}小时"
+                , duringTime.Minutes == 0 ? "" : $"{duringTime.Minutes}分钟"
+                , duringTime.Seconds == 0 ? "" : $"{duringTime.Seconds}秒"
+                , duringTime.Milliseconds == 0 ? "" : $"{duringTime.Milliseconds}毫秒")
+
+);
+        }
+    }
+}

+ 56 - 0
ServiceMBI/Check/CheckBase/CheckProgressBarClient.cs

@@ -0,0 +1,56 @@
+/* ==============================================================================
+ * 功能描述:ProgressBarClient  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/13 15:38:49
+ * ==============================================================================*/
+ 
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// ProgressBarClient
+    /// </summary>
+    class CheckProgressBarClient
+    {
+        private static int MaxValue { get; set; }
+
+        private static int CurValue { get; set; }
+        private static bool IsCloseAfterEnd { get; set; }
+
+        public static void UpdateBigTip(string tip)
+        {
+        }
+
+
+        public static void Start(string tip, int max,bool isclose=true)
+        {
+            Stop();
+
+            MaxValue = max;
+            IsCloseAfterEnd = isclose;
+        }
+        /// <summary>
+        /// 更新进度条显示
+        /// </summary>
+        /// <param name="tip"></param>
+        public static void Increase(string tip)
+        {
+            if (CurValue < MaxValue)
+            {
+                CurValue++;
+            }
+            if (CurValue >= MaxValue&& IsCloseAfterEnd)
+            {
+                Stop();
+            }
+        }
+
+        public static void Stop()
+        {
+            CurValue = 0;
+        }
+
+        public static void UpdataLog(string tip)
+        {
+        }
+    }
+}

+ 27 - 0
ServiceMBI/Check/CheckBase/CheckType.cs

@@ -0,0 +1,27 @@
+/* ==============================================================================
+ * 功能描述:CheckType  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/30 16:55:41
+ * ==============================================================================*/
+
+using System.ComponentModel;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// CheckType
+    /// </summary>
+    public enum CheckType
+    {
+        /// <summary>
+        /// 模型检查
+        /// </summary>
+        [Description("模型")]
+        ModeCheck,
+        /// <summary>
+        /// 数据检查
+        /// </summary>
+        [Description("垃圾数据")]
+        DataCheck,
+    }
+}

+ 31 - 0
ServiceMBI/Check/CheckBase/DCElementType.cs

@@ -0,0 +1,31 @@
+/* ==============================================================================
+ * 功能描述:DCElementType  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/16 17:06:13
+ * ==============================================================================*/
+
+using System.ComponentModel;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// DCElementType
+    /// </summary>
+    public enum DCElementType
+    {
+        [Description("未知")]
+        None,
+        [Description("墙")]
+        Wall,
+        [Description("柱")]
+        Column,
+        [Description("空间")]
+        Space,
+        [Description("设备")]
+        Equipment,
+        [Description("部件")]
+        EuipmentPart,
+        [Description("信标")]
+        Beacon
+    }
+}

+ 220 - 0
ServiceMBI/Check/CheckBase/DCNPOIExtend.cs

@@ -0,0 +1,220 @@
+/* ==============================================================================
+ * 功能描述:NPOI扩展
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/5 9:55:33
+ * ==============================================================================*/
+
+using NPOI.HSSF.Util;
+using NPOI.SS.UserModel;
+using NPOI.SS.Util;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// NPOIStyle
+    /// </summary>
+    public static class DCNPOIExtend
+    {
+
+        /// <summary>
+        /// 创建一个指定格式的单元格,并向其添加内容
+        /// </summary>
+        /// <param name="row"></param>
+        /// <param name="column"></param>
+        /// <param name="str"></param>
+        /// <param name="style"></param>
+        public static void AddCell(this IRow row, int column, string str, DataCheckNPOIStyle style = DataCheckNPOIStyle.Content, bool hasStyle = false)
+        {
+            ICell cell00 = row.GetCell(column);
+            if (cell00 == null)
+                cell00 = row.CreateCell(column);
+            if (hasStyle)
+                cell00.CellStyle = DCNPOIExtend.GetCellStyle(row.Sheet.Workbook, style);
+            cell00.SetCellType(NPOI.SS.UserModel.CellType.String);
+            cell00.SetCellValue(str);
+        }
+        /// <summary>
+        /// 合并单元格,并添加边框
+        /// </summary>
+        /// <param name="sheet"></param>
+        /// <param name="row0"></param>
+        /// <param name="row1"></param>
+        /// <param name="col0"></param>
+        /// <param name="col1"></param>
+        public static void MarginCellAndBorder(this ISheet sheet, int row0, int row1, int col0, int col1)
+        {
+            var range = new CellRangeAddress(row0, row1, col0, col1);
+            sheet.AddMergedRegion(range);
+            //添加左对齐 剧中样式
+            //合并后不加边框,取消样式
+            //var style = DCNPOIExtend.GetCellStyle(sheet.Workbook);
+            //for (int i = range.FirstRow; i <= range.LastRow; i++)
+            //{
+            //    IRow row = CellUtil.GetRow(i, sheet);
+            //    for (int j = range.FirstColumn; j <= range.LastColumn; j++)
+            //    {
+            //        var cell = CellUtil.GetCell(row, j);
+            //        cell.CellStyle = style;
+            //    }
+            //}
+        }
+
+        /// <summary>
+        /// 获取单元格样式
+        /// </summary>
+        /// <param name="workbook"></param>
+        /// <param name="style"></param>
+        /// <returns></returns>
+        private static ICellStyle GetCellStyle(this IWorkbook workbook, DataCheckNPOIStyle style = DataCheckNPOIStyle.Content)
+        {
+            ICellStyle cellstyle = null;
+            switch (style)
+            {
+                case DataCheckNPOIStyle.Title:
+                    cellstyle = LeftCenterBlackYellowStyle(workbook);
+                    break;
+                case DataCheckNPOIStyle.Error:
+                    cellstyle = LeftCenterRedStyle(workbook);
+                    break;
+                case DataCheckNPOIStyle.HyperLink:
+                    cellstyle = HyperLinkStyle(workbook);
+                    break;
+                default:
+                    cellstyle = LeftCenterBlackStyle(workbook);
+                    break;
+            }
+            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>
+        /// <returns></returns>
+        private static ICellStyle LeftCenterRedStyle(IWorkbook workbook)
+        {
+            ICellStyle style = workbook.CreateCellStyle();
+            //设置单元格的样式:水平对齐左侧垂直居中
+            style.Alignment = HorizontalAlignment.Left;
+            style.VerticalAlignment = VerticalAlignment.Center;
+            style.WrapText = true;
+            style.BorderBottom = BorderStyle.Thin;
+            style.BorderLeft = BorderStyle.Thin;
+            style.BorderRight = BorderStyle.Thin;
+            style.BorderTop = BorderStyle.Thin;
+            //新建一个字体样式对象
+
+            IFont font = workbook.CreateFont();
+            //设置字体颜色
+            font.Color = HSSFColor.Red.Index;
+            font.FontHeight = 12;
+            //使用SetFont方法将字体样式添加到单元格样式中 
+
+            style.SetFont(font);
+            //将新的样式赋给单元格
+            return style;
+        }
+        /// <summary>
+        /// 设置样式为水平左侧垂直居中,黑色字体
+        /// </summary>
+        /// <param name="workbook"></param>
+        /// <returns></returns>
+        private static ICellStyle LeftCenterBlackStyle(IWorkbook workbook)
+        {
+            ICellStyle style = workbook.CreateCellStyle();
+            //设置单元格的样式:水平对齐居中
+            style.Alignment = HorizontalAlignment.Left;
+            style.VerticalAlignment = VerticalAlignment.Center;
+            style.WrapText = true;
+            //style.BorderBottom = BorderStyle.Thin;
+            //style.BorderLeft = BorderStyle.Thin;
+            //style.BorderRight = BorderStyle.Thin;
+            //style.BorderTop = BorderStyle.Thin;
+            //新建一个字体样式对象
+
+            //IFont font = workbook.CreateFont();
+            ////设置字体颜色
+            //font.Color = HSSFColor.Black.Index;
+            //font.FontHeight = 12;
+            ////使用SetFont方法将字体样式添加到单元格样式中 
+            //style.SetFont(font);
+            //将新的样式赋给单元格
+            return style;
+        }
+        /// <summary>
+        /// 设置样式为水平左侧垂直居中,黑色字体,黄色背景
+        /// </summary>
+        /// <param name="workbook"></param>
+        /// <returns></returns>
+        private static ICellStyle LeftCenterBlackYellowStyle(IWorkbook workbook)
+        {
+            ICellStyle style = workbook.CreateCellStyle();
+            //设置单元格的样式:水平对齐居中
+            style.Alignment = HorizontalAlignment.Left;
+            style.VerticalAlignment = VerticalAlignment.Center;
+            style.WrapText = true;
+            style.BorderBottom = BorderStyle.Thin;
+            style.BorderLeft = BorderStyle.Thin;
+            style.BorderRight = BorderStyle.Thin;
+            style.BorderTop = BorderStyle.Thin;
+            style.FillForegroundColor = HSSFColor.LightYellow.Index;
+            style.FillPattern = FillPattern.SolidForeground;
+            //新建一个字体样式对象
+
+            //IFont font = workbook.CreateFont();
+            ////设置字体颜色
+            //font.Color = HSSFColor.Black.Index;
+            //font.FontHeight = 12;
+            ////使用SetFont方法将字体样式添加到单元格样式中 
+            //style.SetFont(font);
+            //将新的样式赋给单元格
+            return style;
+        }
+        /// <summary>
+        /// 黑色边框样式
+        /// </summary>
+        /// <param name="workbook"></param>
+        /// <returns></returns>
+        private static ICellStyle ThinBorderStyle(this IWorkbook workbook)
+        {
+            ICellStyle style = workbook.CreateCellStyle();
+            style.BorderBottom = BorderStyle.Thin;
+            style.BorderLeft = BorderStyle.Thin;
+            style.BorderRight = BorderStyle.Thin;
+            style.BorderTop = BorderStyle.Thin;
+            return style;
+        }
+    }
+
+    public enum DataCheckNPOIStyle
+    {
+        Title,
+        Content,
+        Error,
+        HyperLink,
+        None
+    }
+}

+ 31 - 0
ServiceMBI/Check/CheckBase/ICheckBase.cs

@@ -0,0 +1,31 @@
+/* ==============================================================================
+ * 功能描述:ICheckBase  
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/29 17:20:19
+ * ==============================================================================*/
+
+using Newtonsoft.Json.Linq;
+
+namespace ServiceMBI.Check.CheckBase
+{
+    /// <summary>
+    /// ICheckBase
+    /// </summary>
+    public interface ICheckBase
+    {
+        string Name { get; set; }
+        
+        /// <summary>
+        /// 是否强制勾选
+        /// </summary>
+        bool RIsReadOnly { get; set; }
+
+        /// <summary>
+        /// 是否通过较验
+        /// </summary>
+        bool IsRight { get; set; }
+        void Check2(CheckContext context,string floorPath);
+
+        JProperty Export2();
+    }
+}

+ 41 - 0
ServiceMBI/Check/CheckFloorInfoResult.cs

@@ -0,0 +1,41 @@
+/* ==============================================================================
+ * 功能描述:检查结果-楼层信息部分
+ * 创 建 者:Garrett
+ * 创建日期:2019/4/22 11:25:14
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ServiceMBI.Check
+{
+    /// <summary>
+    /// ResultOfFloorInfo
+    /// </summary>
+    class CheckFloorInfoResult
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        [Description]
+        public string FloorId { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        [Description]
+        public string FloorName { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        [Description]
+        public string LocalPath { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        [Description]
+        public string MD5 { get; set; }
+    }
+}

+ 74 - 0
ServiceMBI/Check/DocumentQueue.cs

@@ -0,0 +1,74 @@
+/* ==============================================================================
+ * 功能描述:Document队列,
+ * 1,按使用频率,使用频率低的优先关闭。使用频率如何统计;
+ * 2,按文件大小,小文件优化关闭。
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/16 9:34:39
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using SAGA.DotNetUtils.Extend;
+using SAGA.RevitUtils.Extends;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DocumentQueue
+    /// </summary>
+    class DocumentQueue
+    {
+        private static List<Tuple<string, Document>> m_DocList = new List<Tuple<string, Document>>();
+        private static readonly int m_MaxCount = 3;
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        private static Document AddDocument(string path)
+        {
+            var application = ExternalDataWrapper.Current.UiApp.Application;
+            var docs = application.Documents.ToList<Document>();
+            var doc = docs.FirstOrDefault(t => t.PathName == path);
+            if (doc == null || !doc.IsValidObject)
+            {
+                doc= application.OpenDocumentFile(path);
+                m_DocList.Add(new Tuple<string, Document>(path,doc));
+            }
+            if (m_DocList.Count > m_MaxCount)
+            {
+                var firstItem = m_DocList.FirstOrDefault();
+                if (firstItem != null)
+                {
+                    firstItem.Item2.CloseDoc();
+                    m_DocList.Remove(firstItem);
+                }
+            }
+            return doc;
+        }
+        /// <summary>
+        /// 跟据地址找到活动的Doc
+        /// </summary>
+        /// <param name="path"></param>
+        /// <returns></returns>
+        public static Document FindDocument(string path)
+        {
+            var doc = m_DocList.FirstOrDefault(t => t.Item1 == path)?.Item2 ?? AddDocument(path);
+            return doc;
+        }
+        /// <summary>
+        /// 关闭所有
+        /// </summary>
+        public static void CloseAll()
+        {
+            foreach (System.Tuple<string, Document> tuple in m_DocList)
+            {
+                tuple.Item2.CloseDoc();
+            }
+            m_DocList.Clear();
+        }
+    }
+}

+ 73 - 0
ServiceMBI/Check/ModeCheck/ColumnCheck.cs

@@ -0,0 +1,73 @@
+/* ==============================================================================
+ * 功能描述:结构柱边界检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using Autodesk.Revit.DB;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class ColumnCheck : ModeCheckBase
+    {
+        public ColumnCheck()
+        {
+            Name = "柱边界检查";
+        }
+        [DataCheckProcessAspect]
+        public override bool Check(string fullPath)
+        {
+            IsRight = GetCheckResult(fullPath);
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+        private bool GetCheckResult(string fullPath)
+        {
+            bool unitResult = true;
+            var document = DocumentQueue.FindDocument(fullPath);
+            var elements = document.GetElements<FamilyInstance>(BuiltInCategory.OST_StructuralColumns);
+            foreach (FamilyInstance fi in elements)
+            {
+                var result = GetCheckResult(fi);
+                Results.Add(result);
+            }
+            return Results.All(t => t.Result);
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new ColumnCheckResult();
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+            var roomBoundaries = fi.GetParameterInteger(BuiltInParameter.WALL_ATTR_ROOM_BOUNDING);
+            if (roomBoundaries ==1)
+            {
+                result.Result = true;
+            }
+            else
+            {
+                result.Result = false;
+                result.Message = "柱的房间边界属性 未勾选";
+            }
+            return result;
+        }
+    }
+}

+ 19 - 0
ServiceMBI/Check/ModeCheck/ColumnCheckResult.cs

@@ -0,0 +1,19 @@
+/* ==============================================================================
+ * 功能描述:结构柱边界检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class ColumnCheckResult : ModeCheckResultBase
+    {
+
+        public string FamilyName { get; set; }
+
+        public string Id { get; set; }
+    }
+}

+ 251 - 0
ServiceMBI/Check/ModeCheck/ConnectorCheck.cs

@@ -0,0 +1,251 @@
+/* ==============================================================================
+ * 功能描述:连接件检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class ConnectorCheck : ModeCheckBase
+    {
+        public ConnectorCheck()
+        {
+            Name = "连接件检查";
+            RSPecificationSheet.Add("参考-连接件对照表");
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = GetCheckResult();
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        private bool GetCheckResult()
+        {
+            bool unitResult = true;
+            m_ProDefineConnectors = GetPreDefineConnectors();
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var list = Check(signResult);
+                Results.AddRange(list);
+            }
+            return Results.All(t => t.IsRight);
+
+        }
+        /// <summary>
+        /// 获取所有的设备或者部件
+        /// </summary>
+        /// <param name="document"></param>
+        /// <returns></returns>
+        private List<ModeCheckResultBase> Check(SagaSignCheckResult signResult)
+        {
+            List<ModeCheckResultBase> list = new List<ModeCheckResultBase>();
+            var familyInstances = signResult.RDocument.GetFamilyInstances();
+
+            foreach (FamilyInstance fi in familyInstances)
+            {
+                if (fi.IsEquipment() || fi.IsEquipmentPart())
+                {
+                    var result = GetCheckResult(fi);
+                    if (result == null) continue;
+                    result.RBase = signResult;
+                    list.Add(result);
+                }
+            }
+            return list;
+        }
+
+        private string m_HaveConnectorSing = "√";
+        private List<DCR_Connector> m_ProDefineConnectors;
+
+        public  List<DCR_Connector> GetPreDefineConnectors()
+        {
+            var list = new List<DCR_Connector>();
+            var alllist = DataCheckRule.GetPreDefineConnectors();
+            foreach (DCR_Connector connector in alllist)
+            {
+                var pipeType = connector.PipeConnector;
+                var hvacType = connector.HvacConnector;
+                if (pipeType == m_HaveConnectorSing || hvacType == m_HaveConnectorSing)
+                {
+                    list.Add(connector);
+                    if (connector.PName.IsNotNullEmpty() && connector.PCode.IsNotNullEmpty())
+                    {
+                        //部件单独提出来当做一项
+                        var pconnector = new DCR_Connector()
+                        {
+                            Code = connector.PCode,
+                            Name = connector.Name,
+                            PipeConnector = connector.PipeConnector,
+                            HvacConnector = connector.HvacConnector
+                        };
+                        list.Add(pconnector);
+                    }
+                }
+            }
+            return list;
+        }
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new ConnectorCheckResult();
+            var code = fi.GetFamilyCode();
+            var defineConType = GetDefineConType(code);
+            if (defineConType == null) return null;
+            result.FamilyName = fi.GetFamily().Name;
+            result.Type = code.Length == 4 ? DCElementType.Equipment : DCElementType.EuipmentPart;
+            result.Id = fi.Id.ToString();
+            result.IsRight = true;
+            CheckConType(result, fi,defineConType.Item1);
+            CheckConType(result,fi, defineConType.Item2);
+            return result;
+        }
+        /// <summary>
+        /// 获取定义的风和水连接件类型
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        private Tuple<Domain, Domain> GetDefineConType(string code)
+        {
+            var item = m_ProDefineConnectors.FirstOrDefault(t => t.Code == code);
+            if (item == null) return null;
+            var pipeType = item.PipeConnector;
+            var hvacType = item.HvacConnector;
+
+            var pipeConType = pipeType == m_HaveConnectorSing ? Domain.DomainPiping : Domain.DomainUndefined;
+            var hvacConType = hvacType == m_HaveConnectorSing ? Domain.DomainHvac : Domain.DomainUndefined;
+            return new Tuple<Domain, Domain>(pipeConType, hvacConType);
+        }
+        /// <summary>
+        /// 检查连接件类型是否存在
+        /// </summary>
+        /// <param name="result"></param>
+        /// <param name="domain"></param>
+        private void CheckConType(ConnectorCheckResult result,FamilyInstance fi, Domain domain)
+        {
+            if (domain != Domain.DomainUndefined)
+            {
+                var connectors = fi.GetConnectors(domain);
+                if (!connectors.Any())
+                {
+                    result.IsRight = false;
+                    result.RMessage += $"缺少 {DomainToString(domain)} 连接件;";
+                }
+                else
+                {
+                    if (!connectors.All(t => t.IsConnected))
+                    {
+                        result.IsRight = false;
+                        result.RMessage += $"发现 {DomainToString(domain)}连接件未连接;";
+                    }
+                }
+            }
+        }
+
+        private string DomainToString(Domain domain)
+        {
+            string str = "";
+            switch (domain)
+            {
+                case Domain.DomainPiping:
+                        str = "水管";
+                        break;
+                case Domain.DomainHvac:
+                    str = "风管";
+                    break;
+                    default:
+                        str = "未知";
+                        break;
+
+            }
+            return str;
+        }
+
+
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //添加 共检查XXX条数据,未通过检查的如下 提示
+                IRow rowTip = sheet.CreateRow(index - 1);
+                rowTip.AddCell(0, $"总检查{Results.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "族名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "类型", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "ID", DataCheckNPOIStyle.Title);
+                //row4.AddCell(6, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(7, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                foreach (ConnectorCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    //数量多过,只显示有问题的
+                    if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, result.FamilyName, style);
+                    rowN.AddCell(4, result.Type.GetDescription(), style);
+                    rowN.AddCell(5, result.Id, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(6, rowN4, style);
+                    rowN.AddCell(7, result.RMessage, style);
+                }
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 26 - 0
ServiceMBI/Check/ModeCheck/ConnectorCheckResult.cs

@@ -0,0 +1,26 @@
+/* ==============================================================================
+ * 功能描述:连接件检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class ConnectorCheckResult : ModeCheckResultBase
+    {
+        public string FamilyName { get; set; }
+
+        public DCElementType Type { get; set; }
+
+        public string Id { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 143 - 0
ServiceMBI/Check/ModeCheck/DCRExport.cs

@@ -0,0 +1,143 @@
+/* ==============================================================================
+ * 功能描述:数据检查结果导出
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/5 14:33:42
+ * ==============================================================================*/
+
+using System;
+using System.IO;
+using Microsoft.Win32;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Others;
+using ServiceMBI.Common;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DataCheckResultExport
+    /// </summary>
+    public static class DCRExport
+    {
+        public static string MCRPath = Path.Combine(MBIConst.MBIResourcePath, @"DataCheck\模型检查结果输出格式-模版.xlsx");
+        public static string DCRPath = Path.Combine(MBIConst.MBIResourcePath, @"DataCheck\垃圾数据检查结果输出-模版.xlsx");
+        /// <summary>
+        /// 获取导出Excel
+        /// </summary>
+        /// <returns></returns>
+        public static string GetExportPath(string defaultPath = null)
+        {
+            SaveFileDialog sflg = new SaveFileDialog();
+            if (File.Exists(defaultPath))
+                sflg.FileName = defaultPath;
+            sflg.Filter = "Excel(*.xlsx)|*.xlsx";
+            if (sflg.ShowDialog() != true) return defaultPath;
+            string fileName = sflg.FileName;
+            if (fileName.IsNullOrEmpty())
+            {
+                fileName = defaultPath;
+            }
+            return fileName;
+        }
+
+        private static string m_FileName;
+        /// <summary>
+        /// 设置模版地址
+        /// </summary>
+        /// <param name="fileName"></param>
+        public static void SetTemplatePath(string fileName)
+        {
+            m_FileName = fileName;
+        }
+        private static IWorkbook m_ExportWorkBook;
+        public static IWorkbook GetWorkbook(bool isreset = false)
+        {
+            if (isreset)
+            {
+                ClearWorkbook();
+            }
+            if (m_ExportWorkBook == null)
+            {
+                if (File.Exists(m_FileName))
+                {
+                    using (var fileStream = new System.IO.FileStream(m_FileName, FileMode.Open, FileAccess.Read))
+                    {
+                        m_ExportWorkBook = new XSSFWorkbook(fileStream); //xlsx数据读入workbook
+                    }
+                }
+                else
+                {
+                    m_ExportWorkBook = null;
+                }
+
+            }
+
+            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()
+        {
+            m_ExportWorkBook = null;
+        }
+        /// <summary>
+        /// 保存
+        /// </summary>
+        /// <param name="fileName"></param>
+        /// <param name="book"></param>
+        /// <returns></returns>
+        public static bool Save(string fileName, IWorkbook book)
+        {
+            bool result = true;
+            try
+            {
+                bool allVisible = true;
+                //判断全部都隐藏不保存
+                for (int i = 0; i < book.NumberOfSheets - 1; i++)
+                {
+                    bool tempVisible = book.IsSheetVeryHidden(i);
+                    if (!tempVisible)
+                    {
+                        allVisible = false;
+                    }
+                }
+                if (allVisible)
+                {
+                    MessageShowBase.Infomation("所有检查项都通过检查,取消保存");
+                    return result;
+                }
+                MemoryStream ms = new MemoryStream();
+                book.Write(ms);
+
+                using (System.IO.FileStream fs = new System.IO.FileStream(fileName, FileMode.Create, FileAccess.Write))
+                {
+                    byte[] data = ms.ToArray();
+                    fs.Write(data, 0, data.Length);
+                    fs.Flush();
+                }
+                ms.Close();
+                ms.Dispose();
+                MessageShowBase.Infomation("保存完成");
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+                result = false;
+            }
+            return result;
+        }
+    }
+}

+ 163 - 0
ServiceMBI/Check/ModeCheck/DataCheckRule.cs

@@ -0,0 +1,163 @@
+/* ==============================================================================
+ * 功能描述:数据检查规范
+ * 创 建 者:Garrett
+ * 创建日期:2018/11/7 15:40:23
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.NPOI;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DataCheckRule
+    /// </summary>
+    class DataCheckRule
+    {
+        /// <summary>
+        /// 获取设备编码检查Cateogry 列表
+        /// </summary>
+        /// <returns></returns>
+        public static List<DCR_CodeCheckCategory> GetCodeCheckCategories()
+        {
+            var list = NPOIHelper
+                .ConvertExcelSheetToModel<DCR_CodeCheckCategory>(DCRExport.MCRPath);
+            return list;
+        }
+
+        /// <summary>
+        /// 获取预定义的连接件类
+        /// </summary>
+        /// <returns></returns>
+        public static List<DCR_Connector> GetPreDefineConnectors()
+        {
+            var list = NPOIHelper
+                .ConvertExcelSheetToModel<DCR_Connector>(DCRExport.MCRPath);
+            return list;
+        }
+
+        /// <summary>
+        /// 获取可识别的管道系统名称
+        /// </summary>
+        /// <returns></returns>
+        public static List<DCR_MEPSystem> GetMepSystems()
+        {
+            var list = NPOIHelper
+                .ConvertExcelSheetToModel<DCR_MEPSystem>(DCRExport.MCRPath);
+            return list;
+        }
+        /// <summary>
+        /// 获取设备关联的系统类型
+        /// </summary>
+        /// <returns></returns>
+        public static List<DCR_EquipReferSystem> GetEquipReferSystems()
+        {
+            var list = NPOIHelper
+                .ConvertExcelSheetToModel<DCR_SystemReferEquip>(DCRExport.MCRPath);
+            List<Tuple<string, string>> tuples = new List<Tuple<string, string>>();
+            //将集合转化为:系统名称-设备名称
+            list.ForEach(t => t.Equips.ForEach(tt => tuples.Add(new Tuple<string, string>(t.SystemName, tt))));
+            //将集合转化为:设备名称-多个系统名称
+            var newList = tuples.GroupBy(t => t.Item2).Select(tt => new DCR_EquipReferSystem()
+            { EquipName = tt.Key, Systems = tt.Select(t => t.Item1).ToList() }).ToList();
+            return newList;
+        }
+    }
+    /// <summary>
+    /// 参考-可识别的系统名称
+    /// </summary>
+    [SheetInfo(SheetName = "参考-可识别的系统名称", RowStartIndex = 0)]
+    public class DCR_MEPSystem
+    {
+        [CellIndex(0)]
+        public string Name { get; set; }
+    }
+    /// <summary>
+    /// 参考-revit分类
+    /// </summary>
+    [SheetInfo(SheetName = "参考-revit分类", RowStartIndex = 0)]
+    public class DCR_CodeCheckCategory
+    {
+        [CellIndex(0)]
+        public string Name { get; set; }
+    }
+    /// <summary>
+    /// 设备类是否有连接件
+    /// </summary>
+    [SheetInfo(SheetName = "参考-连接件对照表", RowStartIndex = 1)]
+    public class DCR_Connector
+    {
+        [CellIndex(4)]
+        public string Name { get; set; }
+
+        [CellIndex(5)]
+        public string Code { get; set; }
+
+        [CellIndex(6)]
+        public string PName { get; set; }
+
+        [CellIndex(7)]
+        public string PCode { get; set; }
+
+        [CellIndex(8)]
+        public string HvacConnector { get; set; }
+
+        [CellIndex(9)]
+        public string PipeConnector { get; set; }
+    }
+    /// <summary>
+    /// 参考-管网与相关设备
+    /// </summary>
+    [SheetInfo(SheetName = "参考-管网及相关设备", RowStartIndex = 3)]
+    public class DCR_SystemReferEquip
+    {
+        [CellIndex(4)]
+        public string SystemName { get; set; }
+        [CellIndex(5)]
+        public string ReferEquipName { get; set; }
+
+        private List<string> m_Equips;
+
+        public List<string> Equips
+        {
+            get
+            {
+                if (m_Equips == null)
+                    m_Equips = ConverToList(ReferEquipName);
+                return m_Equips;
+            }
+        }
+
+        public List<string> ConverToList(string str)
+        {
+            var list = new List<string>();
+            if (str.IsNotNullEmpty())
+            {
+                Regex regex = new Regex(@"^[A-Z]{4}");
+                list = str.Split(new[] { ',', ',' })
+                    .Where(t => Regex.IsMatch(t, @"^[A-Z]{4}\s*-\s*\S*"))
+                    .Select(tt => regex.Match(tt).Value).ToList();
+            }
+
+            return list;
+        }
+    }
+    /// <summary>
+    /// 设备关联的系统
+    /// </summary>
+    public class DCR_EquipReferSystem
+    {
+        /// <summary>
+        /// 设备名称
+        /// </summary>
+        public string EquipName { get; set; }
+        /// <summary>
+        /// 系统名称
+        /// </summary>
+        public List<string> Systems { get; set; }
+    }
+}

+ 325 - 0
ServiceMBI/Check/ModeCheck/ElementRangeCheck.cs

@@ -0,0 +1,325 @@
+/* ==============================================================================
+ * 功能描述:构件范围检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Mechanical;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    class ElementRangeCheck : ModeCheckBase
+    {
+        public ElementRangeCheck()
+        {
+            Name = "构件范围检查";
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = GetCheckResult();
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        #region CheckMethod
+
+        private bool GetCheckResult()
+        {
+            bool unitResult = true;
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                CheckCurrentFloor(signResult);
+            }
+            return Results.All(t => t.IsRight);
+        }
+        /// <summary>
+        /// 检查当前层
+        /// </summary>
+        /// <param name="signResult"></param>
+        private void CheckCurrentFloor(SagaSignCheckResult signResult)
+        {
+            var document = signResult.RDocument;
+            if (SetFloorBaseTopRange(document, signResult))
+            {
+                var elements = document.GetAllElements();
+                foreach (var element in elements)
+                {
+                    var result = GetCheckResult(signResult, element);
+                    if (result != null)
+                        Results.Add(result);
+                }
+            }
+            CalcRCPassRate(signResult);
+        }
+        /// <summary>
+        /// 计算本层构件范围检查通过率
+        /// </summary>
+        private void CalcRCPassRate(SagaSignCheckResult signResult)
+        {
+            Func<Func<ModeCheckResultBase, bool>, double> rateFunc = (condition) =>
+             {
+                 double passRate = 1;
+                 var items = Results.Where(condition);
+                 int count = items.Count();
+                 if (count > 0)
+                 {
+                     var passItems = items.Where(t => t.IsRight);
+                     var passCount = passItems.Count();
+                     passRate = (1.0 * passCount / count);
+                 }
+                 return passRate;
+             };
+            //var items = Results.Where(t => t.RBase == signResult);
+            //int count = items.Count();
+            //if (count > 0)
+            //{
+            //    var passItems = items.Where(t => t.IsRight);
+            //    var passCount = passItems.Count();
+            //    passRate = (1.0 * passCount / count);
+            //}
+            signResult.RCPassRate = rateFunc((t) => t.RBase == signResult);
+            signResult.ColumnWallPassRate = rateFunc((t) => new List<DCElementType>() { DCElementType.Wall, DCElementType.Column }.Contains(((ElementRangeCheckResult)t).RType));
+            signResult.SpacePassRate = rateFunc((t) => ((ElementRangeCheckResult)t).RType == DCElementType.Space);
+            signResult.InstPassRate = rateFunc((t) => new List<DCElementType>() { DCElementType.Equipment, DCElementType.EuipmentPart, DCElementType.Beacon }.Contains(((ElementRangeCheckResult)t).RType));
+        }
+
+        /// <summary>
+        /// 设置当前楼层底部和顶部范围
+        /// </summary>
+        /// <param name="doc"></param>
+        /// <param name="result"></param>
+        private bool SetFloorBaseTopRange(Document doc, SagaSignCheckResult result)
+        {
+            bool rt = true;
+            try
+            {
+                //设置楼层底部高度
+                var curLevelName = result.RFloorName;
+                //设置楼层顶部高度
+                if (curLevelName == "RF" || curLevelName == "RFM")
+                {
+                    result.HTop = double.MaxValue;
+                    result.HSamdwich = double.MaxValue;
+                }
+                else
+                {
+                    var levels = doc.GetLevels();
+                    var mbiLevels = levels.Where(t => Regex.IsMatch(t.Name, @"([BF][1-9]\d*M?|RFM?)"));
+                    var topLevel = mbiLevels.FirstOrDefault(t => t.Elevation.IsThan(result.HBase));
+                    if (topLevel == null)
+                    {
+                        throw new Exception($"标高编码不合法:{curLevelName}不应该是顶层,缺少标高RF或标高RF标注的位置不正确");
+                    }
+                    double nextL = topLevel.Elevation;
+                    string tempTopLevelName = topLevel.Name;
+                    //如果是夹层,获取夹层的上一层
+                    if (Regex.IsMatch(tempTopLevelName, @"([BF][1-9]\d*M|RFM)"))
+                    {
+                        result.HSamdwich = nextL;
+                        topLevel = mbiLevels.FirstOrDefault(t => t.Elevation.IsThan(nextL));
+                        if (topLevel == null)
+                        {
+                            throw new Exception($"标高编码不合法:{tempTopLevelName}不应该是顶层,缺少标高RF或标高RF标注的位置不正确");
+                        }
+                        else
+                        {
+                            result.HTop = topLevel.Elevation;
+                        }
+                    }
+                    else
+                    {
+                        result.HSamdwich = nextL;
+                        result.HTop = nextL;
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+                rt = false;
+            }
+            return rt;
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="element"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(SagaSignCheckResult signResult, Element element)
+        {
+            var result = new ElementRangeCheckResult();
+            result.RBase = signResult;
+            result.FamilyName = element.GetFamily()?.Name;
+            result.Id = element.Id.ToString();
+            try
+            {
+                double hb = signResult.HBase;
+                double ht = signResult.HTop;
+                double hjc = signResult.HSamdwich;
+                //使用时,单位转化为英寸
+                double w = signResult.Redundant.ToApi();
+                double zb = 0, zt = 0;
+                bool rb = false, rt = false;
+                bool isBoxInst = false;
+                if (element is Wall wall)
+                {
+                    isBoxInst = true;
+                    result.RType = DCElementType.Wall;
+                    zb = wall.GetBaseStaticHeight();
+                    zt = wall.GetTopStaticHeight();
+                }
+                else if (element is FamilyInstance fi)
+                {
+                    if (fi.IsAllColumn())
+                    {
+                        isBoxInst = true;
+                        result.RType = DCElementType.Column;
+                        zb = fi.GetBaseStaticHeight();
+                        zt = fi.GetTopStaticHeight();
+                    }
+                    else if (fi.IsEquipment() || fi.IsEquipmentPart() || fi.IsBeacon())
+                    {
+                        result.RType = GetRType(fi);
+                        zb = fi.GetLocationPointMBIXYZ().Z;
+                        rb = zb.IsBetween(hb, ht);
+                        result.IsRight = rb;
+                        result.RMessage = result.IsRight ? "" : "构件范围不满足要求;请检查构件位置";
+                    }
+                    else
+                    {
+                        result = null;
+                    }
+                }
+                else if (element.IsSpace())
+                {
+                    var space = element as Space;
+                    isBoxInst = true;
+                    result.RType = DCElementType.Space;
+                    zb = space.GetBaseStaticHeight();
+                    zt = space.GetTopStaticHeight();
+                }
+                else
+                {
+                    result = null;
+                }
+                if (isBoxInst)
+                {
+                    rb = zb.IsBetween(hb - w, hb);
+                    rt = zt.IsBetween(ht - w, ht) || zt.IsBetween(hjc - w, hjc);
+                    result.IsRight = rb && rt;
+                    string ttip = rb ? "" : "底部";
+                    string ttop = rt ? "" : rb ? "和顶部" : "顶部";
+                    result.RMessage = result.IsRight ? "" : $"构件范围不满足要求;请检查构件{ttip}{ttop}";
+                }
+            }
+            catch (Exception e)
+            {
+                //MessageShowBase.Show(e);
+                if (result != null)
+                {
+                    result.IsRight = false;
+                    result.RMessage = result.IsRight ? "" : "构件范围不满足要求;请检查构件底部和顶部";
+                }
+            }
+
+
+            return result;
+        }
+        /// <summary>
+        /// 获取构件类型
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private DCElementType GetRType(FamilyInstance fi)
+        {
+            DCElementType name = DCElementType.None;
+            if (fi.IsEquipment())
+            {
+                name = DCElementType.Equipment;
+            }
+            else if (fi.IsEquipmentPart())
+            {
+                name = DCElementType.EuipmentPart;
+            }
+            else if (fi.IsBeacon())
+            {
+                name = DCElementType.Beacon;
+            }
+            return name;
+        }
+
+        #endregion
+
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 4;
+                //添加 共检查XXX条数据,未通过检查的如下 提示
+                IRow rowTip = sheet.CreateRow(index - 1);
+                rowTip.AddCell(0, $"总检查{Results.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
+
+                foreach (ElementRangeCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    //数量过多,只显示有问题的
+                    if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, result.FamilyName, style);
+                    rowN.AddCell(4, result.RType.GetDescription(), style);
+                    rowN.AddCell(5, result.Id, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(6, rowN4, style);
+                    rowN.AddCell(7, result.RMessage, style);
+                }
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 36 - 0
ServiceMBI/Check/ModeCheck/ElementRangeCheckResult.cs

@@ -0,0 +1,36 @@
+/* ==============================================================================
+ * 功能描述:构件范围检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class ElementRangeCheckResult : ModeCheckResultBase
+    {
+        public string FamilyName { get; set; }
+
+        public string Id { get; set; }
+        /// <summary>
+        /// 构件类型
+        /// </summary>
+        public DCElementType RType { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+
+    enum CheckElementType
+    {
+        Wall,
+        Column,
+        Space,
+        EquipOrPart,
+    }
+}

+ 207 - 0
ServiceMBI/Check/ModeCheck/EquipReferSystemCheck.cs

@@ -0,0 +1,207 @@
+/* ==============================================================================
+ * 功能描述:管网及相关设备检查检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Logger;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class EquipReferSystemCheck : ModeCheckBase 
+    {
+        public EquipReferSystemCheck()
+        {
+            Name = "管网及相关设备检查";
+            RSPecificationSheet.Add("参考-管网及相关设备");
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = GetCheckResult();
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        private List<DCR_EquipReferSystem> m_EquipReferSystems;
+        private bool GetCheckResult()
+        {
+            bool unitResult = true;
+            m_EquipReferSystems = DataCheckRule.GetEquipReferSystems();
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var list = Check(signResult);
+                Results.AddRange(list);
+            }
+            return Results.All(t => t.IsRight);
+
+        }
+        /// <summary>
+        /// 获取所有的设备或者部件
+        /// </summary>
+        /// <param name="document"></param>
+        /// <returns></returns>
+        private List<ModeCheckResultBase> Check(SagaSignCheckResult signResult)
+        {
+            List<ModeCheckResultBase> list = new List<ModeCheckResultBase>();
+            var familyInstances = signResult.RDocument.GetFamilyInstances();
+
+            foreach (FamilyInstance fi in familyInstances)
+            {
+                if (fi.IsEquipment() || fi.IsEquipmentPart())
+                {
+                    var result = GetCheckResult(fi);
+                    if (result == null) continue;
+                    result.RBase = signResult;
+                    list.Add(result);
+                }
+            }
+            return list;
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new EquipReferSystemCheckResult();
+            var code = fi.GetFamilyCode();
+            var referSystems = GetReferSystems(code);
+            if (referSystems.Count == 0) return null;
+
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+
+            var tuple = CheckConType(fi, referSystems);
+            result.IsRight = !tuple.Item2.Any();
+            result.PassConnectorsName += string.Join("、", tuple.Item1.ToArray());
+            result.UnPassConnectorsName += string.Join("、", tuple.Item2.ToArray());
+            if (!result.IsRight)
+            {
+                result.RMessage = $"连接件所连接的管道系统与规范不一致,请检查";
+            }
+            return result;
+        }
+        /// <summary>
+        /// 可以与设备连接的系统
+        /// </summary>
+        /// <param name="code"></param>
+        /// <returns></returns>
+        private List<string> GetReferSystems(string code)
+        {
+            var item = m_EquipReferSystems.FirstOrDefault(t => t.EquipName == code)?.Systems ?? new List<string>();
+
+            return item;
+        }
+
+        /// <summary>
+        /// 检查连接件连接的管道系统是否符合规范
+        /// </summary>
+        /// <param name="result"></param>
+        /// <param name="domain"></param>
+        private Tuple<List<string>,List<string>> CheckConType(FamilyInstance fi, List<string> referSystems)
+        {
+            List<string> passList=new List<string>();
+            List<string> unpassList=new List<string>();
+
+            var connectors = fi.GetAllConnectors();
+            foreach (Connector connector in connectors)
+            {
+                try
+                {
+                    var mepSystem = connector.MEPSystem;
+                    if (mepSystem == null) continue;
+                    var elementId = mepSystem.GetTypeId();
+                    var type = fi.Document.GetElement(elementId);
+                    if (!referSystems.Contains(type.Name))
+                    {
+                        unpassList.Add(type.Name);
+                    }
+                    else
+                    {
+                        passList.Add(type.Name);
+                    }
+                }
+                catch (Exception e)
+                {
+                   Log4Net.Info($"读取连接件系统错误。Id:{fi.Id},Path:{fi.Document.PathName}");
+                }
+            }
+
+            return new Tuple<List<string>, List<string>>(passList, unpassList);
+        }
+        
+
+
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //添加 共检查XXX条数据,未通过检查的如下 提示
+                IRow rowTip = sheet.CreateRow(index - 1);
+                rowTip.AddCell(0, $"总检查{Results.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
+
+                foreach (EquipReferSystemCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    //数量多过,只显示有问题的
+                    if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                    int i = 0;
+                    rowN.AddCell(i++, rbase.RFloorName, style);
+                    rowN.AddCell(i++, rbase.RFileName, style);
+                    rowN.AddCell(i++, rbase.RPath, style);
+                    rowN.AddCell(i++, result.FamilyName, style);
+                    rowN.AddCell(i++, result.Id, style);
+                    rowN.AddCell(i++, result.PassConnectorsName, style);
+                    rowN.AddCell(i++, result.UnPassConnectorsName, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(i++, rowN4, style);
+                    rowN.AddCell(i++, result.RMessage, style);
+                }
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 30 - 0
ServiceMBI/Check/ModeCheck/EquipReferSystemCheckResult.cs

@@ -0,0 +1,30 @@
+/* ==============================================================================
+ * 功能描述:管网及相关设备检查检查结果
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class EquipReferSystemCheckResult : ModeCheckResultBase
+    {
+        public string FamilyName { get; set; }
+
+        public string Id { get; set; }
+        /// <summary>
+        /// 通过的连接件系统名称
+        /// </summary>
+        public string PassConnectorsName { get; set; }
+        /// <summary>
+        /// 不通过的连接件系统名称
+        /// </summary>
+        public string UnPassConnectorsName { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 141 - 0
ServiceMBI/Check/ModeCheck/EquipmentInSpaceCheck.cs

@@ -0,0 +1,141 @@
+/* ==============================================================================
+ * 功能描述:未在空间中的设备检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class EquipmentInSpaceCheck : ModeCheckBase
+    {
+        public EquipmentInSpaceCheck()
+        {
+            Name = "未在空间中的设备";
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = GetCheckResult();
+            return IsRight;
+          
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        private bool GetCheckResult()
+        {
+            bool unitResult = true;
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var document = signResult.RDocument;
+                var elements = document.GetFamilyInstances();
+                var parts = elements.Where(t => t.IsEquipment()|| t.IsEquipmentPart());
+                foreach (FamilyInstance fi in parts)
+                {
+                    var result = GetCheckResult(fi);
+                    result.RBase = signResult;
+                    Results.Add(result);
+                }
+            }
+            return Results.All(t => t.IsRight);
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new EquipmentInSpaceCheckResult();
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+            var space = fi.GetReferenceSpace();
+            if (space == null)
+            {
+                result.IsRight = false;
+                result.RMessage = "请检查设备是否在空间中";
+            }
+            else
+            {
+                result.IsRight = true;
+                result.RMessage = $"关联空间的id为{space.Id}";
+            }
+            return result;
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //添加 共检查XXX条数据,未通过检查的如下 提示
+                IRow rowTip = sheet.CreateRow(index - 1);
+                rowTip.AddCell(0, $"总检查{Results.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "族名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "ID", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(6, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                foreach (EquipmentInSpaceCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    //数量过多,只显示有问题的
+                    if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, result.FamilyName, style);
+                    rowN.AddCell(4, result.Id, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(5, rowN4, style);
+                    rowN.AddCell(6, result.RMessage, style);
+                }
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 23 - 0
ServiceMBI/Check/ModeCheck/EquipmentInSpaceCheckResult.cs

@@ -0,0 +1,23 @@
+/* ==============================================================================
+ * 功能描述:未在空间中的设备检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class EquipmentInSpaceCheckResult : ModeCheckResultBase
+    {
+
+        public string FamilyName { get; set; }
+
+        public string Id { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 72 - 0
ServiceMBI/Check/ModeCheck/EquipmentPartRefEqCheck.cs

@@ -0,0 +1,72 @@
+/* ==============================================================================
+ * 功能描述:部件关联设备检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class EquipmentPartRefEqCheck : ModeCheckBase
+    {
+        public EquipmentPartRefEqCheck()
+        {
+            Name = "部件所在位置检查";
+        }
+        [DataCheckProcessAspect]
+        public override bool Check(string fullPath)
+        {
+            IsRight = GetCheckResult(fullPath);
+            return IsRight;
+          
+        }
+
+        private bool GetCheckResult(string fullPath)
+        {
+            var document = DocumentQueue.FindDocument(fullPath);
+            var elements = document.GetFamilyInstances();
+            var parts = elements.Where(t => t.IsEquipmentPart());
+            foreach (FamilyInstance fi in parts)
+            {
+                var result = GetCheckResult(fi);
+                Results.Add(result);
+            }
+            return Results.All(t => t.Result);
+        }
+
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new EquipmentPartRefEqCheckResult();
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+            var partParent = fi.GetPartParentInstance();
+            if (partParent == null)
+            {
+                result.Result = false;
+                result.Message = "未与设备相交,请检查";
+            }
+            else
+            {
+                result.Result = true;
+                result.Message = $"关联设备的id为{partParent.Id.ToString()}";
+            }
+            return result;
+        }
+    }
+}

+ 21 - 0
ServiceMBI/Check/ModeCheck/EquipmentPartRefEqCheckResult.cs

@@ -0,0 +1,21 @@
+    /* ==============================================================================
+ * 功能描述:部件关联设备检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+using System.ComponentModel;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    class EquipmentPartRefEqCheckResult : ModeCheckResultBase
+    {
+        
+        public string Id { get; set; }
+        public string FamilyName { get; set; }
+
+    }
+}

+ 194 - 0
ServiceMBI/Check/ModeCheck/FamilyNameCheck.cs

@@ -0,0 +1,194 @@
+/* ==============================================================================
+ * 功能描述:编码检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using MBIUtility.Extend;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class FamilyNameCheck : ModeCheckBase
+    {
+        public FamilyNameCheck()
+        {
+            Name = "设备族编码检查";
+            RSPecificationSheet.Add("参考-revit分类");
+        }
+
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = FamilyNameCodeCheck();
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+        /// <summary>
+        /// 族名称编码规范检查
+        /// </summary>
+        /// <returns></returns>
+        private bool FamilyNameCodeCheck()
+        {
+            bool unitResult = true;
+            var ccategories = DataCheckRule.GetCodeCheckCategories();
+            var list = new List<FamilyNameCheckResult>();
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var document = signResult.RDocument;
+                var categories = document.Settings.Categories;
+                foreach (DCR_CodeCheckCategory ccategory in ccategories)
+                {
+                    try
+                    {
+                        var category = categories.get_Item(ccategory.Name);
+                        if (category == null) continue;
+                        BuiltInCategory builtInCategory = (BuiltInCategory)category.Id.IntegerValue;
+                        var elements = document.GetElements<FamilyInstance>(builtInCategory);
+                        var groupByFamily = elements.GroupBy(t => t.GetFamily()?.Name);
+                        foreach (IGrouping<string, FamilyInstance> grouping in groupByFamily)
+                        {
+                            var subElements = grouping.ToList();
+                            var subElement = subElements.FirstOrDefault();
+                            if (subElement is FamilyInstance fi)
+                            {
+                                var result = GetCheckResult(fi) as FamilyNameCheckResult;
+                                if (result == null) continue;
+                                result.RBase = signResult;
+                                //由于数量太多,只显示族名称
+                                result.Id = "-";
+                                list.Add(result);
+                                //foreach (var tempElem in subElements)
+                                //{
+                                //    var tempResult = result?.Clone();
+                                //    if (tempResult == null) continue;
+                                //    tempResult.Id = tempElem.Id.ToString();
+                                //    Results.Add(tempResult);
+                                //}
+                            }
+                        }
+                    }
+                    catch (Exception e)
+                    {
+                        Console.WriteLine(e);
+                    }
+
+                }
+            }
+            //按族名称,对楼层进行合并显示
+            GroupByFamilyName(list);
+            Results.Sort(new CommonComparer<ModeCheckResultBase>((x, y) => { return x.IsRight.CompareTo(y.IsRight);}));
+            return Results.All(t => t.IsRight);
+        }
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ModeCheckResultBase GetCheckResult(FamilyInstance fi)
+        {
+            var result = new FamilyNameCheckResult();
+            result.FamilyName = fi.GetFamily().Name;
+            result.Id = fi.Id.ToString();
+            if (fi.IsEquipment())
+            {
+                result.IsRight = true;
+                result.Type = DCElementType.Equipment;
+            }
+            else if (fi.IsEquipmentPart())
+            {
+                result.IsRight = true;
+                result.Type = DCElementType.EuipmentPart;
+            }
+            else if (fi.IsBeacon())
+            {
+                result.IsRight = true;
+                result.Type = DCElementType.Beacon;
+            }
+            else
+            {
+                result.IsRight = false;
+                result.Type = DCElementType.None;
+                result.RMessage = "请检查族名称编码是否符合要求";
+            }
+            return result;
+        }
+
+
+        private void GroupByFamilyName(List<FamilyNameCheckResult> modes)
+        {
+            var groupByFamilyName = modes.GroupBy(t => t.FamilyName);
+            foreach (IGrouping<string, FamilyNameCheckResult> grouping in groupByFamilyName)
+            {
+                var item = grouping.ToList().FirstOrDefault();
+                if (item == null) continue;
+
+                FamilyNameCheckResult mode = new FamilyNameCheckResult();
+                mode.FamilyName = grouping.Key;
+                mode.Type = item.Type;
+                mode.IsRight = item.IsRight;
+                //if (!mode.IsRight)
+                mode.RMessage =
+                    $"使用到该设备族的楼层:{string.Join("、", grouping.Select(t => ((SagaSignCheckResult)t.RBase).RFloorName).ToArray())}";
+                Results.Add(mode);
+            }
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+
+                #region 添加数据
+                int index = 3;
+                foreach (FamilyNameCheckResult result in Results)
+                {
+                    //全部显示
+                    //if (result.IsRight) continue;
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                    int c = 0;
+                    rowN.AddCell(c++, result.FamilyName, style);
+                    rowN.AddCell(c++, result.Type.GetDescription(), style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(c++, rowN4, style);
+                    rowN.AddCell(c++, result.RMessage, style);
+                }
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 32 - 0
ServiceMBI/Check/ModeCheck/FamilyNameCheckResult.cs

@@ -0,0 +1,32 @@
+/* ==============================================================================
+ * 功能描述:编码检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+using System;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    [Serializable]
+    class FamilyNameCheckResult : ModeCheckResultBase
+    {
+        public string FamilyName { get; set; }
+
+        public DCElementType Type { get; set; }
+
+        public string Id { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+        public FamilyNameCheckResult Clone()
+        {
+           return  this.MemberwiseClone() as FamilyNameCheckResult;
+        }
+    }
+}

+ 259 - 0
ServiceMBI/Check/ModeCheck/FloorMissCheck.cs

@@ -0,0 +1,259 @@
+/* ==============================================================================
+ * 功能描述:楼层缺失检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:01:13
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Others;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DocumentSagaSignCheck
+    /// </summary>
+    class FloorMiss : ModeCheckBase
+    {
+        public FloorMiss()
+        {
+            Name = "楼层缺失检查";
+            RIsNeedTwoMoreFloors = true;
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            //检查楼层顺序号
+            IsRight = GetCheckResult();
+            Results.ForEach(t=>t.IsRight=IsRight);
+            RMessage = IsRight ? "" : "楼层平面图名称错误或缺失楼层,请检查";
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+
+        /// <summary>
+        /// 检查楼层顺序号
+        /// </summary>
+        /// <returns></returns>
+        private bool GetCheckResult()
+        {
+            bool sequenceResult = true;
+            if (RBase.Results.Count > 1)
+            {
+                int count = RBase.Results.Count;
+                var baseResults = RBase.Results.Select(t => t as SagaSignCheckResult).ToList();
+                baseResults.Sort(new SSCSComparerByFloorName());
+                for (int i = 0; i < count - 1; i++)
+                {
+                    var item0 = baseResults[i];
+                    var item1 = baseResults[i + 1];
+                    if (item1.RFloorName == item0.RFloorName)
+                    {
+                        sequenceResult = false;
+                        break;
+                    }
+                    else
+                    {
+                        if (!SSCSComparerByFloorName.IsContinuous(item0, item1))
+                        {
+                            sequenceResult = false;
+                            break;
+                        }
+                    }
+                }
+            }
+            RBase.Results.ForEach(t => Results.Add(new FloorMissCheckResult { RBase = t }));
+
+            return sequenceResult;
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //Check();
+
+            IWorkbook book = DCRExport.GetWorkbook();
+            try
+            {
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "楼层平面视图名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                IRow rowF = null;
+                DataCheckNPOIStyle style = this.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                foreach (var result in Results)
+                {
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    //保存第一行,用于赋值
+                    if (rowF == null) rowF = rowN;
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, rbase.RPlanName, style);
+                }
+                if (rowF != null)
+                {
+                    int sindex = rowF.RowNum;
+                    //合并单元格
+                    sheet.MarginCellAndBorder(sindex, index, 4, 4);
+                    sheet.MarginCellAndBorder(sindex, index, 5, 5);
+                    string rowF6 = this.IsRight ? "通过" : "不通过";
+                    rowF.AddCell(4, rowF6, style, true);
+                    rowF.AddCell(5, this.RMessage, style, true);
+                }
+
+                #endregion
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+
+    class SSCSComparerByFloorName : IComparer<SagaSignCheckResult>
+    {
+        private static List<string> m_RuleFloorNames = new List<string> { "RF", "RFM", @"F\d*M?", @"B\d*M?" };
+        public int Compare(SagaSignCheckResult x, SagaSignCheckResult y)
+        {
+            string floorName0 = x.RFloorName;
+            string floorName1 = y.RFloorName;
+            int result = 0;
+            if (floorName0 == floorName1)
+            {
+                result = 0;
+            }
+            else
+            {
+                int item0 = m_RuleFloorNames.FindIndex(t => Regex.IsMatch(floorName0, t));
+                int item1 = m_RuleFloorNames.FindIndex(t => Regex.IsMatch(floorName1, t));
+                //分组组号对比
+                if (item0 == item1)
+                {
+                    int i0 = GetFloorNameIndex(floorName0);
+                    int i1 = GetFloorNameIndex(floorName1);
+                    //楼层序号对比
+                    if (i0 == i1)
+                    {
+                        int j0 = IsSamdwich(floorName0);
+                        int j1 = IsSamdwich(floorName1);
+                        result = j0.CompareTo(j1);
+                    }
+                    else
+                    {
+                        //数字大的,大于数字小的
+                        result = i0.CompareTo(i1);
+                    }
+                }
+                else
+                {
+                    //组号前的大于后面的
+                    result = item1.CompareTo(item0);
+                }
+            }
+            return -1*result;
+        }
+        /// <summary>
+        /// 获取楼层名中的序号
+        /// </summary>
+        /// <param name="name"></param>
+        /// <returns></returns>
+        private static int GetFloorNameIndex(string name)
+        {
+            var str = Regex.Replace(name, @"[^0-9]+", "");
+            var i = str.ToInt();
+            //如果是地下,序号为负
+            if (Regex.IsMatch(name, @"^B\s*"))
+                i = i * -1;
+            return i;
+        }
+        /// <summary>
+        /// 是否为夹层 是返回1,否返回0
+        /// </summary>
+        /// <returns></returns>
+        private static int IsSamdwich(string name)
+        {
+            return Regex.IsMatch(name, @"\s*M") ? 1 : 0;
+        }
+        /// <summary>
+        /// 是否连续
+        /// </summary>
+        public static bool IsContinuous(SagaSignCheckResult x, SagaSignCheckResult y)
+        {
+            bool result = false;
+            string floorName0 = x.RFloorName;
+            string floorName1 = y.RFloorName;
+            if (floorName0 == floorName1)
+            {
+                result = true;
+            }
+            else
+            {
+                if (floorName0 == m_RuleFloorNames[0] || floorName0 == m_RuleFloorNames[1])
+                {
+                    result = true;
+                }
+                else
+                {
+                    int i0 = GetFloorNameIndex(floorName0);
+                    int i1 = GetFloorNameIndex(floorName1);
+                    int j0 = IsSamdwich(floorName0);
+                    int j1 = IsSamdwich(floorName1);
+
+                    if (j0 == 1)
+                    {           
+                        //顶部为夹层
+                        //底部不能为夹层,且楼层序号应该相同
+                        result = j1!=1&&i0 == i1;
+                    }
+                    else
+                    {
+                        if (i0 > 0 && i1 < 0)
+                        {
+                            //地上和地下连续,序号为1和-1
+                            result = i0 == 1 && i1 == -1;
+                        }
+                        else
+                        {
+                            //其它情况连续为序号差为1
+                            result = i0 - i1 == 1;
+                        }
+                    }
+                }
+            }
+
+
+            return result;
+        }
+    }
+
+}

+ 20 - 0
ServiceMBI/Check/ModeCheck/FloorMissCheckResult.cs

@@ -0,0 +1,20 @@
+/* ==============================================================================
+ * 功能描述:楼层缺失检查结果
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:54:25
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// SagaSignCheckResult
+    /// </summary>
+    class FloorMissCheckResult : ModeCheckResultBase
+    {
+
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 134 - 0
ServiceMBI/Check/ModeCheck/FloorSequenceCheck.cs

@@ -0,0 +1,134 @@
+/* ==============================================================================
+ * 功能描述:楼层顺序号检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:01:13
+ * ==============================================================================*/
+
+using System;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DocumentSagaSignCheck
+    /// </summary>
+    class FloorSequenceCheck : ModeCheckBase
+    {
+        public FloorSequenceCheck()
+        {
+            Name = "楼层标高与楼层顺序号检查";
+            RIsNeedTwoMoreFloors = true;
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            //检查楼层顺序号
+            IsRight = CheckFloorSequence();
+            Results.ForEach(t => t.IsRight = IsRight);
+            RMessage = IsRight ? "" : "楼层文件当前层标高排序与物理世界的楼层顺序号排序规则不一致,请检查";
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+
+        /// <summary>
+        /// 检查楼层顺序号
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckFloorSequence()
+        {
+            bool sequenceResult = true;
+            if (RBase.Results.Count > 1)
+            {
+                int count = RBase.Results.Count;
+                for (int i = 0; i < count - 1; i++)
+                {
+                    var item0 = RBase.Results[i] as SagaSignCheckResult;
+                    var item1 = RBase.Results[i + 1] as SagaSignCheckResult;
+                    if (item1.HBase >= item0.HBase)
+                    {
+                        sequenceResult = false;
+                        break;
+                    }
+                }
+            }
+            RBase.Results.ForEach(t => Results.Add(new FloorSequenceCheckResult() { RBase = t }));
+
+            return sequenceResult;
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //Check();
+
+            IWorkbook book = DCRExport.GetWorkbook();
+            try
+            {
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "楼层平面视图名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "标高高度(m)", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "楼层顺序号", DataCheckNPOIStyle.Title);
+                //row4.AddCell(6, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(7, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                IRow rowF = null;
+                DataCheckNPOIStyle style = this.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                foreach (var result in Results)
+                {
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    //保存第一行,用于赋值
+                    if (rowF == null) rowF = rowN;
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+                    rowN.AddCell(3, rbase.RPlanName, style);
+                    rowN.AddCell(4, rbase.HBase.FromApi().MmToM().ToString("f2"), style);
+                    rowN.AddCell(5, rbase.RSequence.ToString(), style);
+                }
+                if (rowF != null)
+                {
+                    int sindex = rowF.RowNum;
+                    //合并单元格
+                    sheet.MarginCellAndBorder(sindex, index, 6, 6);
+                    sheet.MarginCellAndBorder(sindex, index, 7, 7);
+                    string rowF6 = this.IsRight ? "通过" : "不通过";
+                    rowF.AddCell(6, rowF6, style, true);
+                    rowF.AddCell(7, this.RMessage, style, true);
+                }
+
+                #endregion
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 20 - 0
ServiceMBI/Check/ModeCheck/FloorSequenceCheckResult.cs

@@ -0,0 +1,20 @@
+/* ==============================================================================
+ * 功能描述:楼层顺序号检查结果
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:54:25
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// SagaSignCheckResult
+    /// </summary>
+    class FloorSequenceCheckResult : ModeCheckResultBase
+    {
+
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 170 - 0
ServiceMBI/Check/ModeCheck/GridCheck.cs

@@ -0,0 +1,170 @@
+/* ==============================================================================
+ * 功能描述:轴网检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 16:06:26
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// GridCheck
+    /// </summary>
+    class GridCheck : ModeCheckBase
+    {
+        public GridCheck()
+        {
+            Name = "轴网检查";
+            RIsNeedTwoMoreFloors = true;
+        }
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = IsOnTheSameSetGrid();
+            Results.ForEach(t => t.IsRight = IsRight);
+            RMessage = IsRight ? "" : "多个楼层文件所用轴网非同一套轴网,请检查";
+
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+        /// <summary>
+        /// 是否为同一套轴网
+        /// </summary>
+        private bool IsOnTheSameSetGrid()
+        {
+            bool result = true;
+            if (RBase.Results.Count > 1)
+            {
+                var groupByGrid = RBase.Results.GroupBy(t => t, new CommonEqualComparer<ModeCheckResultBase>((item0, item1) =>
+                       {
+                           return IsOnTheSameSetGrid(item0, item1);
+                       }));
+                ;
+                int i = 0;
+                result = groupByGrid.Count() == 1;
+                foreach (IGrouping<ModeCheckResultBase, ModeCheckResultBase> grouping in groupByGrid)
+                {
+                    i++;
+                    foreach (ModeCheckResultBase checkResultBase in grouping)
+                    {
+                        Results.Add(new GridCheckResult() { RBase = checkResultBase, GroupIndex = i });
+                    }
+                }
+            }
+            return result;
+        }
+        /// <summary>
+        /// 两两比较,节约内存
+        /// </summary>
+        /// <param name="item0"></param>
+        /// <param name="item1"></param>
+        /// <returns></returns>
+        private bool IsOnTheSameSetGrid(ModeCheckResultBase b0, ModeCheckResultBase b1)
+        {
+            SagaSignCheckResult item0 = b0 as SagaSignCheckResult;
+            SagaSignCheckResult item1 = b1 as SagaSignCheckResult;
+            bool result = true;
+            var list = new List<SagaSignCheckResult>() { item0, item1 };
+
+            var grids = new List<Grid>();
+            do
+            {
+                grids.Clear();
+
+                foreach (SagaSignCheckResult signResult in list)
+                {
+                    var doc = signResult.RDocument;
+                    var tempGrids = doc.GetElements<Grid>();
+                    grids.AddRange(tempGrids);
+                }
+            } while (!grids.All(t => t.IsValidObject));
+
+            //分组
+            var gridByNames = grids.GroupBy(t => t.Name);
+            foreach (var pair in gridByNames)
+            {
+                var issame = ModeCheckTool.IsSameSetGrid(pair.ToList());
+                if (!issame)
+                {
+                    result = false;
+                }
+            }
+            return result;
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //Check();
+
+            IWorkbook book = DCRExport.GetWorkbook();
+            try
+            {
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                IRow rowF = null;
+                DataCheckNPOIStyle style = this.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                foreach (GridCheckResult result in Results)
+                {
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    //保存第一行,用于赋值
+                    if (rowF == null) rowF = rowN;
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+
+                    rowN.AddCell(0, rbase.RFloorName, style);
+                    rowN.AddCell(1, rbase.RFileName, style);
+                    rowN.AddCell(2, rbase.RPath, style);
+
+                    rowN.AddCell(3, result.GroupIndex.ToString(), style);
+                }
+                if (rowF != null)
+                {
+                    int sindex = rowF.RowNum;
+                    //合并单元格
+                    sheet.MarginCellAndBorder(sindex, index, 4, 4);
+                    sheet.MarginCellAndBorder(sindex, index, 5, 5);
+                    string rowF6 = this.IsRight ? "通过" : "不通过";
+                    rowF.AddCell(4, rowF6, style,true);
+                    rowF.AddCell(5, this.RMessage, style,true);
+                }
+
+                #endregion
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 16 - 0
ServiceMBI/Check/ModeCheck/GridCheckResult.cs

@@ -0,0 +1,16 @@
+/* ==============================================================================
+ * 功能描述:轴网检查结果
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 16:06:46
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// GridResultCheck
+    /// </summary>
+    class GridCheckResult:ModeCheckResultBase
+    {
+        public int GroupIndex { get; set; }
+    }
+}

+ 117 - 0
ServiceMBI/Check/ModeCheck/ModeCheckBase.cs

@@ -0,0 +1,117 @@
+/* ==============================================================================
+ * 功能描述:CheckBase  
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:50:19
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Reflection;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// CheckBase
+    /// </summary>
+    public class ModeCheckBase : ICheckBase
+    {
+
+        public CheckContext Context { get; set; }
+        public string Name { get; set; }
+
+        private List<ModeCheckResultBase> results = new List<ModeCheckResultBase>();
+        internal List<ModeCheckResultBase> Results { get => results; set => results = value; }
+
+        public void Check2(CheckBase.CheckContext context, string fullPath)
+        {
+            Context = context;
+            Check(fullPath);
+        }
+
+        public virtual bool Check(string fullPath)
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual void Correct()
+        {
+            throw new NotImplementedException();
+        }
+
+        public virtual JProperty Export()
+        {
+            JProperty jResult = null;
+            try
+            {
+                JArray jItems = new JArray();
+                foreach (var result in Results)
+                {
+                    var jItem = JObject.Parse(JsonConvert.SerializeObject(result));
+                    if (jItem != null)
+                        jItems.Add(jItem);
+                }
+                jResult=new JProperty(this.GetType().Name, jItems);
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+
+            return jResult;
+        }
+
+        #region 检查结果
+
+        /// <summary>
+        /// 是否通过较验
+        /// </summary>
+        public bool IsRight { get; set; }
+
+        /// <summary>
+        /// 提示信息
+        /// </summary>
+        public string RMessage { get; set; }
+
+        /// <summary>
+        /// 保存并隐藏全部通过的sheet
+        /// </summary>
+        public JProperty Export2()
+        {
+            return Export();
+        }
+        #endregion
+
+        #region 样式控制
+        /// <summary>
+        /// 是否强制勾选
+        /// </summary>
+        public bool RIsReadOnly { get; set; }
+
+
+        private List<string> m_SpecificationSheet = new List<string>();
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        /// <summary>
+        /// 关联规范项
+        /// </summary>
+        public List<string> RSPecificationSheet
+        {
+            get { return m_SpecificationSheet; }
+            set { m_SpecificationSheet = value; }
+        }
+        /// <summary>
+        /// 两层以上楼层检查才有意义
+        /// </summary>
+        public bool RIsNeedTwoMoreFloors { get; set; }
+
+        #endregion
+    }
+}

+ 27 - 0
ServiceMBI/Check/ModeCheck/ModeCheckResultBase.cs

@@ -0,0 +1,27 @@
+/* ==============================================================================
+ * 功能描述:取消序列化使用[JsonIgnore]标记
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:58:54
+ * ==============================================================================*/
+
+using System;
+using System.ComponentModel;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// ResultBase
+    /// </summary>
+    [Serializable]
+    class ModeCheckResultBase
+    {
+        /// <summary>
+        /// 是否通过较验
+        /// </summary>
+        public bool Result { get; set; }
+        /// <summary>
+        /// 提示信息
+        /// </summary>
+        public string Message { get; set; }
+    }
+}

+ 75 - 0
ServiceMBI/Check/ModeCheck/ModeCheckTool.cs

@@ -0,0 +1,75 @@
+/* ==============================================================================
+ * 功能描述:ModeCheckTool  
+ * 创 建 者:Garrett
+ * 创建日期:2019/4/19 9:53:06
+ * ==============================================================================*/
+using Autodesk.Revit.DB;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.RevitUtils.Extends;
+using TSZ.RevitBaseDll.Extends;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// ModeCheckTool
+    /// </summary>
+    class ModeCheckTool
+    {
+        /// <summary>
+        /// 设置长度单位
+        /// </summary>
+        public static Units SetLengthUnit()
+        {
+            var units = new Units(UnitSystem.Metric);
+            units.SetFormatOptions(UnitType.UT_Length, new FormatOptions(DisplayUnitType.DUT_MILLIMETERS));
+            return units;
+        }
+        /// <summary>
+        /// 判断长度单位是否为毫米
+        /// </summary>
+        /// <returns></returns>
+        public static bool IsLengthMMUnit(Document doc)
+        {
+            var units = doc.GetUnits();
+            var formatOptions = units.GetFormatOptions(UnitType.UT_Length);
+            return formatOptions.DisplayUnits == DisplayUnitType.DUT_MILLIMETERS;
+        }
+       
+        /// <summary>
+        /// 是否为同一套轴网
+        /// 条件:平行,中心点与另外一条线的投影点相等
+        /// </summary>
+        /// <param name="grids"></param>
+        /// <returns></returns>
+        public static bool IsSameSetGrid(List<Grid> grids)
+        {
+            int count = grids.Count;
+            bool result = true;
+            if (count >= 2)
+            {
+                var curveF = grids[0].Curve;
+                for (int i = 1; i < count; i++)
+                {
+                    var curveN = grids[i].Curve;
+                    if (!curveF.IsParallel(curveN))
+                    {
+                        result = false;
+                        break;
+                    }
+                    var middleN = curveN.MiddlePoint();
+                    if (!curveF.GetProjectPt(middleN).IsEqual2(middleN))
+                    {
+                        result = false;
+                        break;
+                    }
+                }
+            }
+            return result;
+        }
+
+    }
+}

+ 138 - 0
ServiceMBI/Check/ModeCheck/ParameterIntegrityCheck.cs

@@ -0,0 +1,138 @@
+/* ==============================================================================
+ * 功能描述:Revit族参数完整性检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:08:55
+ * ==============================================================================*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Autodesk.Revit.DB;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Others;
+using SAGA.Models;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+using MBIUtility.Extend;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheck
+    /// </summary>
+    class ParameterIntegrityCheck : ModeCheckBase
+    {
+        public ParameterIntegrityCheck()
+        {
+            Name = "Revit族参数完整性检查";
+        }
+
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = FamilyNameCodeCheck();
+            return IsRight;
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+        /// <summary>
+        /// 族名称编码规范检查
+        /// </summary>
+        /// <returns></returns>
+        private bool FamilyNameCodeCheck()
+        {
+            bool unitResult = true;
+            foreach (SagaSignCheckResult signResult in RBase.Results)
+            {
+                var doc = signResult.RDocument;
+                var instances = doc.GetFamilyInstances();
+                var mbiItems = instances.Where(t => t.IsEquipment() || t.IsEquipmentPart()).ToList();
+                var familyGroups = mbiItems.GroupBy(t => t.GetFamily().Name);
+                foreach (IGrouping<string, FamilyInstance> familyGroup in familyGroups)
+                {
+                    string familyName = familyGroup.Key;
+                    FamilyInstance fi = familyGroup.FirstOrDefault();
+                    var result = GetCheckResult(fi);
+                    if (result == null) continue;
+                    result.FamilyName = familyName;
+                    result.RBase = signResult;
+                    Results.Add(result);
+                }
+            }
+            return Results.All(t => t.IsRight);
+        }
+        /// <summary>
+        /// 获取检测结果
+        /// </summary>
+        /// <param name="fi"></param>
+        /// <returns></returns>
+        private ParameterIntegrityCheckResult GetCheckResult(FamilyInstance fi)
+        {
+            var result = new ParameterIntegrityCheckResult(){IsRight = true};
+            var localNameParameter = fi.GetParameter(MBIBuiltInParameterName.EquipLocalName);
+            var localIdParameter = fi.GetParameter(MBIBuiltInParameterName.EquipLocalID);
+            result.Id = fi.Id.ToString();
+            List<string> list=new List<string>();
+            if(localIdParameter==null)
+                list.Add(MBIBuiltInParameterName.EquipLocalID);
+            if(localNameParameter==null)
+                list.Add(MBIBuiltInParameterName.EquipLocalName);
+            if (list.Count > 0)
+            {
+                result.IsRight = false;
+                result.RMessage = $"缺失的参数为:{string.Join("、", list)}";
+            }
+            return result;
+        }
+
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //   Check();
+            try
+            {
+                IWorkbook book = DCRExport.GetWorkbook();
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                foreach (ParameterIntegrityCheckResult result in Results)
+                {
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    //数量多过,只显示有问题的
+                    if (result.IsRight) continue;
+                 
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                    int c = 0;
+                    rowN.AddCell(c++, rbase.RFloorName, style);
+                    rowN.AddCell(c++, rbase.RFileName, style);
+                    rowN.AddCell(c++, rbase.RPath, style);
+                    rowN.AddCell(c++, result.FamilyName, style);
+                    rowN.AddCell(c++, result.Id, style);
+                    string rowN4 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(c++, rowN4, style);
+                    rowN.AddCell(c++, result.RMessage, style);
+                }
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+    }
+}

+ 25 - 0
ServiceMBI/Check/ModeCheck/ParameterIntegrityCheckResult.cs

@@ -0,0 +1,25 @@
+/* ==============================================================================
+ * 功能描述:Revit参数完整性检查结果 
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 15:13:17
+ * ==============================================================================*/
+
+using System;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// UnitCheckResult
+    /// </summary>
+    [Serializable]
+    class ParameterIntegrityCheckResult : ModeCheckResultBase
+    {
+        public string FamilyName { get; set; }
+        
+        public string Id { get; set; }
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 120 - 0
ServiceMBI/Check/ModeCheck/SagaPositionCheck.cs

@@ -0,0 +1,120 @@
+/* ==============================================================================
+ * 功能描述:楼层Saga标记位置检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:01:13
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DocumentSagaSignCheck
+    /// </summary>
+    class SagaPositionCheck : ModeCheckBase
+    {
+        public SagaPositionCheck()
+        {
+            Name = "saga标记位置合法性检查";
+        }
+        //通过率
+        private double m_RateValue = 0.8;
+        [DataCheckProcessAspect]
+        public override bool Check()
+        {
+            if (!RBase.IsRight)
+            {
+                IsRight = RBase.IsRight;
+                return IsRight;
+            }
+            IsRight = CheckSagaPosition();
+            return IsRight;
+        }
+        /// <summary>
+        /// saga标记位置检查
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckSagaPosition()
+        {
+            bool sequenceResult = true;
+            //标准通过率
+            double rrate =m_RateValue;
+            foreach (SagaSignCheckResult result in RBase.Results)
+            {
+                double rate = result.RCPassRate;
+                bool isright = rate.IsThanEq(rrate);
+                string tip = isright ? "" : $"构件范围检查通过率低于{rrate * 100}%,请检查saga标记位置是否正确";
+                var tempResult = new SagaPositionCheckCheckResult();
+                tempResult.IsRight = isright;
+                tempResult.RMessage = tip;
+                tempResult.RBase = result;
+                Results.Add(tempResult);
+            }
+
+            return Results.All(t => t.IsRight);
+        }
+
+        public override void Correct()
+        {
+            throw new NotImplementedException();
+        }
+        //[DataCheckProcessAspect]
+        public override void Export()
+        {
+            //Check();
+
+            IWorkbook book = DCRExport.GetWorkbook();
+            try
+            {
+                //ISheet sheet = book.CreateSheet(Name);
+                ISheet sheet = book.GetSheet(Name);
+
+                #region 添加数据
+                int index = 3;
+                //IRow row4 = sheet.CreateRow(index);
+                //row4.HeightInPoints = 15;
+
+                //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
+                //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
+                //row4.AddCell(3, "楼层平面视图名称", DataCheckNPOIStyle.Title);
+                //row4.AddCell(4, "构件范围通过率(%)", DataCheckNPOIStyle.Title);
+                //row4.AddCell(5, "通过", DataCheckNPOIStyle.Title);
+                //row4.AddCell(6, "备注(失败原因)", DataCheckNPOIStyle.Title);
+                DataCheckNPOIStyle style = this.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
+                foreach (var result in Results)
+                {
+                    index++;
+                    IRow rowN = sheet.CreateRow(index);
+                    SagaSignCheckResult rbase = result.RBase as SagaSignCheckResult;
+                    if (rbase == null)
+                        continue;
+                    int c = 0;
+                    rowN.AddCell(c++, rbase.RFloorName, style);
+                    rowN.AddCell(c++, rbase.RFileName, style);
+                    rowN.AddCell(c++, rbase.RPath, style);
+                    rowN.AddCell(c++, rbase.RPlanName, style);
+                    rowN.AddCell(c++, $"{(rbase.InstPassRate * 100):f2}%", style);
+                    rowN.AddCell(c++, $"{(rbase.ColumnWallPassRate * 100):f2}%", style);
+                    rowN.AddCell(c++, $"{(rbase.SpacePassRate * 100):f2}%", style);
+                    rowN.AddCell(c++, $"{(rbase.RCPassRate*100):f2}%", style);
+                    string rowF6 = result.IsRight ? "通过" : "不通过";
+                    rowN.AddCell(c++, rowF6, style);
+                    rowN.AddCell(c++, result.RMessage, style);
+                }
+
+                #endregion
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+
+    }
+}

+ 19 - 0
ServiceMBI/Check/ModeCheck/SagaPositionCheckCheckResult.cs

@@ -0,0 +1,19 @@
+/* ==============================================================================
+ * 功能描述:楼层Saga标记位置结果
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:54:25
+ * ==============================================================================*/
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// SagaSignCheckResult
+    /// </summary>
+    class SagaPositionCheckCheckResult : ModeCheckResultBase
+    {
+        public override void Export()
+        {
+            base.Export();
+        }
+    }
+}

+ 109 - 0
ServiceMBI/Check/ModeCheck/SagaSignCheck.cs

@@ -0,0 +1,109 @@
+/* ==============================================================================
+ * 功能描述:saga标记检查
+ * 创 建 者:Garrett
+ * 创建日期:2018/10/23 9:01:13
+ * ==============================================================================*/
+
+using System;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Autodesk.Revit.DB;
+using Newtonsoft.Json.Linq;
+using NPOI.SS.UserModel;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.Model;
+using SAGA.RevitUtils.Extends;
+using ServiceMBI.Check.CheckBase;
+
+namespace ServiceMBI.Check.ModeCheck
+{
+    /// <summary>
+    /// DocumentSagaSignCheck
+    /// </summary>
+    public class SagaSignCheck : ModeCheckBase
+    {
+        public SagaSignCheck()
+        {
+            Name = "楼层平面图命名规范检查";
+        }
+
+
+        #region Check
+        [DataCheckProcessAspect]
+        public override bool Check(string fullPath)
+        {
+            //1,首先检查saga标记和楼层编码符合建模规范要求
+            IsRight = CheckSagaSign(fullPath);
+            return IsRight;
+        }
+        /// <summary>
+        /// 检查saga标记
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckSagaSign(string fullPath)
+        {
+            bool allRight = true;
+            //获取建筑下的楼层
+            int i = 0;
+            var result = new SagaSignCheckResult() ;
+            Results.Add(result);
+            result.PlanName = "-";
+            //判断是否存在Saga标记
+            var document = DocumentQueue.FindDocument(fullPath);
+            var sagaPlans = document.GetElements<ViewPlan>().Where(t => t.ViewType == ViewType.FloorPlan && t.Name.Contains("-saga")).ToList();
+            if (!sagaPlans.Any())
+            {
+                result.Result = false;
+                result.Message = "缺少saga标记";
+            }
+            else if (sagaPlans.Count() >= 2)
+            {
+                result.Result = false;
+                result.Message = "有多个saga标记";
+            }
+            else
+            {
+                //只有一个saga标记
+                var sagaPlan = sagaPlans.FirstOrDefault();
+                string sagaPlanName = sagaPlan.Name;
+                result.PlanName = sagaPlanName;
+                result.HBase = sagaPlan.GenLevel.Elevation;
+                //打标记的楼层名称必需为指定格式;B1,B1M,F1,F1M,RFM,RF
+                if (Regex.IsMatch(sagaPlanName, @"^([BF][1-9]\d*M?|RFM?)-saga$"))
+                {
+                    
+                    var rfLevel = document.GetLevels().FirstOrDefault(t => System.Text.RegularExpressions.Regex.IsMatch(t.Name, @"^RF(-saga)?$"));
+                    if (rfLevel == null)
+                    {
+                        result.Result = false;
+                        result.Message = $"缺少RF标高";
+                    }
+                    else
+                    {
+                        if (rfLevel.Elevation.IsThanEq(result.HBase))
+                        {
+                            result.Result = true;
+                        }
+                        else
+                        {
+                            result.Result = false;
+                            result.Message = $"RF标高的位置不正确,请检查";
+                        }
+                    }
+                }
+                else
+                {
+                    result.Result = false;
+                    result.Message = $"楼层 {sagaPlanName} 不符合楼层命名规范";
+                }
+
+
+            }
+            return Results.All(t => t.Result);
+        }
+
+        #endregion
+        
+    }
+}

+ 0 - 0
ServiceMBI/Check/ModeCheck/SagaSignCheckResult.cs


Some files were not shown because too many files changed in this diff