Quellcode durchsuchen

mxg:新加系统清单,设备清单,资产清单三个命令;更换信息点类型接口。

mengxiangge vor 6 Jahren
Ursprung
Commit
e27f63f06b
31 geänderte Dateien mit 645 neuen und 568 gelöschten Zeilen
  1. 23 0
      MBI/MBIResource/DataDictionary/ComponentCodeToInputType.xml
  2. 46 4
      MBI/Menu/SAGABIM.xml
  3. BIN
      MBI/RibbonImage/系统清单.png
  4. BIN
      MBI/RibbonImage/系统清单16.png
  5. BIN
      MBI/RibbonImage/设备清单.png
  6. BIN
      MBI/RibbonImage/设备清单16.png
  7. BIN
      MBI/RibbonImage/资产清单.png
  8. BIN
      MBI/RibbonImage/资产清单16.png
  9. 191 0
      MBI/SAGA.DotNetUtils/Serializer/SerializerByXml.cs
  10. 1 0
      MBI/SAGA.MBI/App.xaml.cs
  11. 1 1
      MBI/SAGA.MBI/Common/CacheAspect.cs
  12. 1 1
      MBI/SAGA.MBI/Common/MBIConst.cs
  13. 29 24
      MBI/SAGA.MBI/DataArrange/DalCommon.cs
  14. 62 0
      MBI/SAGA.MBI/DataArrange/DalInfoCode.cs
  15. 7 7
      MBI/SAGA.MBI/DataArrange/DalSpace.cs
  16. 5 4
      MBI/SAGA.MBI/DataArrange/DalVisionOperate.cs
  17. 0 251
      MBI/SAGA.MBI/FileStream/FileOperateBase.cs
  18. 3 2
      MBI/SAGA.MBI/FileStream/ProjectDirOperate.cs
  19. 56 73
      MBI/SAGA.MBI/Html5Command.cs
  20. 46 3
      MBI/SAGA.MBI/JsonConvert/CommonConvert.cs
  21. 7 105
      MBI/SAGA.MBI/JsonConvert/PEPCodeConvert.cs
  22. 99 0
      MBI/SAGA.MBI/Model/MBSpace.cs
  23. 3 3
      MBI/SAGA.MBI/Model/MISpace.cs
  24. 15 0
      MBI/SAGA.MBI/Model/PropertyDefineTb.cs
  25. 19 11
      MBI/SAGA.MBI/RequestData/CommonRequest.cs
  26. 5 40
      MBI/SAGA.MBI/RequestData/PEPCodeRequest.cs
  27. 2 1
      MBI/SAGA.MBI/SAGA.MBI.csproj
  28. 16 31
      MBI/SAGA.MBI/ToolsData/DataCheck/SpaceEquipFloorCheck.cs
  29. 2 1
      MBI/SAGA.MBI/ToolsData/UpdateFileVision.cs
  30. 4 4
      MBI/SAGA.MBI/WinView/BeModingDutyList/WinFMMergeTip4.xaml
  31. 2 2
      MBI/SAGA.MBI/WinView/Login/UcMFMFloorUp.xaml

+ 23 - 0
MBI/MBIResource/DataDictionary/ComponentCodeToInputType.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ArrayOfComponentCodeToInputType xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <ComponentCodeToInputType>
+    <ComponentCode>A1</ComponentCode>
+    <InputType>TextBox_Double_A1</InputType>
+  </ComponentCodeToInputType>
+  <ComponentCodeToInputType>
+    <ComponentCode>A2</ComponentCode>
+    <InputType>Textbox_DoubleUnit_A2</InputType>
+  </ComponentCodeToInputType>
+  <ComponentCodeToInputType>
+    <ComponentCode>B1</ComponentCode>
+    <InputType>TextBox_String_B1</InputType>
+  </ComponentCodeToInputType>
+  <ComponentCodeToInputType>
+    <ComponentCode>C5</ComponentCode>
+    <InputType>DataTime_Date_C5</InputType>
+  </ComponentCodeToInputType>
+  <ComponentCodeToInputType>
+    <ComponentCode>D1</ComponentCode>
+    <InputType>Enum_D1</InputType>
+  </ComponentCodeToInputType>
+</ArrayOfComponentCodeToInputType>

+ 46 - 4
MBI/Menu/SAGABIM.xml

@@ -129,11 +129,11 @@
       <MenuTab>MCJPC_W</MenuTab>
       <Modules>TSRP</Modules>
     </Button>
-   <Button ButtonStyles="Separator">
+    <Button ButtonStyles="Separator">
       <MenuTab>MCJPC_W</MenuTab>
       <Modules>TSRP</Modules>
     </Button>
-<Button ButtonStyles="Large">
+    <Button ButtonStyles="Large">
       <ButtonName>SAGA.MBI.SyncLocalNameCommand</ButtonName>
       <ButtonText>同步本地名称信息点</ButtonText>
       <ImageName>6、模型信息点维护</ImageName>
@@ -189,8 +189,20 @@
       <Modules>TSRP</Modules>
     </Button>
   </Panel>
- 
-
+  <Panel PanelName="设备台账" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
+    <Button ButtonStyles="Large">
+      <ButtonName>SAGA.MBI.EquipmentListCommand</ButtonName>
+      <ButtonText>设备清单</ButtonText>
+      <ImageName>设备清单</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.EquipmentListCommand</ClassName>
+      <ToolTip>设备清单</ToolTip>
+      <LongDescription>设备清单</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>Space_W</MenuTab>
+      <Modules>Space</Modules>
+    </Button>
+  </Panel>
   <Panel PanelName="业务空间管理" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
     <Button ButtonStyles="Large">
       <ButtonName>SAGA.MBI.SpaceListCommand</ButtonName>
@@ -205,6 +217,21 @@
       <Modules>Space</Modules>
     </Button>
   </Panel>
+
+  <Panel PanelName="系统管理" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
+    <Button ButtonStyles="Large">
+      <ButtonName>SAGA.MBI.SystemListCommand</ButtonName>
+      <ButtonText>系统清单</ButtonText>
+      <ImageName>系统清单</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.SystemListCommand</ClassName>
+      <ToolTip>系统清单</ToolTip>
+      <LongDescription>系统清单</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>Space_W</MenuTab>
+      <Modules>Space</Modules>
+    </Button>
+  </Panel>
   <!--厂商库-->
   <Panel PanelName="厂商资料库" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
     <Button ButtonStyles="Large">
@@ -258,6 +285,21 @@
       <Modules>CSZLK</Modules>
     </Button>
   </Panel>
+
+  <Panel PanelName="资产台账" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
+    <Button ButtonStyles="Large">
+      <ButtonName>SAGA.MBI.AssetListCommand</ButtonName>
+      <ButtonText>资产清单</ButtonText>
+      <ImageName>资产清单</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.AssetListCommand</ClassName>
+      <ToolTip>资产清单</ToolTip>
+      <LongDescription>资产清单</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>ZCGL_W</MenuTab>
+      <Modules>ZCGL</Modules>
+    </Button>
+  </Panel>
   <Panel PanelName="扫楼业务" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17" ButtonStyles="Large">
     <Button ButtonStyles="Large">
       <ButtonName>SAGA.MBI.ScanDataCommand</ButtonName>

BIN
MBI/RibbonImage/系统清单.png


BIN
MBI/RibbonImage/系统清单16.png


BIN
MBI/RibbonImage/设备清单.png


BIN
MBI/RibbonImage/设备清单16.png


BIN
MBI/RibbonImage/资产清单.png


BIN
MBI/RibbonImage/资产清单16.png


+ 191 - 0
MBI/SAGA.DotNetUtils/Serializer/SerializerByXml.cs

@@ -4,11 +4,13 @@
  * 创建日期:2018/4/3 17:23:34
  * ==============================================================================*/
 using System;
+using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Xml.Serialization;
 
 namespace SAGA.DotNetUtils.Serializer
@@ -35,5 +37,194 @@ namespace SAGA.DotNetUtils.Serializer
                 return (T)serializer.Deserialize(stream);// 反序列化得到新的对象  
             }
         }
+        /// <summary>
+        /// 序列化成xml字符串
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns>序列化后的字符串</returns>
+        public static string Serialize(object obj)
+        {
+            string str = "";
+            XmlSerializer xs = new XmlSerializer(obj.GetType());
+            using (MemoryStream ms = new MemoryStream())
+            {
+                try
+                {
+                    System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8);
+                    xtw.Formatting = System.Xml.Formatting.Indented;
+                    xs.Serialize(xtw, obj);
+                    ms.Seek(0, SeekOrigin.Begin);
+                    using (StreamReader sr = new StreamReader(ms))
+                    {
+                        try
+                        {
+                            str = sr.ReadToEnd();
+                            xtw.Close();
+                            ms.Close();
+                        }
+                        catch (Exception e)
+                        {
+                            Console.WriteLine(e);
+                        }
+                        finally
+                        {
+                            xtw.Close();
+                            sr.Close();
+                        }
+
+                    }
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine(e);
+                }
+                finally
+                {
+                    ms.Close();
+                }
+
+            }
+            return str;
+        }
+        /// <summary>
+        /// 序列化并保存
+        /// 类必须标记为可序列化[Serializable]
+        /// </summary>
+        public static void SerializeAndSave(string filePath, string fileName, object obj)
+        {
+            string path = Path.Combine(filePath, fileName);
+
+            if (!Directory.Exists(filePath))
+                Directory.CreateDirectory(filePath);
+
+            using (System.IO.FileStream fs = new System.IO.FileStream(path, FileMode.OpenOrCreate))
+            {
+                fs.SetLength(0);
+                using (StreamWriter sw = new StreamWriter(fs))
+                {
+                    try
+                    {
+                        fs.Position = 0;
+                        var jsonData = Serialize(obj);
+                        //var jsonData = Newtonsoft_Common.SerializeObjToJson(new Serialization<T>(floorSequences));
+                        sw.Write(jsonData);
+                        //BinaryFormatter bf = new BinaryFormatter();
+                        //bf.Serialize(fs, floorSequences); //复制到流中
+                        //MessageBox.Show("保存成功!");
+                        //上传数据
+                    }
+                    catch (Exception ex)
+                    {
+                        MessageBox.Show("保存失败!!!" + ex.ToString());
+                    }
+                    finally
+                    {
+                        sw.Flush();
+                        sw.Close();
+                        fs.Close();
+                    }
+                }
+            }
+        }
+        /// <summary>
+        /// 反序列化方法
+        /// </summary>
+        /// <typeparam name="T">反序列化对象类型</typeparam>
+        /// <param name="xml">反序列化字符串或者xml文件路径</param>
+        /// <returns></returns>
+        public static T Desrialize<T>(string path)
+        {
+            T obj = default(T);
+            XmlSerializer xs = new XmlSerializer(typeof(T));
+            TextReader tr = null;
+            try
+            {
+
+                if (!File.Exists(path))
+                {
+                    tr = new StringReader(path);
+                }
+                else
+                {
+                    tr = new StreamReader(path);
+                }
+                using (tr)
+                {
+                    obj = (T)xs.Deserialize(tr);
+                }
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine(e);
+            }
+            finally
+            {
+                tr?.Close();
+            }
+            return obj;
+        }
+        /// <summary>
+        /// 反序列化
+        /// </summary>
+        /// <returns></returns>
+        public static T Deserialize<T>(string filePath, string fileName)
+        {
+            T floorSequences = default(T);
+            string path = Path.Combine(filePath, fileName);
+            if (!File.Exists(path))
+                return floorSequences;
+            try
+            {
+                var obj = Desrialize<T>(path);
+                floorSequences = obj;
+                //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(jsonData);
+            }
+            catch (Exception ex)
+            {
+                //MessageBox.Show("读取失败!!!"+ex.ToString());
+
+            }
+            finally
+            {
+            }
+            return floorSequences;
+        }
+        /// <summary>
+        /// 反序列化
+        /// </summary>
+        /// <returns></returns>
+        public static List<T> DeserializeList<T>(string filePath, string fileName)
+        {
+            List<T> floorSequences = new List<T>();
+            string path = Path.Combine(filePath, fileName);
+            if (!File.Exists(path))
+                return floorSequences;
+            using (StreamReader sr = new StreamReader(path, Encoding.Default))
+            {
+
+                try
+                {
+                    var obj = Desrialize<List<T>>(path);
+                    //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(jsonData);
+
+                    var objs = (IEnumerable)obj;
+                    if (objs != null)
+                        floorSequences = objs.Cast<T>().ToList();
+                }
+                catch (Exception ex)
+                {
+                    //MessageBox.Show("读取失败!!!"+ex.ToString());
+
+                }
+                finally
+                {
+                    sr.Close();
+                }
+            }
+            return floorSequences;
+        }
+        
+     
+
     }
 }

+ 1 - 0
MBI/SAGA.MBI/App.xaml.cs

@@ -12,6 +12,7 @@ using System.Windows;
 using CEFSharpWpf;
 using SAGA.DotNetUtils;
 using SAGA.DotNetUtils.Others;
+using SAGA.MBI.DataArrange;
 using SAGA.MBI.WinView.Login;
 
 namespace SAGA.MBI

+ 1 - 1
MBI/SAGA.MBI/Common/CacheAspect.cs

@@ -27,7 +27,7 @@ namespace SAGA.MBI.Common
                     context.Proceed();
                     return context.ReturnValue;
                 },
-                new TimeSpan(12, 30, 0));//30分钟过期
+                new TimeSpan(12, 30, 0));//12小时30分钟过期
             context.ReturnValue = result;
         }
     }

+ 1 - 1
MBI/SAGA.MBI/Common/MBIConst.cs

@@ -28,8 +28,8 @@ namespace SAGA.MBI.Common
 
         public static readonly string MBIImagePath = AppBaseInfo.ImagePath;
         public static readonly string MBIResourcePath = Path.Combine(AppBaseInfo.AppRunPath, "MBIResource");
+        public static readonly string MBIDataDictionaryPath = Path.Combine(MBIResourcePath, "DataDictionary");
         public static readonly string EmptyFilePath = Path.Combine(MBIResourcePath, "EmptyFile\\EmptyProject.rvt");
-        public static readonly string ChangesRelationship = Path.Combine(MBIResourcePath, "EmptyFile\\EmptyProject.rvt");
         public static readonly string BeaconFamilyFilePath = Path.Combine(AppBaseInfo.FamilyPath, "Beacon.rfa");
         public static readonly string SpaceTagFamilyFilePath = Path.Combine(AppBaseInfo.FamilyPath, "空间标记.rfa");
 

+ 29 - 24
MBI/SAGA.MBI/DataArrange/DalCommon.cs

@@ -30,7 +30,7 @@ namespace SAGA.MBI.DataArrange
     /// </summary>
     public class DalCommon
     {
-       
+
         /// <summary>
         /// 获取设备的信息,同时根据bimid,请求云平台id
         /// </summary>
@@ -69,7 +69,7 @@ namespace SAGA.MBI.DataArrange
                 }
             }
 
-            return equipment?? GetDefaultEquipBase(elem);
+            return equipment ?? GetDefaultEquipBase(elem);
         }
         /// <summary>
         /// 获取设备的信息,不请求云平台id
@@ -123,7 +123,7 @@ namespace SAGA.MBI.DataArrange
         public static MRevitEquipBase GetDefaultEquipBase(Element elem)
         {
             if (elem == null) return null;
-            MRevitEquipBaseNull mode =new MRevitEquipBaseNull();
+            MRevitEquipBaseNull mode = new MRevitEquipBaseNull();
             mode.BimID = elem.Id.ToString();
             var family = elem.GetFamily();
             if (family != null)
@@ -163,7 +163,7 @@ namespace SAGA.MBI.DataArrange
         /// <param name="id">岗位id</param>
         /// <param name="bimid"></param>
         /// <returns></returns>
-        public static bool UpdateBimId(string id,string bimid)
+        public static bool UpdateBimId(string id, string bimid)
         {
             //保留,清除BIMID
             JObject jObject = new JObject();
@@ -175,21 +175,26 @@ namespace SAGA.MBI.DataArrange
         /// <summary>
         /// 获取云平台所有revit相关的数据
         /// </summary>
-        public static List<MRevitEquipBase> DownLoadCouldData(string floorId, string[] type=null)
+        public static List<MRevitEquipBase> DownLoadCouldData(string floorId, string[] type = null)
         {
             List<MRevitEquipBase> list = new List<MRevitEquipBase>();
             if (type == null)
-                type = new[] {"Eq", "Ec", "VOBc", "Si"};
-            var typelist = type.ToList();
-            string spacetype = "Si";
-            //空间
-            if (typelist.Contains(spacetype))
+                type = new[] { "Eq", "Ec", "VOBc", "Si" };
+            var goodhandTypes = new[] { "Eq", "Ec", "VOBc" };
+
+            var bygoodhandQuerys = type.Where(t => goodhandTypes.Contains(t)).ToArray();
+            if (bygoodhandQuerys.Any())
             {
-                list.AddRange(SpaceConvert.GetFloorSpaceInfos(floorId));
-                typelist.Remove(spacetype);
+                //通过goodhand后台查询的数据,设备,部件,信标
+                list.AddRange(CommonConvert.FloorQuery_GoodHand(floorId, bygoodhandQuerys));
             }
-            //其它
-            list.AddRange(CommonConvert.FloorQuery(floorId, typelist?.ToArray()));
+            var bySubsetQuerys = type.Where(t => !goodhandTypes.Contains(t)).ToArray();
+            if (bySubsetQuerys.Any())
+            {
+                //通过subset_query查询的数据,空间,业务空间
+                list.AddRange(CommonConvert.FloorQuery_SubSet(floorId,bySubsetQuerys));
+            }
+
             return list;
         }
         /// <summary>
@@ -279,7 +284,7 @@ namespace SAGA.MBI.DataArrange
         {
             string buildingId = DalProjectTree.GetBuildingIdByFloor(floorId);
             return CommonConvert.QueryOutsideObject(null, buildingId, "", RelationConst.EquipinFloorGraphId,
-                RelationConst.EquipinFloorRelationType, -1, new[] {"Eq", "Ec"});
+                RelationConst.EquipinFloorRelationType, -1, new[] { "Eq", "Ec" });
         }
 
         /// <summary>
@@ -288,7 +293,7 @@ namespace SAGA.MBI.DataArrange
         /// <param name="datas"></param>
         public static void BatchUpdate(IEnumerable<MRevitEquipBase> datas)
         {
-            var criterias=new JArray();
+            var criterias = new JArray();
             foreach (MRevitEquipBase data in datas)
             {
                 if (data.Operator == DocumentChangedOperator.Modified)
@@ -380,14 +385,14 @@ namespace SAGA.MBI.DataArrange
                     {
                         list.Add(jobjItem);
                     }
-                }           
+                }
                 #endregion
                 typelist.Remove(spacetype);
             }
             //其它
             if (typelist.Any())
             {
-                var json = CommonRequest.FloorQuery(floorId, type);
+                var json = CommonRequest.FloorQuery_GoodHand(floorId, type);
                 #region 获取除空间外的数据
                 if (json.IsRequestHasItem())
                 {
@@ -396,9 +401,9 @@ namespace SAGA.MBI.DataArrange
                     {
                         list.Add(jobjItem);
                     }
-                } 
+                }
                 #endregion
-            }           
+            }
             return list;
         }
 
@@ -411,7 +416,7 @@ namespace SAGA.MBI.DataArrange
         {
             try
             {
-                var result =CommonRequest.QueryObjectById(id);
+                var result = CommonRequest.QueryObjectById(id);
                 if (!result.IsRequestHasItem())
                 {
                     return null;
@@ -426,7 +431,7 @@ namespace SAGA.MBI.DataArrange
             }
         }
 
-        private static List<MRevitEquipBase> m_AllRevitObjects=null;
+        private static List<MRevitEquipBase> m_AllRevitObjects = null;
         /// <summary>
         /// 在缓存中通过bimid查找
         /// 如果查找不到,重新加载缓存
@@ -440,7 +445,7 @@ namespace SAGA.MBI.DataArrange
             {
                 rbase = m_AllRevitObjects?.FirstOrDefault(t => t.BimID == bimId);
             }
-            if (rbase==null)
+            if (rbase == null)
             {
                 string floorId = bimId.GetFloorId();
                 string buildingId = DalProjectTree.GetBuildingIdByFloor(floorId);
@@ -456,7 +461,7 @@ namespace SAGA.MBI.DataArrange
         /// <returns></returns>
         public static List<MRevitEquipBase> GetAllDutys(string buildingId)
         {
-            return CommonConvert.CacheAllData(buildingId); 
+            return CommonConvert.CacheAllData(buildingId);
         }
 
         /// <summary>

+ 62 - 0
MBI/SAGA.MBI/DataArrange/DalInfoCode.cs

@@ -0,0 +1,62 @@
+/* ==============================================================================
+ * 功能描述:组件编码
+ * 创 建 者:Garrett
+ * 创建日期:2019/1/17 10:11:41
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.DotNetUtils.Serializer;
+using SAGA.MBI.Common;
+using SAGA.MBI.FileStream;
+using SAGA.MBI.Model;
+
+namespace SAGA.MBI.DataArrange
+{
+    /// <summary>
+    /// DalEquipCode
+    /// </summary>
+    class DalInfoCode
+    {
+        /// <summary>
+        /// 初始化组件对照表
+        /// </summary>
+        public static void Init()
+        {
+            var codes=new List<ComponentCodeToInputType>();
+            codes.Add(new ComponentCodeToInputType(){ComponentCode = "A1",InputType = "TextBox_Double_A1" });
+            codes.Add(new ComponentCodeToInputType() { ComponentCode = "A2", InputType = "Textbox_DoubleUnit_A2" });
+            codes.Add(new ComponentCodeToInputType() { ComponentCode = "B1", InputType = "TextBox_String_B1" });
+            codes.Add(new ComponentCodeToInputType() { ComponentCode = "C5", InputType = "DataTime_Date_C5" });
+            codes.Add(new ComponentCodeToInputType() { ComponentCode = "D1", InputType = "Enum_D1" });
+            string path = MBIConst.MBIDataDictionaryPath;
+            string fileName = "ComponentCodeToInputType.xml";
+            SerializerByXml.SerializeAndSave(path, fileName, codes);
+        }
+        /// <summary>
+        /// 读取组件对照表
+        /// </summary>
+        /// <returns></returns>
+        [CacheAspect]
+        public static List<ComponentCodeToInputType> Read()
+        {
+            string path = MBIConst.MBIDataDictionaryPath;
+            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;
+        }
+    }
+}

+ 7 - 7
MBI/SAGA.MBI/DataArrange/DalSpace.cs

@@ -35,10 +35,10 @@ namespace SAGA.MBI.DataArrange
         /// </summary>
         /// <param name="elem"></param>
         /// <returns></returns>
-        public static MSpace GetSpaceQueryId(Element elem)
+        public static MISpace GetSpaceQueryId(Element elem)
         {
             if (!elem.IsSpace()) return null;
-            MSpace mspace = GetSpace(elem);
+            MISpace mspace = GetSpace(elem);
             if (mspace == null) return null;
             //可能需要读取其它数据
             SpaceConvert.QuerySpaceInfo(mspace);
@@ -50,13 +50,13 @@ namespace SAGA.MBI.DataArrange
         /// </summary>
         /// <param name="elem"></param>
         /// <returns></returns>
-        public static MSpace GetSpace(Element elem)
+        public static MISpace GetSpace(Element elem)
         {
             if (!elem.IsSpace()) return null;
             Space space = elem as Space;
             string floorId = elem.Document.PathName.GetFileName();
             var bimId= space.GetCloudBIMId();
-            MSpace mspace = new MSpace(floorId,bimId);
+            MISpace mspace = new MISpace(floorId,bimId);
             //可能需要读取其它数据
             mspace.LocalName = GetSpaceDefaultName(space);
             //mspace.PlanePath = CommonTool.ConvertSpaceEdgesToStr(space.GetPlaneVertexes());
@@ -86,11 +86,11 @@ namespace SAGA.MBI.DataArrange
         /// </summary>
         /// <param name="id"></param>
         /// <returns></returns>
-        public static MSpace GetMSpace(string equipId)
+        public static MISpace GetMSpace(string equipId)
         {
-            MSpace mSpace = null;
+            MISpace mSpace = null;
             var spaceId = RelationConvert.GetSpaceByRelationElementInSpace(equipId);
-            mSpace = DalCommon.QueryObjectById(spaceId) as MSpace;
+            mSpace = DalCommon.QueryObjectById(spaceId) as MISpace;
             return mSpace;
         }
 

+ 5 - 4
MBI/SAGA.MBI/DataArrange/DalVisionOperate.cs

@@ -14,6 +14,7 @@ using SAGA.DotNetUtils.Encrypt;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Logger;
 using SAGA.DotNetUtils.Others;
+using SAGA.DotNetUtils.Serializer;
 using SAGA.MBI.Common;
 using SAGA.MBI.FileStream;
 using SAGA.MBI.JsonConvert;
@@ -42,7 +43,7 @@ namespace SAGA.MBI.DataArrange
             get
             {
                 if (m_LocalVisions == null)
-                    m_LocalVisions = FileOperateBase.DeserializeList<RevitFileVision>(LocalVisionFilePath, FileVisionName);
+                    m_LocalVisions = SerializerByXml.DeserializeList<RevitFileVision>(LocalVisionFilePath, FileVisionName);
                 return m_LocalVisions;
             }
         }
@@ -212,7 +213,7 @@ namespace SAGA.MBI.DataArrange
             string path = Path.Combine(LocalVisionFilePath, FileVisionName);
             //保存FileVision文件到工作区
             if (!File.Exists(path))
-                FileOperateBase.Serialize(LocalVisionFilePath, FileVisionName, LocalVisions);
+                SerializerByXml.SerializeAndSave(LocalVisionFilePath, FileVisionName, LocalVisions);
         }
         /// <summary>
         /// 保存版本配置文件到本地
@@ -223,7 +224,7 @@ namespace SAGA.MBI.DataArrange
             lvision.Vision = cvision.Vision;
             lvision.MD5Code = cvision.MD5Code;
             //保存FileVision文件到工作区
-            FileOperateBase.Serialize(LocalVisionFilePath, FileVisionName, LocalVisions);
+            SerializerByXml.SerializeAndSave(LocalVisionFilePath, FileVisionName, LocalVisions);
         }
         /// <summary>
         /// 删除本层的版本数据
@@ -233,7 +234,7 @@ namespace SAGA.MBI.DataArrange
         {
             LocalVisions.RemoveAll(t => t.FileName == floorid);
             //保存FileVision文件到工作区
-            FileOperateBase.Serialize(LocalVisionFilePath, FileVisionName, LocalVisions);
+            SerializerByXml.SerializeAndSave(LocalVisionFilePath, FileVisionName, LocalVisions);
             FloorVisionConvert.Delete(floorid);
         }
     }

+ 0 - 251
MBI/SAGA.MBI/FileStream/FileOperateBase.cs

@@ -1,251 +0,0 @@
-/* ==============================================================================
- * 功能描述:Class1  
- * 创 建 者:Garrett
- * 创建日期:2018/3/24 16:03:19
- * ==============================================================================*/
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.Serialization.Formatters.Binary;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using System.Xml.Serialization;
-using SAGA.DotNetUtils;
-using SAGA.MBI.Common;
-using SAGA.MBI.Model;
-using SAGA.MBI.RequestData;
-
-namespace SAGA.MBI.FileStream
-{
-    /// <summary>
-    /// Class1
-    /// </summary>
-    public class FileOperateBase
-    {
-        /// <summary>
-        /// 序列化并保存
-        /// 类必须标记为可序列化[Serializable]
-        /// </summary>
-        public static void Serialize(string filePath, string fileName, object floorSequences)
-        {
-            string path = Path.Combine(filePath, fileName);
-
-            if (!Directory.Exists(filePath))
-                Directory.CreateDirectory(filePath);
-
-            using (System.IO.FileStream fs = new System.IO.FileStream(path, FileMode.OpenOrCreate))
-            {
-                fs.SetLength(0);
-                using (StreamWriter sw = new StreamWriter(fs))
-                {
-                    try
-                    {
-                        fs.Position = 0;
-                        var jsonData = Serialize(floorSequences);
-                        //var jsonData = Newtonsoft_Common.SerializeObjToJson(new Serialization<T>(floorSequences));
-                        sw.Write(jsonData);
-                        //BinaryFormatter bf = new BinaryFormatter();
-                        //bf.Serialize(fs, floorSequences); //复制到流中
-                        //MessageBox.Show("保存成功!");
-                        //上传数据
-                    }
-                    catch (Exception ex)
-                    {
-                        MessageBox.Show("保存失败!!!" + ex.ToString());
-                    }
-                    finally
-                    {
-                        sw.Flush();
-                        sw.Close();
-                        fs.Close();
-                    }
-                }
-            }
-
-        }
-        /// <summary>
-        /// 序列化并保存-并上传
-        /// </summary>
-        public static void SerializeAndUpLoad<T>(string filePath, string fileName, List<T> floorSequences)
-        {
-            try
-            {
-                Serialize(filePath, fileName, floorSequences);
-                UpLoadFileRequest.UpLoadRevitFile(filePath, fileName);
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show("读取失败!!!" + ex.ToString());
-            }
-        }
-        /// <summary>
-        /// 反序列化
-        /// </summary>
-        /// <returns></returns>
-        public static T Deserialize<T>(string filePath, string fileName)
-        {
-            T floorSequences = default(T);
-            string path = Path.Combine(filePath, fileName);
-            if (!File.Exists(path))
-                return floorSequences;
-            try
-            {
-                var obj = Desrialize<T>(path);
-                floorSequences = obj;
-                //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(jsonData);
-            }
-            catch (Exception ex)
-            {
-                //MessageBox.Show("读取失败!!!"+ex.ToString());
-
-            }
-            finally
-            {
-            }
-            return floorSequences;
-        }
-        /// <summary>
-        /// 反序列化
-        /// </summary>
-        /// <returns></returns>
-        public static List<T> DeserializeList<T>(string filePath, string fileName)
-        {
-            List<T> floorSequences = new List<T>();
-            string path = Path.Combine(filePath, fileName);
-            if (!File.Exists(path))
-                return floorSequences;
-            using (StreamReader sr = new StreamReader(path, Encoding.Default))
-            {
-
-                try
-                {
-                    var obj = Desrialize<List<T>>(path);
-                    //var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<T>>(jsonData);
-
-                    var objs = (IEnumerable)obj;
-                    if (objs != null)
-                        floorSequences = objs.Cast<T>().ToList();
-                }
-                catch (Exception ex)
-                {
-                    //MessageBox.Show("读取失败!!!"+ex.ToString());
-
-                }
-                finally
-                {
-                    sr.Close();
-                }
-            }
-            return floorSequences;
-        }
-        /// <summary>
-        /// 下载并反序列化
-        /// </summary>
-        /// <returns></returns>
-        public static List<T> DeserializeAndDownLoad<T>(string filePath, string fileName)
-        {
-            List<T> floorSequences = new List<T>();
-            try
-            {
-                UpLoadFileRequest.DownLoadRevitFile(filePath, fileName);
-                return DeserializeList<T>(filePath, fileName);
-            }
-            catch (Exception ex)
-            {
-                MessageBox.Show("读取失败!!!" + ex.ToString());
-            }
-            return floorSequences;
-        }
-        /// <summary>
-        /// 序列化成xml字符串
-        /// </summary>
-        /// <param name="obj"></param>
-        /// <returns>序列化后的字符串</returns>
-        public static string Serialize(object obj)
-        {
-            string str = "";
-            XmlSerializer xs = new XmlSerializer(obj.GetType());
-            using (MemoryStream ms = new MemoryStream())
-            {
-                try
-                {
-                    System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8);
-                    xtw.Formatting = System.Xml.Formatting.Indented;
-                    xs.Serialize(xtw, obj);
-                    ms.Seek(0, SeekOrigin.Begin);
-                    using (StreamReader sr = new StreamReader(ms))
-                    {
-                        try
-                        {
-                            str = sr.ReadToEnd();
-                            xtw.Close();
-                            ms.Close();
-                        }
-                        catch (Exception e)
-                        {
-                            Console.WriteLine(e);
-                        }
-                        finally
-                        {
-                            xtw.Close();
-                            sr.Close();
-                        }
-
-                    }
-                }
-                catch (Exception e)
-                {
-                    Console.WriteLine(e);
-                }
-                finally
-                {
-                    ms.Close();
-                }
-
-            }
-            return str;
-        }
-        /// <summary>
-        /// 反序列化方法
-        /// </summary>
-        /// <typeparam name="T">反序列化对象类型</typeparam>
-        /// <param name="xml">反序列化字符串或者xml文件路径</param>
-        /// <returns></returns>
-        public static T Desrialize<T>(string xml)
-        {
-            T obj = default(T);
-            XmlSerializer xs = new XmlSerializer(typeof(T));
-            TextReader tr = null;
-            try
-            {
-
-                if (!File.Exists(xml))
-                {
-                    tr = new StringReader(xml);
-                }
-                else
-                {
-                    tr = new StreamReader(xml);
-                }
-                using (tr)
-                {
-                    obj = (T)xs.Deserialize(tr);
-                }
-            }
-            catch (Exception e)
-            {
-                Console.WriteLine(e);
-            }
-            finally
-            {
-                tr?.Close();
-            }
-            return obj;
-        }
-
-    }
-}

+ 3 - 2
MBI/SAGA.MBI/FileStream/ProjectDirOperate.cs

@@ -11,6 +11,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Serializer;
 using SAGA.MBI.Common;
 using SAGA.MBI.JsonConvert;
 using SAGA.MBI.Model;
@@ -167,7 +168,7 @@ namespace SAGA.MBI.FileStream
         {
             string filePath = MBIConst.MBITempSettingPath;
             string fileName = MBIConst.ManageCur;
-            FileOperateBase.Serialize(filePath, fileName, MBIControl.ManageInfo);
+            SerializerByXml.SerializeAndSave(filePath, fileName, MBIControl.ManageInfo);
         }
         /// <summary>
         /// 从本地读取当前管理员信息
@@ -177,7 +178,7 @@ namespace SAGA.MBI.FileStream
         {
             string filePath = MBIConst.MBITempSettingPath;
             string fileName = MBIConst.ManageCur;
-            ManageInfo project = FileOperateBase.Deserialize<ManageInfo>(filePath, fileName);
+            ManageInfo project = SerializerByXml.Deserialize<ManageInfo>(filePath, fileName);
             return project;
         }
 

+ 56 - 73
MBI/SAGA.MBI/Html5Command.cs

@@ -4,42 +4,52 @@
  * 创建日期:2018/3/27 11:42:20
  * ==============================================================================*/
 
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using System.Windows;
 using Autodesk.Revit.Attributes;
 using Autodesk.Revit.DB;
-using Autodesk.Revit.DB.ExtensibleStorage;
-using Autodesk.Revit.DB.Mechanical;
 using Autodesk.Revit.UI;
 using CEFSharpWpf;
-using SAGA.DotNetUtils;
-using SAGA.DotNetUtils.Extend;
-using SAGA.DotNetUtils.Logger;
 using SAGA.MBI.Common;
-using SAGA.MBI.DataArrange;
-using SAGA.MBI.Login;
-using SAGA.MBI.Model;
-using SAGA.MBI.Tools;
-using SAGA.MBI.WinView;
-using SAGA.MBI.WinView.BeModingDutyList;
-using SAGA.MBI.WinView.Login;
-using SAGA.MBI.WinView.ModeInfoMaintenance;
-using SAGA.MBI.WinView.PositionBeaconModeling;
-using SAGA.MBI.WinView.Space;
-using SAGA.MBI.WinView.Upload;
 using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
-using SAGA.RevitUtils.Windows;
-using Application = Autodesk.Revit.Creation.Application;
-using Visibility = System.Windows.Visibility;
+using System;
 
 namespace SAGA.MBI
 {
+    #region 资产及扫楼数据整理
+    /// <summary>
+    /// 资产清单
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    [Journaling(JournalingMode.UsingCommandData)]
+    public class AssetListCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+                //http://192.168.20.86:8091/#/assetsList?projId=Pj1101080001&secret=123&userId=*****
+                string url = $"{MBIConst.Html5ScanLocalHost}assetsList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}&userId={MBIControl.ManageInfo.Person_Id}";
+                var win = WinBrowser.Instance;
+                win.Show(url, "资产清单");
+                win.Height = 854;
+                win.Width = 1530;
+                win.Left = 320;
+                win.Top = 190;
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
 
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
     /// <summary>
     /// 扫楼日志页
     /// </summary>
@@ -55,7 +65,7 @@ namespace SAGA.MBI
                 //win.ShowDialog();
 
                 string url = $"{MBIConst.Html5ScanLocalHost}buildLog?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
-                
+
                 var win = WinBrowser.Instance;
                 win.Show(url, "扫楼日志");
                 win.Height = 854;
@@ -245,6 +255,9 @@ namespace SAGA.MBI
             return true;
         }
     }
+    #endregion
+
+
 
     /// <summary>
     /// 楼层平面图管理
@@ -285,14 +298,15 @@ namespace SAGA.MBI
             return true;
         }
     }
-
+    #region 设备空间台账
+    
     /// <summary>
     /// 业务空间清单
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
     [Journaling(JournalingMode.UsingCommandData)]
-    public class SpaceListCommand : ExternalCommand, IExternalCommandAvailability
+    public class SpaceListCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
@@ -320,28 +334,27 @@ namespace SAGA.MBI
         /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
         /// when a document is open.
         /// </summary>
-        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
         {
             return true;
         }
     }
-
     /// <summary>
-    /// 资产管理
+    /// 设备清单
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
     [Journaling(JournalingMode.UsingCommandData)]
-    public class AssetManagerCommand : ExternalCommand
+    public class EquipmentListCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             try
             {
-                //http://192.168.20.86:8091/#/assetsList?projId=Pj1101080001&secret=123
-                string url = $"{MBIConst.Html5ScanLocalHost}assetsList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}";
+                //http://192.168.20.86:8091/#/deviceList?projId=Pj1101080001&secret=123&userId=*****
+                string url = $"{MBIConst.Html5ScanLocalHost}deviceList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}&userId={MBIControl.ManageInfo.Person_Id}";
                 var win = WinBrowser.Instance;
-                win.Show(url, "资产管理");
+                win.Show(url, "设备清单");
                 win.Height = 854;
                 win.Width = 1530;
                 win.Left = 320;
@@ -362,21 +375,21 @@ namespace SAGA.MBI
     }
 
     /// <summary>
-    /// 设备管理
+    /// 系统清单
     /// </summary>
     [Transaction(TransactionMode.Manual)]
     [Regeneration(RegenerationOption.Manual)]
     [Journaling(JournalingMode.UsingCommandData)]
-    public class EquipmentManagerCommand : ExternalCommand
+    public class SystemListCommand : ExternalCommand
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             try
             {
-                //http://192.168.20.86:8091/#/deviceList?projId=Pj1101080001&secret=123
-                string url = $"{MBIConst.Html5ScanLocalHost}deviceList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}";
+                //http://192.168.20.86:8091/#/systemList?projId=Pj1101080001&secret=123&userId=*****
+                string url = $"{MBIConst.Html5ScanLocalHost}systemList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}&userId={MBIControl.ManageInfo.Person_Id}";
                 var win = WinBrowser.Instance;
-                win.Show(url, "资产管理");
+                win.Show(url, "系统清单");
                 win.Height = 854;
                 win.Width = 1530;
                 win.Left = 320;
@@ -395,39 +408,9 @@ namespace SAGA.MBI
             return true;
         }
     }
+    #endregion
 
-    /// <summary>
-    /// 系统管理
-    /// </summary>
-    [Transaction(TransactionMode.Manual)]
-    [Regeneration(RegenerationOption.Manual)]
-    [Journaling(JournalingMode.UsingCommandData)]
-    public class SystemManagerCommand : ExternalCommand
-    {
-        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
-        {
-            try
-            {
-                //http://192.168.20.86:8091/#/systemList?projId=Pj1101080001&secret=123
-                string url = $"{MBIConst.Html5ScanLocalHost}systemList?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}";
-                var win = WinBrowser.Instance;
-                win.Show(url, "资产管理");
-                win.Height = 854;
-                win.Width = 1530;
-                win.Left = 320;
-                win.Top = 190;
-            }
-            catch (Exception e)
-            {
-                MessageShow.Show(e);
-                return Result.Cancelled;
-            }
-            return Result.Succeeded;
-        }
+   
 
-        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
-    }
+  
 }

+ 46 - 3
MBI/SAGA.MBI/JsonConvert/CommonConvert.cs

@@ -66,13 +66,52 @@ namespace SAGA.MBI.RequestData
             return list;
         }
         /// <summary>
-        /// 查询楼层下的设备/部件/信标
+        /// 查询楼层下的设备/部件/信标,
+        /// "Eq", "Ec", "VOBc"
         /// </summary>
         /// <returns></returns>
-        public static List<MRevitEquipBase> FloorQuery(string floorId, string[] type)
+        public static List<MRevitEquipBase> FloorQuery_GoodHand(string floorId, string[] type)
         {
             List<MRevitEquipBase> list = new List<MRevitEquipBase>();
-            var json = CommonRequest.FloorQuery(floorId, type);
+            var json = CommonRequest.FloorQuery_GoodHand(floorId, type);
+            if (!json.IsRequestHasItem()) return list;
+            JObject jObject = JObject.Parse(json);
+            foreach (JObject jobjItem in jObject["Content"])
+            {
+                var mode = JsonToEquipBase(floorId, jobjItem);
+                if (mode != null)
+                    list.Add(mode);
+            }
+            return list;
+        }
+        /// <summary>
+        /// 查询楼层下的空间,业务空间,
+        /// "Eq", "Ec", "VOBc"
+        /// </summary>
+        /// <returns></returns>
+        public static List<MRevitEquipBase> FloorQuery_SubSet(string floorId, string[] type)
+        {
+            List<MRevitEquipBase> list = new List<MRevitEquipBase>();
+            var json = CommonRequest.QueryObjectByInfos(floorId,new JObject(), type);
+            if (!json.IsRequestHasItem()) return list;
+            JObject jObject = JObject.Parse(json);
+            foreach (JObject jobjItem in jObject["Content"])
+            {
+                var mode = JsonToEquipBase(floorId, jobjItem);
+                if (mode != null)
+                    list.Add(mode);
+            }
+            return list;
+        }
+        /// <summary>
+        /// 查询楼层下的空间,业务空间,
+        /// "Eq", "Ec", "VOBc"
+        /// </summary>
+        /// <returns></returns>
+        public static List<MRevitEquipBase> FloorQuery_SubSet(string floorId,JObject infoObject, string[] type)
+        {
+            List<MRevitEquipBase> list = new List<MRevitEquipBase>();
+            var json = CommonRequest.QueryObjectByInfos(floorId, infoObject, type);
             if (!json.IsRequestHasItem()) return list;
             JObject jObject = JObject.Parse(json);
             foreach (JObject jobjItem in jObject["Content"])
@@ -127,6 +166,10 @@ namespace SAGA.MBI.RequestData
                 {
                     mode = new MISpace(floorId, bimId);
                 }
+                else if (id.StartsWith("Sp"))
+                {
+                    mode = new MBSpace(floorId, bimId);
+                }
                 else if (id.StartsWith("VOBc"))
                 {
                     mode = new MBeacon(floorId, bimId);

+ 7 - 105
MBI/SAGA.MBI/JsonConvert/PEPCodeConvert.cs

@@ -12,6 +12,7 @@ using Newtonsoft.Json.Linq;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Http;
 using SAGA.MBI.Common;
+using SAGA.MBI.DataArrange;
 using SAGA.MBI.Model;
 using SAGA.MBI.RequestData;
 using SAGA.MBI.Tools;
@@ -36,7 +37,7 @@ namespace SAGA.MBI.JsonConvert
             if (tb == null)
             {
                 //暂时只处理独有的信息点
-                tb = code==MBIConst.SpaceCode? DataPlatFormSpaceInfos(code) : DataPlatFormSysOrEqInfos(code);
+                tb =  DataPlatFormSysOrEqInfos(code);
                 tbs.Add(tb);
             }
             return tb;
@@ -50,73 +51,8 @@ namespace SAGA.MBI.JsonConvert
             PropertyDefineTb tb = new PropertyDefineTb(code);
             try
             {
-                //控制是否显示
-                var json = PEPCodeRequest.SaasSysOrEqInfos(code);
-                if (json.IsSuccessRequest())
-                {
-                    JObject jObject = JObject.Parse(json);
-                    foreach (JObject subj in jObject["Content"])
-                    {
-                        PropertyDefineItem item = new PropertyDefineItem();
-                        item.Category = (string)subj["firstTag"];
-                        item.SubCategory = (string)subj["secondTag"];
-                        item.Name = (string)subj["info_point_code"];
-                        item.CodeName = (string)subj["infopoint_code"];
-                        item.Unit = (string)subj["unit"];
-                        item.Type = (string)subj["dataType"];
-                        item.InputType = (string)subj["base_cmpt_code"]; 
-                        item.EnumSource = subj.GetValueEx("dataSource");
-                        item.Remark = (string)subj["note"];
-                        item.Classification = (string)subj["classification"];
-                        item.IsShow = (string)subj["is_mapped"]=="1";
-                        item.CollectionCmptCode = (string)subj["collection_cmpt_code"];
-                        tb.PropertyDefineItems.Add(item);
-                    }
-                }
-                ////获取自定义信息点
-                string json2 = PEPCodeRequest.UserDefineSysOrEqInfos(code);
-
-                if (json2.IsSuccessRequest())
-                {
-                    JObject jObject = JObject.Parse(json2);
-                    foreach (JObject subj in jObject["Content"])
-                    {
-                        PropertyDefineItem item = new PropertyDefineItem();
-                        item.Category = (string)subj["firstTag"];
-                        item.SubCategory = (string)subj["secondTag"];
-                        item.Name = (string)subj["infoPointName"];
-                        item.CodeName = (string)subj["infoPointCode"];
-                        item.Unit = (string)subj["unit"];
-                        item.Type = (string)subj["dataType"];
-                        item.InputType = (string)subj["inputMode"];
-                        item.EnumSource = subj.GetValueEx("dataSource");
-                        item.Remark = (string)subj["note"];
-                        item.IsShow = true;
-                        tb.PropertyDefineItems.Add(item);
-                    }
-                }
-            }
-            catch (Exception e)
-            {
-                MessageShow.Show(e);
-            }
-
-            return tb;
-        }
-
-        /// <summary>
-        /// 数据平台系统和设备的完整信息点
-        /// </summary>
-        /// <returns></returns>
-        public static PropertyDefineTb DataPlatFormSpaceInfos(string code)
-        {
-            PropertyDefineTb tb = new PropertyDefineTb(code);
-            try
-            {
-                var componentRels = SaasQueryAllComponentRel();
-                //获取所有的属性
-                string json = PEPCodeRequest.InfocodeComplex_query(code,true);
-
+                //控制是否显示,包含自定义信息点
+                var json = PEPCodeRequest.InfoCodeQuery(code);
                 if (json.IsSuccessRequest())
                 {
                     JObject jObject = JObject.Parse(json);
@@ -129,13 +65,12 @@ namespace SAGA.MBI.JsonConvert
                         item.CodeName = (string)subj["infoPointCode"];
                         item.Unit = (string)subj["unit"];
                         item.Type = (string)subj["dataType"];
-                        item.InputType = (string)subj["inputMode"];
+                        item.InputType = (string)subj["inputMode"]; 
                         item.EnumSource = subj.GetValueEx("dataSource");
                         item.Remark = (string)subj["note"];
                         item.Classification = (string)subj["classification"];
-                        var relItem = componentRels.FirstOrDefault(t => t.BaseCmptCode == item.InputType);
-                        item.CollectionCmptCode = relItem?.GodHandCmptCode;
-                        item.IsShow = relItem!=null;
+                        item.IsShow = (string)subj["visible"] =="true";
+                        item.CollectionCmptCode = DalInfoCode.GetInputType(item.InputType);
                         tb.PropertyDefineItems.Add(item);
                     }
                 }
@@ -147,38 +82,5 @@ namespace SAGA.MBI.JsonConvert
 
             return tb;
         }
-
-        /// <summary>
-        /// Saas平台,查询所有组件关系信息
-        /// </summary>
-        /// <returns></returns>
-        public static List<RltComponentRel> SaasQueryAllComponentRel()
-        {
-            List<RltComponentRel> list=new List<RltComponentRel>();
-            try
-            {
-                string json = PEPCodeRequest.SaasQueryAllComponentRel();
-                if (json.IsSuccessRequest())
-                {
-                    JObject jObject = JObject.Parse(json);
-                    foreach (JObject subj in jObject["Content"])
-                    {
-                        RltComponentRel item = new RltComponentRel();
-                        item.CmptRelationId = subj.GetValueEx("cmpt_relation_id");
-                        item.BaseCmptCode = subj.GetValueEx("base_cmpt_code");
-                        item.GodHandCmptCode = subj.GetValueEx("god_hand_cmpt_code");
-
-                        list.Add(item);
-                    }
-                }
-            }
-            catch (Exception e)
-            {
-                Console.WriteLine(e);
-                throw;
-            }
-         
-            return list;
-        }
     }
 }

+ 99 - 0
MBI/SAGA.MBI/Model/MBSpace.cs

@@ -0,0 +1,99 @@
+/* ==============================================================================
+ * 功能描述:业务空间
+ * 创 建 者:Garrett
+ * 创建日期:2018/3/30 10:17:05
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Logger;
+using SAGA.DotNetUtils.WPF;
+using SAGA.MBI.Common;
+using SAGA.MBI.JsonConvert;
+using SAGA.MBI.RequestData;
+using SAGA.MBI.WinView.ModeInfoMaintenance;
+using WPG.Data;
+using WPG.UserControls;
+
+namespace SAGA.MBI.Model
+{
+    /// <summary>
+    /// MSpace
+    /// </summary>
+    public class MBSpace : MRevitEquipBase
+    {
+        public MBSpace(string floorId, string bimMId)
+        {
+            FloorId = floorId;
+            BimID = bimMId;
+        }
+
+        #region AttachProperty
+        
+
+        #endregion
+
+        #region CloudProperty
+
+        private string m_Name;
+        [Description("RoomName")]
+        public string Name
+        {
+            get { return m_Name; }
+            set
+            {
+                m_Name = value;
+                NotifyPropertyChanged("Name");
+            }
+        }
+        private string m_LocalId;
+        [Description("RoomLocalID")]
+        public string LocalId
+        {
+            get { return m_LocalId; }
+            set
+            {
+                m_LocalId = value;
+                NotifyPropertyChanged("LocalId");
+            }
+        }
+
+        private string m_LocalName;
+        [Description("RoomLocalName")]
+        public string LocalName
+        {
+            get { return m_LocalName; }
+            set
+            {
+                m_LocalName = value;
+                NotifyPropertyChanged("LocalName");
+            }
+        }
+        #endregion CloudProperty
+
+
+
+        #region Method
+
+        public override string ToString()
+        {
+            string result = this.LocalName;
+            if (result.IsNotNullEmpty())
+                return result;
+            result = this.Name;
+            if (result.IsNotNullEmpty())
+                return result;
+            return "未知";
+        }
+        
+
+        #endregion
+
+
+    }
+}

+ 3 - 3
MBI/SAGA.MBI/Model/MISpace.cs

@@ -1,5 +1,5 @@
 /* ==============================================================================
- * 功能描述:MSpace  
+ * 功能描述:元空间
  * 创 建 者:Garrett
  * 创建日期:2018/3/30 10:17:05
  * ==============================================================================*/
@@ -25,9 +25,9 @@ namespace SAGA.MBI.Model
     /// <summary>
     /// MSpace
     /// </summary>
-    public class MSpace : MRevitEquipBase
+    public class MISpace : MRevitEquipBase
     {
-        public MSpace(string floorId, string bimMId)
+        public MISpace(string floorId, string bimMId)
         {
             FloorId = floorId;
             BimID = bimMId;

+ 15 - 0
MBI/SAGA.MBI/Model/PropertyDefineTb.cs

@@ -206,4 +206,19 @@ namespace SAGA.MBI.Model
         #endregion
 
     }
+    /// <summary>
+    /// 组件编码对应Revit的输入方式
+    /// </summary>
+    public class ComponentCodeToInputType
+    {
+        /// <summary>
+        /// 组件编码
+        /// </summary>
+        public string ComponentCode { get; set; }
+        /// <summary>
+        /// Revit组件类型
+        /// </summary>
+        public string InputType { get; set; }
+    }
+
 }

+ 19 - 11
MBI/SAGA.MBI/RequestData/CommonRequest.cs

@@ -58,20 +58,28 @@ namespace SAGA.MBI.RequestData
         /// <returns></returns>
         public static string QueryObjectByInfos(string floorId, JObject infoJObject, string[] type = null)
         {
-            if (infoJObject.Count == 0) return "";
             string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/fast/object/in_query?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
 
-            string buildingId = DalProjectTree.GetBuildingIdByFloor(floorId);
 
             if (type == null)
             {
-                type = new string[] { "Eq", "Ec", "Si", "Sp", "VOBc" };
+                type = new string[] { "Eq", "Ec", "Si", "VOBc" };
             }
             infoJObject.Add("type", new JArray(type));
-
-            //信标加BuildingId查不出来
-            if (buildingId.IsNotNullEmpty() && type.FirstOrDefault(t => Regex.IsMatch(t, "VO.*")) == null)
+            if (type.FirstOrDefault(t => Regex.IsMatch(t, "VO.*")) == null)
+            {
+                //信标加BuildingId查不出来
+            }
+            else if (type.FirstOrDefault(t => new[] { "Eq", "Ec" }.Contains(t)) == null)
+            {
+                //设备需要加buildingId
+                string buildingId = DalProjectTree.GetBuildingIdByFloor(floorId);
                 infoJObject.Add("id", buildingId);
+            }
+            else
+            {
+                infoJObject.Add("id", floorId);
+            }
             JObject updateJObject = new JObject();
             updateJObject.Add("criteria", infoJObject);
             updateJObject.Add("customInfo", true);
@@ -190,7 +198,7 @@ namespace SAGA.MBI.RequestData
         /// 查询楼层下的设备/部件/信标
         /// </summary>
         /// <returns></returns>
-        public static string FloorQuery(string floorId, string[] type)
+        public static string FloorQuery_GoodHand(string floorId, string[] type)
         {
             if (floorId.IsNullOrEmpty() || type.IsNullOrEmptyExt()) return String.Empty;
 
@@ -211,7 +219,7 @@ namespace SAGA.MBI.RequestData
         /// <returns></returns>
         public static string CacheEqEc(string buildingId)
         {
-            return SubsetQuery(buildingId, new JArray() {"Eq", "Ec"});
+            return SubsetQuery(buildingId, new JArray() { "Eq", "Ec" });
         }
         /// <summary>
         /// 缓存所有的Revit数据
@@ -220,7 +228,7 @@ namespace SAGA.MBI.RequestData
         /// <returns></returns>
         public static string CacheAllData(string buildingId)
         {
-            return SubsetQuery(buildingId, new JArray() { "Eq", "Ec","Si" });
+            return SubsetQuery(buildingId, new JArray() { "Eq", "Ec", "Si" });
         }
         /// <summary>
         /// 查询某个object下指定类型的objects (查询项目下的所有类型, 建筑下的设备, 系统, 楼层, 空间. 查询楼层中的空间, 非关系表查询)
@@ -318,7 +326,7 @@ namespace SAGA.MBI.RequestData
         public static string BatchUpdate(JArray criterias)
         {
             string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/object/batch_update?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
-            
+
             JObject updateJObject = new JObject();
             updateJObject.Add("criterias", criterias);
 
@@ -328,6 +336,6 @@ namespace SAGA.MBI.RequestData
             return request;
         }
 
-      
+
     }
 }

+ 5 - 40
MBI/SAGA.MBI/RequestData/PEPCodeRequest.cs

@@ -50,50 +50,15 @@ namespace SAGA.MBI.RequestData
         /// <param name="buildingId"></param>
         /// <param name="infos"></param>
         /// <returns></returns>
-        public static string SaasSysOrEqInfos(string code, string type = "equip")
+        public static string InfoCodeQuery(string code)
         {
-            string url = MBIConst.SaasLocalHost + $"saas-manage3/app/restTemplateService/queryObjectPropertyMapping2";
+            string url = MBIConst.ScanBuildingLocalHost + $"service/dict/infocode_query";
 
             string app_type = "godhand";
             JObject idJObject = new JObject();
-            idJObject.Add("user_id", MBIControl.ManageInfo.Person_Id);
-            idJObject.Add("code", code);
-            idJObject.Add("type", type);
-            idJObject.Add("app_type", app_type);
-            //获取所有的信息点
-            idJObject.Add("is_all", "1");
-
-            string postData = idJObject.ToString();
-            RestClient client = new RestClient(url, HttpVerb.POST, postData);
-            string request = client.PostRequest();
-            return request;
-        }
-
-        /// <summary>
-        /// 查询带有自定义信息点的综合查询方法
-        /// </summary>
-        /// <returns></returns>
-        public static string InfocodeComplex_query(string code,bool combine=false)
-        {
-            string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/infocode/query_property?projectId={MBIControl.ProjectCur.Id}&type={code}&combine={combine}&enrich=true";
-
-            RestClient client = new RestClient(url, HttpVerb.GET);
-            string request = client.PostRequest();
-            return request;
-        }
-
-        /// <summary>
-        /// Saas平台,查询所有组件关系信息
-        /// </summary>
-        /// <param name="buildingId"></param>
-        /// <param name="infos"></param>
-        /// <returns></returns>
-        public static string SaasQueryAllComponentRel()
-        {
-            string url = MBIConst.SaasLocalHost + $"saas-manage3/restComponentService/queryAllComponentRel";
-            
-            JObject idJObject = new JObject();
-            idJObject.Add("user_id", MBIControl.ManageInfo.Person_Id);
+            idJObject.Add("ProjId", MBIControl.ProjectCur.Id);
+            idJObject.Add("Code", code);
+            idJObject.Add("AppType", "revit");
 
             string postData = idJObject.ToString();
             RestClient client = new RestClient(url, HttpVerb.POST, postData);

+ 2 - 1
MBI/SAGA.MBI/SAGA.MBI.csproj

@@ -243,6 +243,7 @@
     <Compile Include="CmbData\ProvinceCityVm.cs" />
     <Compile Include="Common\CacheAspect.cs" />
     <Compile Include="Common\WaitingView.cs" />
+    <Compile Include="DataArrange\DalInfoCode.cs" />
     <Compile Include="Html5Command.cs" />
     <Compile Include="Command.cs" />
     <Compile Include="Common\MBIAssistHelper.cs" />
@@ -274,6 +275,7 @@
       <DependentUpon>WinPointInfoMerge.xaml</DependentUpon>
     </Compile>
     <Compile Include="Model\GraphRelationType.cs" />
+    <Compile Include="Model\MBSpace.cs" />
     <Compile Include="Model\MQRCode.cs" />
     <Compile Include="RequestData\QRCodeRequest.cs" />
     <Compile Include="RevitModelHandle\RevitParameterUpdate.cs" />
@@ -354,7 +356,6 @@
     <Compile Include="WinView\BeModingDutyList\VMBeModeDutyList.cs" />
     <Compile Include="Extend\MRevitEquipBaseExtend.cs" />
     <Compile Include="Extension\MEquipmentExtension.cs" />
-    <Compile Include="FileStream\FileOperateBase.cs" />
     <Compile Include="FileStream\FloorFileOperate.cs" />
     <Compile Include="FileStream\FloorSequence.cs" />
     <Compile Include="FileStream\ProjectDirOperate.cs" />

+ 16 - 31
MBI/SAGA.MBI/ToolsData/DataCheck/SpaceEquipFloorCheck.cs

@@ -72,11 +72,11 @@ namespace SAGA.MBI.ToolsData.DataCheck
             try
             {
                 //本层下的设备和部件 
-                var equips = DalCommon.DownLoadCouldData(mFloor.Id, new[] {"Eq", "Ec"});
+                var equips = DalCommon.DownLoadCouldData(mFloor.Id, new[] { "Eq", "Ec" });
                 //本层下的业务空间
                 foreach (GraphRelationType businessSpaceType in m_BusinessSpaceTypes)
                 {
-                    
+                    var spaces = DalCommon.DownLoadCouldData(mFloor.Id, new[] { businessSpaceType.Code });
                 }
             }
             catch (Exception e)
@@ -87,40 +87,25 @@ namespace SAGA.MBI.ToolsData.DataCheck
 
 
         //忽略的信息点
-        private List<string> m_IgnoreList=new List<string>(){ "EquipID" ,"EquipName"};
-        private DutyFMInfoCheckResult GetCheckResult(MRevitEquipBase duty, MEquipFM fm)
+        private List<string> m_IgnoreList = new List<string>() { "EquipID", "EquipName" };
+        private DutyFMInfoCheckResult GetCheckResult(List<MRevitEquipBase> equips, GraphRelationType businessSpaceType, MFloor mFloor)
         {
             DutyFMInfoCheckResult result = null;
             try
             {
-                var dutyJObject = duty.CloundJObject;
-                var fmJson = fm.FMJson;
-                var fmJObject = JObject.Parse(fmJson);
-
-                PropertyDefineTb pdtb = PEPCodeConvert.GetPropertyDefineTb(duty.EquipClassCode);
-                StringBuilder sb = new StringBuilder();
-                foreach (KeyValuePair<string, JToken> pair in dutyJObject)
+                var spaces = DalCommon.DownLoadCouldData(mFloor.Id, new[] { businessSpaceType.Code });
+                JObject jobject = new JObject();
+                foreach (MRevitEquipBase space in spaces)
                 {
-                    string key = pair.Key;
-                    //不检查的信息点
-                    if(m_IgnoreList.Contains(key))continue;
-                    string dutyValue = pair.Value.ToString();
-                    string fmValue = fmJObject.GetValueEx(key);
-                    if (dutyValue.IsNotNullEmptyExt() && fmValue.IsNotNullEmptyExt() && !dutyValue.Equals(fmValue))
-                    {
-                        var define = pdtb.PropertyDefineItems.FirstOrDefault(t => t.CodeName == key);
-                        sb.Append($"{define?.Name??key}、");
-                    }
+                    JObject graphJObject = new JObject();
+                    graphJObject.Add("graphType", businessSpaceType.Code);
+                    graphJObject.Add("relType", businessSpaceType.Rel_Type);
+                    graphJObject.Add("side", "fromId");
+                    graphJObject.Add("toId", space.Id);
+                    jobject.Add(graphJObject);
                 }
-                result = new DutyFMInfoCheckResult();
-                result.FloorName = DalProjectTree.GetFloorNameByFloorId(duty.FloorId);
-                result.DutyId = duty.Id;
-                result.DutyName = duty.ToString();
-                result.BIMID = duty.BimID.GetBIMID().ToString();
-                result.FMId = fm.Id;
-                result.FMName = fm.ToString();
-                result.IsRight = sb.Length == 0;
-                result.RMessage = result.IsRight ? "" : $"值不一致的信息点有:{sb}";
+                CommonConvert.FloorQuery_SubSet(mFloor.Id, jobject, new[] { businessSpaceType.Code });
+
             }
             catch (Exception e)
             {
@@ -128,7 +113,7 @@ namespace SAGA.MBI.ToolsData.DataCheck
             }
             return result;
         }
-        
+
 
 
         #endregion

+ 2 - 1
MBI/SAGA.MBI/ToolsData/UpdateFileVision.cs

@@ -9,6 +9,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Serializer;
 using SAGA.MBI.Common;
 using SAGA.MBI.DataArrange;
 using SAGA.MBI.FileStream;
@@ -26,7 +27,7 @@ namespace SAGA.MBI.ToolsData
         /// </summary>
         public static void Operate()
         {
-            var sequences = FileOperateBase.DeserializeList<RevitFileVision>(MBIControl.ProjectBasePath, "FileVision.json");
+            var sequences = SerializerByXml.DeserializeList<RevitFileVision>(MBIControl.ProjectBasePath, "FileVision.json");
             foreach (RevitFileVision fileVision in sequences)
             {
                 fileVision.FileName = CloudRevitNameToFloorId(fileVision.FileName);

+ 4 - 4
MBI/SAGA.MBI/WinView/BeModingDutyList/WinFMMergeTip4.xaml

@@ -17,16 +17,16 @@
             请确认需要保留与哪个资产的关联关系?
         </TextBlock>
         <StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
-            <WrapPanel >
-                <RadioButton x:Name="rdo1" IsChecked="True"></RadioButton>
+            <WrapPanel Margin="5">
+                <RadioButton x:Name="rdo1" IsChecked="True" GroupName="hh"></RadioButton>
                 <TextBlock  HorizontalAlignment="Center" VerticalAlignment="Center">
                     <Hyperlink Click="Hyperlink_OnClick">
                         <TextBlock Text="点击查看资产详情"></TextBlock>
                     </Hyperlink>
                 </TextBlock>
             </WrapPanel>
-            <WrapPanel >
-                <RadioButton x:Name="rdo2"></RadioButton>
+            <WrapPanel Margin="5">
+                <RadioButton x:Name="rdo2" GroupName="hh"></RadioButton>
                 <TextBlock  HorizontalAlignment="Center" VerticalAlignment="Center">
                     <Hyperlink Click="Hyperlink2_OnClick">
                         <TextBlock Text="点击查看资产详情"></TextBlock>

+ 2 - 2
MBI/SAGA.MBI/WinView/Login/UcMFMFloorUp.xaml

@@ -28,9 +28,9 @@
                 <RowDefinition Height="*"/>
                 <RowDefinition Height="50"/>
             </Grid.RowDefinitions>
-            <TextBlock FontSize="25" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center" 
+            <TextBox FontSize="25" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Center"  BorderThickness="0"
                        Text="{Binding Path=PathDisplay,UpdateSourceTrigger=PropertyChanged}" TextWrapping="WrapWithOverflow">
-            </TextBlock>
+            </TextBox>
             <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Row="1" Height="30" Margin="0,0,30,0"
                        Visibility="{Binding Path=FloorLock.LockState,Converter={StaticResource LockStateToVisibleConverter},ConverterParameter={x:Static model:MFloorLockState.LockBySelf} }">
                 <Button Click="ButtonBase_OnClick">