mengxiangge 5 лет назад
Родитель
Сommit
8d2fdcb1c5

+ 3 - 0
FirmLib/Com.FirmLib.UI/Com.FirmLib.UI.csproj

@@ -135,6 +135,9 @@
     <Compile Include="BllCommon\ProductTypeManager.cs" />
     <Compile Include="BllCommon\ProjectIdManager.cs" />
     <Compile Include="BllCommon\ProjectManager.cs" />
+    <Compile Include="Common\CodeParse\ComponentCodeToInputType.cs" />
+    <Compile Include="Common\CodeParse\DalInfoCode.cs" />
+    <Compile Include="Common\CodeParse\InputService.cs" />
     <Compile Include="Common\CommonStyles.cs" />
     <Compile Include="Common\Enums.cs" />
     <Compile Include="Common\IdNameItem.cs" />

+ 28 - 0
FirmLib/Com.FirmLib.UI/Common/CodeParse/ComponentCodeToInputType.cs

@@ -0,0 +1,28 @@
+/* ==============================================================================
+ * 功能描述:ComponentCodeToInputType  
+ * 创 建 者:Garrett
+ * 创建日期:2019/9/23 18:14:28
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Com.FirmLib.UI.Common.CodeParse
+{
+    /// <summary>
+    /// 组件编码对应Revit的输入方式
+    /// </summary>
+    public class ComponentCodeToInputType
+    {
+        /// <summary>
+        /// 组件编码
+        /// </summary>
+        public string ComponentCode { get; set; }
+        /// <summary>
+        /// Revit组件类型
+        /// </summary>
+        public string InputType { get; set; }
+    }
+}

+ 45 - 0
FirmLib/Com.FirmLib.UI/Common/CodeParse/DalInfoCode.cs

@@ -0,0 +1,45 @@
+/* ==============================================================================
+ * 功能描述:DalInfoCode  
+ * 创 建 者:Garrett
+ * 创建日期:2019/9/23 18:13:51
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Serializer;
+
+namespace Com.FirmLib.UI.Common.CodeParse
+{
+    /// <summary>
+    /// DalInfoCode
+    /// </summary>
+    class DalInfoCode
+    {
+        /// <summary>
+        /// 读取组件对照表
+        /// </summary>
+        /// <returns></returns>
+        public static List<ComponentCodeToInputType> Read()
+        {
+            string path = Path.Combine(AppBaseInfo.AppRunPath, "MBIResource", "DataDictionary");
+            string fileName = "ComponentCodeToInputType.xml";
+            return SerializerByXml.DeserializeList<ComponentCodeToInputType>(path, fileName);
+        }
+
+        /// <summary>
+        /// 由组件编码获取Revit输入类型
+        /// </summary>
+        /// <param name="componentCode"></param>
+        /// <returns></returns>
+        public static string GetInputType(string componentCode)
+        {
+            var codes = Read();
+            var item = codes.FirstOrDefault(t => t.ComponentCode == componentCode);
+            return item?.InputType;
+        }
+    }
+}

+ 25 - 0
FirmLib/Com.FirmLib.UI/Common/CodeParse/InputService.cs

@@ -0,0 +1,25 @@
+/* ==============================================================================
+ * 功能描述:InputService  
+ * 创 建 者:Garrett
+ * 创建日期:2019/9/23 18:15:26
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.RevitUtils.Service;
+
+namespace Com.FirmLib.UI.Common.CodeParse
+{
+    /// <summary>
+    /// 输入服务限定
+    /// </summary>
+    public class InputService : IInputService
+    {
+        public string GetInputCode(string originalCode)
+        {
+            return DalInfoCode.GetInputType(originalCode);
+        }
+    }
+}

+ 2 - 2
MBIResource/Services/Services.xml

@@ -2,7 +2,7 @@
 <Services>
   <ServiceConfigItem>
     <Name></Name>
-    <ClassName>SAGA.MBI.Service.InputService</ClassName>
-    <DllPath>SAGA.MBI.exe</DllPath>
+    <ClassName>Com.FirmLib.UI.Common.CodeParse.InputService</ClassName>
+    <DllPath>Com.FirmLib.UI.dll</DllPath>
    </ServiceConfigItem>
 </Services>

+ 0 - 8
Test/Test.csproj

@@ -60,17 +60,9 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Dlls\INIFileParser.dll</HintPath>
     </Reference>
-    <Reference Include="MrAdvice, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c0e7e6eab6f293d8, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Dlls\MrAdvice.dll</HintPath>
-    </Reference>
     <Reference Include="SAGA.DotNetUtils">
       <HintPath>..\Dlls\SAGA.DotNetUtils.dll</HintPath>
     </Reference>
-    <Reference Include="SAGA.MBI, Version=1.0.7202.36842, Culture=neutral, processorArchitecture=AMD64">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\Dlls\SAGA.MBI.exe</HintPath>
-    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Xml" />