فهرست منبع

Merge branch 'master' of https://git.dev.tencent.com/xuhuo1234/saga

mengxiangge 6 سال پیش
والد
کامیت
3370ec4497
25فایلهای تغییر یافته به همراه397 افزوده شده و 108 حذف شده
  1. 2 2
      MBI/SAGA.GplotDrawData/DBView/VirticalSpaceGraphView.cs
  2. 24 8
      MBI/SAGA.GplotDrawData/View/WinMachineRoom.xaml.cs
  3. 82 40
      MBI/SAGA.GplotDrawData/View/WinSystem.xaml.cs
  4. 2 2
      MBI/SAGA.GplotDrawData/WinDrawSpace-Web.xaml.cs
  5. 47 12
      MBI/SAGA.GplotManage/RelationManager/SystemRelationUploader.cs
  6. 59 0
      MBI/SAGA.GplotRelationComputerManage/Data/CalcProjectContext.cs
  7. 1 0
      MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj
  8. 55 6
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs
  9. 1 1
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/VerticalResult.cs
  10. 12 4
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/FloorSystemItem.cs
  11. 6 6
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/RelationComputerData.cs
  12. 3 1
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/FloorRecord.cs
  13. 2 5
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomDrawRecord.cs
  14. 1 1
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomRelationRecord.cs
  15. 2 2
      MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerHandler.cs
  16. 2 2
      MBI/SAGA.Models/AcWater.cs
  17. 30 0
      MBI/SAGA.Models/MBIItem/Builder/BuildingItemBuilder.cs
  18. 7 1
      MBI/SAGA.Models/MBIItem/Builder/MBIItemBuilder.cs
  19. 1 0
      MBI/SAGA.Models/MBIItem/Builder/MBIItemFactory.cs
  20. 26 0
      MBI/SAGA.Models/MBIItem/Entity/BuildingItem.cs
  21. 1 4
      MBI/SAGA.Models/MBIItem/Entity/FloorItem.cs
  22. 4 0
      MBI/SAGA.Models/MBIItem/MBIBuiltInCategory.cs
  23. 19 0
      MBI/SAGA.Models/MBIItem/MBIBuiltInParameter.cs
  24. 2 0
      MBI/SAGA.Models/SAGA.Models.csproj
  25. 6 11
      MBI/SAGA.Models/VerticalPipe.cs

+ 2 - 2
MBI/SAGA.GplotDrawData/DBView/VirticalSpaceGraphView.cs

@@ -9,13 +9,13 @@ using System.Windows.Media;
 
 namespace SAGA.GplotDrawData
 {
-    public class VirticalSpaceGraphView : GraphDBView<BuildingItem>
+    public class VirticalSpaceGraphView : GraphDBView<BuildingItemData>
     {
         /// <summary>
         /// 空间类型
         /// </summary>
         public string SpaceType { get; set; }
-        public override GraphDB AppendDb(BuildingItem build, GraphDB db)
+        public override GraphDB AppendDb(BuildingItemData build, GraphDB db)
         {
             if (SpaceType == null)
                 return db;

+ 24 - 8
MBI/SAGA.GplotDrawData/View/WinMachineRoom.xaml.cs

@@ -33,6 +33,10 @@ namespace SAGA.GplotDrawData.View
         {
             if (TreeRootNode.SelectedItem is DataNode ln)
             {
+                if (ln.Childrens.Count != 0)
+                {
+                    return;
+                }
                 Draw(ln.GetData<MachineRoomDrawRecord>());
             }
         }
@@ -59,29 +63,41 @@ namespace SAGA.GplotDrawData.View
         /// </summary>
         private void InitTreeNode()
         {
+            //分级:建筑--系统--楼层;
             try
             {
+                List<DataNode> buildNodes = new List<DataNode>();
                 List<List<MachineRoomDrawRecord>> drawDatas = GetMachineRoomDrawData();
-                List<DataNode> treeDataSource = new List<DataNode>();
+               
                 foreach (var drawData in drawDatas)
                 {
                     foreach (var drawRecord in drawData)
                     {
                         if (!drawRecord.NodePaths.Any())
                             continue;
-                        var relationNode = treeDataSource.FirstOrDefault(d => d.EName == drawRecord.RelationName);
-                        if (relationNode == null)
+                        var buildNode = buildNodes.FirstOrDefault(b => b.Sno == drawRecord.BuildingId);
+                        DataNode useSystemNode = null;
+                        if (buildNode == null)
                         {
-                            relationNode = new DataNode(drawRecord.RelationName);
-                            treeDataSource.Add(relationNode);
+                            buildNode = new DataNode(drawRecord.BuildingName) {Sno = drawRecord.BuildingId};
+                            buildNodes.Add(buildNode);
+                        }
+
+                        var systemNode = buildNode.Childrens.FirstOrDefault(s => s.Sno == drawRecord.RelationName);
+                        if (systemNode == null)
+                        {
+                            systemNode = new DataNode(drawRecord.RelationName){Sno=drawRecord.RelationName};
+                            buildNode.Childrens.Add(systemNode);
                         }
                         var recordNode = new DataNode(drawRecord.FloorName);
                         recordNode.SetData(drawRecord);
-                        relationNode.Childrens.Add(recordNode);
+                        systemNode.Childrens.Add(recordNode);
                     }
                 }
-                this.TreeRootNode.ItemsSource = treeDataSource;
-                if (treeDataSource.Count == 0)
+
+
+                this.TreeRootNode.ItemsSource = buildNodes;
+                if (buildNodes.Count == 0)
                 {
                     this.Content = CommonControlUtils.CreatMaskElement("未发现计算数据");
                 }

+ 82 - 40
MBI/SAGA.GplotDrawData/View/WinSystem.xaml.cs

@@ -4,6 +4,7 @@ using System.Linq;
 using System.Windows;
 using CEFSharpWPF;
 using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Others;
 using SAGA.GplotRelationComputerManage;
 using SAGA.Models;
 using SAGA.RevitUtils.Windows;
@@ -30,7 +31,6 @@ namespace SAGA.GplotDrawData.View
         /// 展示拓扑类型
         /// </summary>
         public GplotShowType ShowType { get; private set; }
-        public Action ComputerAction;
         public Action LoadData;
 
         protected override void OnLoaded(object sender, RoutedEventArgs e)
@@ -52,15 +52,26 @@ namespace SAGA.GplotDrawData.View
 
         private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
         {
-            if (!(rootNode.SelectedItem is DataNode dn))
-                return;
-            if (ShowType == GplotShowType.VerticalPlan)
+            try
             {
-                Draw(dn.GetData<VerticalDrawData>());
+                if (!(rootNode.SelectedItem is DataNode dn))
+                    return;
+                if (dn.Childrens.Count != 0)
+                {
+                    return;
+                }
+                if (ShowType == GplotShowType.VerticalPlan)
+                {
+                    Draw(dn.GetData<VerticalDrawData>());
+                }
+                else
+                {
+                    Draw(dn.GetData<FloorDrawData>());
+                }
             }
-            else
-            {               
-                Draw(dn.GetData<FloorDrawData>());
+            catch (Exception ex)
+            {
+                MessageShowBase.Show(ex);
             }
         }
         #region 平面数据处理
@@ -85,32 +96,53 @@ namespace SAGA.GplotDrawData.View
         /// </summary>
         private void InitFloorData()
         {
+            //按关系展示系统
             List<List<FloorDrawRecord>> recordDatas=GetFloorDrawData();
-            List<DataNode> treeDataSource = new List<DataNode>();
+            List<DataNode> buildNodes = new List<DataNode>();
             foreach (var records in recordDatas)
             {
                 if (records == null || !records.Any())
                     continue;
-                var groupSystems = records.GroupBy(r => r.SystemName);              
-                foreach (var groupSystem in groupSystems)
+                var buildGroup = records.GroupBy(r => r.BuildingId);
+                foreach (var build in buildGroup)
                 {
-                    var system = new DataNode(groupSystem.Key);
-                    var groupFloors = groupSystem.GroupBy(g => g.FloorName);
-                    foreach (var groupFloor in groupFloors)
+                    var buildFloorRecords = build.ToList();
+                    var firstFloor = buildFloorRecords.FirstOrDefault();
+                    if (firstFloor == null)
+                    {
+                        continue;
+                    }
+                    #region 检测建筑节点
+                    var buildNode = buildNodes.FirstOrDefault(dn => dn.Sno == build.Key);
+                    if (buildNode == null)
                     {
-                        var floor = new DataNode(groupFloor.Key);
-                        system.Childrens.Add(floor);
-                        var currentRecords = groupFloor.ToList();
-                        FloorDrawData floorData = new FloorDrawData() { FloorId = currentRecords.FirstOrDefault()?.FloorId };
-                        floorData.DrawRecords = currentRecords;
-                        floor.SetData(floorData);
+                        buildNode = new DataNode() { EName = firstFloor.BuildingName, Sno = firstFloor.BuildingId };
+                        buildNodes.Add(buildNode);
                     }
+                    #endregion
+                    var groupSystems = buildFloorRecords.GroupBy(r => r.SystemName);
+                    foreach (var groupSystem in groupSystems)
+                    {
+                        var system = new DataNode(groupSystem.Key);
+                        var groupFloors = groupSystem.GroupBy(g => g.FloorName);
+                        foreach (var groupFloor in groupFloors)
+                        {
+                            var floor = new DataNode(groupFloor.Key);
+                            system.Childrens.Add(floor);
+                            var currentRecords = groupFloor.ToList();
+                            FloorDrawData floorData = new FloorDrawData() { FloorId = currentRecords.FirstOrDefault()?.FloorId };
+                            floorData.DrawRecords = currentRecords;
+                            floor.SetData(floorData);
+                        }
 
-                    treeDataSource.Add(system);
+                        buildNode.Childrens.Add(system);
+                    }
                 }
+
+               
             }
          
-            this.rootNode.ItemsSource = treeDataSource;
+            this.rootNode.ItemsSource = buildNodes;
               
         }
 
@@ -141,31 +173,43 @@ namespace SAGA.GplotDrawData.View
             {
                 LoadVerticalDrawData loadData = new LoadVerticalDrawData(relationType);
                 loadData.LoadData();
-                datas.Add(loadData.VerticalDrawData);
+                datas.AddRange(loadData.VerticalDrawDatas);
             }
             return datas;
         }
         private void InitVerticalData()
         {
-            List<DataNode> dataNode = new List<DataNode>();
-            List<VerticalDrawData> drawDatas = GetVerticalDrawData();
-            foreach (var drawData in drawDatas)
+            List<DataNode> buildNodes = new List<DataNode>();
+            var allDatas= GetVerticalDrawData();
+            var buildGroup = allDatas.GroupBy(v => v.BuildingId);
+            foreach (var buildData in buildGroup)
             {
-                if (drawData == null)
-                    continue;
-                var groups = (drawData.DrawRecords ?? new List<VerticalDrawRecord>()).GroupBy(c => c.SystemName);
-                foreach (var group in groups)
+                List<VerticalDrawData> drawDatas = buildData.ToList();
+                var tempFirstDraw = drawDatas.FirstOrDefault();
+                var buildNode = new DataNode(tempFirstDraw.BuildingName) {Sno = tempFirstDraw.BuildingId};
+                buildNodes.Add(buildNode);
+                List<DataNode> dataNodes = new List<DataNode>();
+                foreach (var drawData in drawDatas)
                 {
-                    if (string.IsNullOrEmpty(group.Key))
+                    if (drawData == null)
                         continue;
-                    var node = new DataNode() { EName = group.Key };
-                    var currentDrawData = new VerticalDrawData() { LevelDatas = drawData.LevelDatas };
-                    currentDrawData.DrawRecords = group.ToList();
-                    node.SetData(currentDrawData);
-                    dataNode.Add(node);
+                    var groups = (drawData.DrawRecords ?? new List<VerticalDrawRecord>()).GroupBy(c => c.SystemName);
+                    foreach (var group in groups)
+                    {
+                        if (string.IsNullOrEmpty(group.Key))
+                            continue;
+                        var node = new DataNode() { EName = group.Key };
+                        var currentDrawData = new VerticalDrawData() { LevelDatas = drawData.LevelDatas };
+                        currentDrawData.DrawRecords = group.ToList();
+                        node.SetData(currentDrawData);
+                        dataNodes.Add(node);
+                    }
                 }
-            }          
-            this.rootNode.ItemsSource = dataNode;
+
+                buildNode.Childrens.AddRange(dataNodes);
+            }
+                
+            this.rootNode.ItemsSource = buildNodes;
         }
         /// <summary>
         /// 画立管数据
@@ -177,8 +221,6 @@ namespace SAGA.GplotDrawData.View
             ConstData.ResponseData = db.CreateJObjectGroup();
             ucShowElement.Show(WebGplotSettings.VPipeUrl);
         }
-
-
         #endregion
     }
 }

+ 2 - 2
MBI/SAGA.GplotDrawData/WinDrawSpace-Web.xaml.cs

@@ -59,7 +59,7 @@ namespace SAGA.GplotDrawData
                 return;
             VirticalSpaceGraphView view = new VirticalSpaceGraphView();
             view.SpaceType = node.Sno;
-            var db = view.CreateDb(node.GetData<BuildingItem>());
+            var db = view.CreateDb(node.GetData<BuildingItemData>());
             ConstData.ResponseData = db.CreateJObjectGroup();
             ucShowElement.Show(WebGplotSettings.VSpaceUrl);
         }
@@ -75,7 +75,7 @@ namespace SAGA.GplotDrawData
                 {
                     continue;
                 }
-                BuildingItem buildItem = new BuildingItem();
+                BuildingItemData buildItem = new BuildingItemData();
                 buildItem.Id = firstFloor.BuildingId;
                 buildItem.Name = firstFloor.BuildingName;
                 buildItem.FloorDataItems.AddRange(tempFloors);

+ 47 - 12
MBI/SAGA.GplotManage/RelationManager/SystemRelationUploader.cs

@@ -29,24 +29,59 @@ namespace SAGA.GplotManage
             {
                 return items;
             }
-
-            var relations = RelationDataUtil.BuildRelations(data);
-            foreach (ReleateData originItem in relations)
+            //一个建筑一个建筑的算
+            Dictionary<string, LoadRelationData> dicDatas = new Dictionary<string, LoadRelationData>();
+            Func<string, LoadRelationData> getLoadData = (bldId) =>
             {
-                GraphRelationItem item = new GraphRelationItem();
-                item.FromId = originItem.from_id;
-                if (string.IsNullOrWhiteSpace(item.FromId))
+                if (!dicDatas.TryGetValue(bldId, out LoadRelationData useData))
                 {
-                    continue;
+                    useData = new LoadRelationData(RelationType);
+                    dicDatas[bldId] = useData;
                 }
-                item.ToId = originItem.to_id;
-                if (string.IsNullOrWhiteSpace(item.ToId))
+                return useData;
+            };
+            #region 分组数据
+            foreach (var record in data.FloorRelationRecords)
+            {
+                string buildingId = record.BuildingId;
+                var tempData = getLoadData(buildingId);
+                tempData.FloorRelationRecords.Add(record);
+            }
+            foreach (var record in data.MachineRoomRelationRecords)
+            {
+                string buildingId = record.BuildingId;
+                var tempData = getLoadData(buildingId);
+                tempData.MachineRoomRelationRecords.Add(record);
+            }
+            foreach (var record in data.VerticalRelationRecords)
+            {
+                string buildingId = record.BuildingId;
+                var tempData = getLoadData(buildingId);
+                tempData.VerticalRelationRecords.Add(record);
+            }
+            #endregion
+
+            foreach (var groupData in dicDatas)
+            {
+                var relations = RelationDataUtil.BuildRelations(groupData.Value);
+                foreach (ReleateData originItem in relations)
                 {
-                    continue;
+                    GraphRelationItem item = new GraphRelationItem();
+                    item.FromId = originItem.from_id;
+                    if (string.IsNullOrWhiteSpace(item.FromId))
+                    {
+                        continue;
+                    }
+                    item.ToId = originItem.to_id;
+                    if (string.IsNullOrWhiteSpace(item.ToId))
+                    {
+                        continue;
+                    }
+                    item.RelType = originItem.rel_type;
+                    items.Add(item);
                 }
-                item.RelType = originItem.rel_type;
-                items.Add(item);
             }
+           
             return items;
         }
     }

+ 59 - 0
MBI/SAGA.GplotRelationComputerManage/Data/CalcProjectContext.cs

@@ -0,0 +1,59 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:CalcProjectContext
+ * 作者:xulisong
+ * 创建时间: 2019/4/26 15:35:00
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using SAGA.DotNetUtils.Cache;
+using SAGA.MBI.RequestData;
+using SAGA.Models;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /// <summary>
+    /// 计算项目上下文
+    /// </summary>
+    public class CalcProjectContext
+    {
+        public CalcProjectContext(string projectId)
+        {
+            ProjectId = projectId;
+            //ProjectPassword
+            BuildingItems = CreateBuildingItems(ProjectId, ProjectPassword);
+        }
+        /// <summary>
+        /// 关联项目Id
+        /// </summary>
+        public string ProjectId { get; private set; }
+        /// <summary>
+        /// 项目密码
+        /// </summary>
+        private string ProjectPassword { get; set; }
+
+        public CacheItems<string, BuildingItem> BuildingItems { get; private set; }
+
+        public static CacheItems<string, BuildingItem> CreateBuildingItems(string projectId,string password)
+        {
+            CacheItems<string, BuildingItem> items = new CacheItems<string, BuildingItem>((s) =>
+            {
+                var rooms = new Dictionary<string, BuildingItem>();
+                var str = new string[] { MBIBuiltInCategory.Bd };
+                List<JObject> datas = CommonConvert.QueryObjectInfoByTypes(str);
+                foreach (var data in datas)
+                {
+                    var buildingItem = MBIItemFactory.Create<BuildingItem>(data);
+                    rooms[buildingItem.BuildingId] = buildingItem;
+                }
+                return rooms;
+            });
+            return items;
+        }
+    }
+}

+ 1 - 0
MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj

@@ -115,6 +115,7 @@
     <Compile Include="DataServer\FileKeyAttribute.cs" />
     <Compile Include="DataServer\IVersionFile.cs" />
     <Compile Include="DataServer\TimeVersionFile.cs" />
+    <Compile Include="Data\CalcProjectContext.cs" />
     <Compile Include="Data\MBIFloorInfo.cs" />
     <Compile Include="Draw\DocumentNode.cs" />
     <Compile Include="Draw\DrawDocumentUtil.cs" />

+ 55 - 6
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs

@@ -432,6 +432,41 @@ namespace SAGA.GplotRelationComputerManage
         #endregion
 
         #region 创建立面绘图和关系数据
+
+        /// <summary>
+        /// 计算立面数据
+        /// </summary>
+        public static List<VerticalResult> ComputerVerticalDatas(List<VerticalPipe> pipeDatas)
+        {
+            List<VerticalResult> results = new List<VerticalResult>();
+            var groupBuilding = pipeDatas.GroupBy(p => p.BuildingId);
+            foreach (var building in groupBuilding)
+            {
+                var buildPipeDatas = building.ToList();
+                var firstData = buildPipeDatas.FirstOrDefault();
+                var levelDatas = buildPipeDatas
+                    .Select(vp => new LevelData(){Name = vp.FloorName, FloorId = vp.FloorId, Id = vp.LevelId})
+                    .Distinct(new CommonEqualComparer<LevelData>((l1, l2) => l1.FloorId == l2.FloorId))
+                    .ToList();             
+                var buildingResult = ComputerVerticalData(buildPipeDatas, levelDatas);
+                if (firstData != null)
+                {
+                    buildingResult.DrawData.BuildingId= firstData.BuildingId;
+                    buildingResult.DrawData.BuildingName = firstData.BuildingName;
+                    buildingResult.BuildingId = firstData.BuildingId;
+                    buildingResult.BuildingName = firstData.BuildingName;
+                    buildingResult.RelationData.ForEach(r =>
+                    {
+                        r.BuildingId= firstData.BuildingId;
+                        r.BuildingName= firstData.BuildingName;
+                    });
+                }
+
+                results.Add(buildingResult);
+            }
+            return results;
+        }
+
         /// <summary>
         /// 计算立面数据
         /// </summary>
@@ -440,7 +475,9 @@ namespace SAGA.GplotRelationComputerManage
 
             List<VerticalDrawRecord> drawRecords = new List<VerticalDrawRecord>();
             List<VerticalRelationRecord> relationRecords = new List<VerticalRelationRecord>();
+
             #region 标高绘图数据整理
+
             List<VFloor> floors = new List<VFloor>();
             for (int i = 0; i < levelDatas.Count; i++)
             {
@@ -450,51 +487,61 @@ namespace SAGA.GplotRelationComputerManage
                 {
                     tempFloor.ValueDescription = "G";
                 }
+
                 tempFloor.Index = i;
                 tempFloor.FloorId = levelDatas[i].FloorId;
                 tempFloor.LinkId = levelDatas[i].Id;
                 floors.Add(tempFloor);
 
             }
+
             #endregion
 
             #region 立管或相当于立管的空间处理
+
             /*
              * 按系统分组,[一个空间会不会对应多个系统]
              */
             var comparer = new VpComparer();
-         
+
             int groupId = 0;
             //按系统分组
             var goupSystems = pipeDatas.GroupBy(p => p.PipeSytemType);
             foreach (var groupSystem in goupSystems)
             {
                 //按坐标分组
-                foreach (var groupPosition in groupSystem.GroupBy(p=>p.DownPoint3D, comparer))
+                foreach (var groupPosition in groupSystem.GroupBy(p => p.DownPoint3D, comparer))
                 {
-                    var currentGroupdId = ++groupId ;
+                    var currentGroupdId = ++groupId;
                     RelationItemSet relationItemSet = new RelationItemSet();
+
                     #region 处理绘图数据
+
                     foreach (var groupFloor in groupPosition.GroupBy(p => p.LevelName))
                     {
                         var verData = groupFloor.FirstOrDefault();
                         string floorId = floors.FirstOrDefault(c => c.Name == groupFloor.Key)?.FloorId;
+
                         #region 生成存储核心数据
+
                         VPipe pipe = new VPipe();
                         pipe.LinkId = verData.Id;
-                        pipe.Name = string.Join(",", groupFloor.Select(v => v.Display));//verData.Display;
+                        pipe.Name = string.Join(",", groupFloor.Select(v => v.Display)); //verData.Display;
                         pipe.Tip = verData.DisplayTip;
                         pipe.PipeSystemType = verData.PipeSytemType;
                         pipe.FloorId = floorId;
+
                         #endregion
+
                         VerticalDrawRecord drawRecord = new VerticalDrawRecord();
                         drawRecord.GroupId = currentGroupdId.ToString();
                         drawRecord.RefPipe = pipe;
                         drawRecord.SystemName = groupSystem.Key;
                         drawRecords.Add(drawRecord);
                         relationItemSet.AddRange(groupFloor.Select(v => string.Format("{0}:{1}", floorId, v.Id)));
-                       // relationItemSet.AddRange(groupFloor.Select(v => string.Format("{0}",  v.Id)));
+                        // relationItemSet.AddRange(groupFloor.Select(v => string.Format("{0}",  v.Id)));
                     }
+
                     #endregion
 
                     #region 处理关系数据
@@ -503,6 +550,7 @@ namespace SAGA.GplotRelationComputerManage
                     relationRecord.SystemName = groupSystem.Key;
                     relationRecord.RelationItems = relationItemSet;
                     relationRecords.Add(relationRecord);
+
                     #endregion
                 }
             }
@@ -510,11 +558,12 @@ namespace SAGA.GplotRelationComputerManage
             #endregion
 
             VerticalResult result = new VerticalResult();
-            result.DrawData = new VerticalDrawData() { LevelDatas = floors, DrawRecords = drawRecords };
+            result.DrawData = new VerticalDrawData() {LevelDatas = floors, DrawRecords = drawRecords};
             result.RelationData = relationRecords;
             return result;
 
         }
+
         #endregion
 
         #region 创建机房绘图数据

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/VerticalResult.cs

@@ -9,7 +9,7 @@ namespace SAGA.GplotRelationComputerManage
     /// <summary>
     /// 立面计算结果信息
     /// </summary>
-    public class VerticalResult
+    public class VerticalResult:ServerData
     {
         /// <summary>
         /// 绘图数据

+ 12 - 4
MBI/SAGA.GplotRelationComputerManage/SystemRelation/FloorSystemItem.cs

@@ -384,6 +384,12 @@ namespace SAGA.GplotRelationComputerManage
 
         #region 解析立管
 
+        private void SetAttachBuilding(VerticalPipe vp,MEPCurve mepCurve)
+        {
+            vp.FloorId = mepCurve.Document.PathName.GetFileName();
+            vp.BuildingName = MBIInfoUtil.GetBuildingName(vp.FloorId);
+            vp.BuildingId = MBIInfoUtil.GetBuildingId(vp.FloorId);
+        }
         /*
          * 1、解析立管需要考虑,竖直风管,水管,空间的情况;
          *2、将各层数据汇总,才能统一计算立管的相关关系数据
@@ -403,12 +409,14 @@ namespace SAGA.GplotRelationComputerManage
                 {
                     Id = pipe.Id.IntegerValue.ToString(),
                     LevelName = currentLevelName,
+                    LevelId=level.Id.ToString(),
                     LevelElevation = level.Elevation,
                     UpPoint3D = PointConverter.XYZToPoint3D(pipe.GetVerticalTopPoint()),
                     DownPoint3D = PointConverter.XYZToPoint3D(pipe.GetVerticalBottomPoint()),
                     PipeSytemType = pipe.GetSystemTypeName()
                 };
-
+                SetAttachBuilding(vp,pipe);
+                vp.FloorName = currentLevelName;
                 #region  获取立管关联空间
 
                 var locationCurve = pipe.GetLocationCurve();
@@ -615,16 +623,16 @@ namespace SAGA.GplotRelationComputerManage
             #region 生成图形数据
             var drawData = SystemParseManager.CreateRoomDrawing(graphs);           
             MachineRoomDrawRecord record = new MachineRoomDrawRecord();
-            //record.Id = Document.GetMd5();
-            record.RelationName = relationSetting.RelationItem.Name;
-            record.FloorName = MBIInfoUtil.GetFloorNameByLevel(UseLevel.Name);
+            record.RelationName = relationSetting.RelationItem.Name;           
             record.NodePaths = drawData;
+            record.SetFloorLevel(UseLevel);
             context[relationType].MachineRoomDrawRecords.Add(record);
             #endregion
 
             #region 生成关系数据
             var relations = SystemParseManager.CreateRoomRelation(graphs);
             MachineRoomRelationRecord relationRecord = new MachineRoomRelationRecord();
+            relationRecord.SetFloorLevel(UseLevel);
             relationRecord.RelationName = relationSetting.RelationItem.Name;
             foreach (var item in relations)
             {

+ 6 - 6
MBI/SAGA.GplotRelationComputerManage/SystemRelation/RelationComputerData.cs

@@ -82,9 +82,9 @@ namespace SAGA.GplotRelationComputerManage
             MachineRoomDrawRecords.ForEach(r => r.BuildingTime = buildingTime);
             DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.MachineRoomDraw), MachineRoomDrawRecords);
             DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.MachineRoomRelation), MachineRoomRelationRecords);
-            var result = SystemParseManager.ComputerVerticalData(VerticalPipes, Levels);
-            DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.VerticalDraw), result.DrawData);
-            DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.VerticalRelation), result.RelationData);
+            var results = SystemParseManager.ComputerVerticalDatas(VerticalPipes);
+            DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.VerticalDraw), results.Select(r=>r.DrawData).ToList());
+            DataServerUtil.Current.SaveData(RealKey(ComputerFileSetting.VerticalRelation), results.SelectMany(r => r.RelationData).ToList());
         }
     }
 
@@ -174,11 +174,11 @@ namespace SAGA.GplotRelationComputerManage
     {
         public LoadVerticalDrawData(string relationType) : base(relationType)
         {
-            VerticalDrawData = new VerticalDrawData();
+            VerticalDrawDatas = new List<VerticalDrawData>();
         }
         #region 存储数据
 
-        public VerticalDrawData VerticalDrawData { get; protected set; }
+        public List<VerticalDrawData> VerticalDrawDatas { get; protected set; }
         #endregion
         /// <summary>
         /// 加载计算数据
@@ -186,7 +186,7 @@ namespace SAGA.GplotRelationComputerManage
         public void LoadData()
         {
 
-            VerticalDrawData = DataServerUtil.Current.LoadData<VerticalDrawData>(RealKey(ComputerFileSetting.VerticalDraw))??new VerticalDrawData();
+            VerticalDrawDatas = DataServerUtil.Current.LoadData<List<VerticalDrawData>>(RealKey(ComputerFileSetting.VerticalDraw))??new List<VerticalDrawData>();
 
         }
     }

+ 3 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/FloorRecord.cs

@@ -43,7 +43,9 @@ namespace SAGA.GplotRelationComputerManage
                 return;
             FloorName = MBIInfoUtil.GetFloorNameByLevel(level.Name)??string.Empty;
             FloorLevelElevation = level.ProjectElevation.FromApi();
-            FloorId = level.Document.PathName.GetFileName(); 
+            FloorId = level.Document.PathName.GetFileName();
+            BuildingName = MBIInfoUtil.GetBuildingName(FloorId);
+            BuildingId = MBIInfoUtil.GetBuildingId(FloorId);
         }
     }
 }

+ 2 - 5
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomDrawRecord.cs

@@ -10,6 +10,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Autodesk.Revit.DB;
 using SAGA.Models.Graphs;
 
 namespace SAGA.GplotRelationComputerManage
@@ -17,7 +18,7 @@ namespace SAGA.GplotRelationComputerManage
     /// <summary>
     /// 机房绘图数据
     /// </summary>
-    public class MachineRoomDrawRecord : ServerData
+    public class MachineRoomDrawRecord : FloorRecord
     {
         public MachineRoomDrawRecord()
         {
@@ -25,10 +26,6 @@ namespace SAGA.GplotRelationComputerManage
             NodePaths = new List<GNodeGraph>();
         }
         /// <summary>
-        /// 楼层名称
-        /// </summary>
-        public string FloorName { get; set; }
-        /// <summary>
         /// 关系名称
         /// </summary>
         public string RelationName { get; set; }

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/ServerData/MachineRoomRelationRecord.cs

@@ -16,7 +16,7 @@ namespace SAGA.GplotRelationComputerManage
     /// <summary>
     /// 机房关系数据
     /// </summary>
-    public class MachineRoomRelationRecord : ServerData
+    public class MachineRoomRelationRecord : FloorRecord
     {
         public MachineRoomRelationRecord()
         {

+ 2 - 2
MBI/SAGA.GplotRelationComputerManage/SystemRelation/SystemComputerHandler.cs

@@ -25,9 +25,9 @@ namespace SAGA.GplotRelationComputerManage
         {
             List<string> testFiles = new List<string>();
 #if DEBUG
-            //testFiles.Add("Fl420105000119b7c08edcee11e8a553abe8a598be93.rvt");
+            testFiles.Add("Fl420105000119b7c08edcee11e8a553abe8a598be93.rvt");
             testFiles.Add("Fl42010500012ca5c61ddcf511e8a5535bb85ffaee3b.rvt");
-            testFiles.Add("Fl42010500015f8ce4eddcf411e8a5532f436ae9c161.rvt");
+            //testFiles.Add("Fl42010500015f8ce4eddcf411e8a5532f436ae9c161.rvt");
 #endif
             var fileInfos = RevitModelPath.GetAllRevitFiles();
             foreach (var fileInfo in fileInfos)

+ 2 - 2
MBI/SAGA.Models/AcWater.cs

@@ -19,9 +19,9 @@ namespace SAGA.Models {
         public double LevelElevation { get; set; }
         public List<SgSpace> EndPoints { get; set; } = new List<SgSpace>();
     }
-    public class BuildingItem
+    public class BuildingItemData
     {
-        public BuildingItem()
+        public BuildingItemData()
         {
             FloorDataItems = new List<FloorSpaceData>();
             Levels = new List<string>();

+ 30 - 0
MBI/SAGA.Models/MBIItem/Builder/BuildingItemBuilder.cs

@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:BuildingItemBuilder
+ * 作者:xulisong
+ * 创建时间: 2019/4/26 11:57:20
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.DotNetUtils.Extend;
+
+namespace SAGA.Models
+{
+    public class BuildingItemBuilder : MBIItemBuilder<BuildingItem>
+    {
+        public override BuildingItem Create(BuildingItem item, JObject jobject)
+        {
+            base.Create(item, jobject);
+            var infos = item.Infos;
+            item.Name = infos.GetValueEx(MBIBuiltInParameter.BuildName);
+            item.LocalName = infos.GetValueEx(MBIBuiltInParameter.BuildLocalName);
+            item.LocalId = infos.GetValueEx(MBIBuiltInParameter.BuildLocalName);
+            return item;
+        }
+    }
+}

+ 7 - 1
MBI/SAGA.Models/MBIItem/Builder/MBIItemBuilder.cs

@@ -55,7 +55,13 @@ namespace SAGA.Models
                 }
 
               
-            }          
+            }     
+            
+            var location= JObject.Parse(jobject.GetValueEx("location"));
+            if (location != null)
+            {
+                item.BuildingId = location.GetValueEx("building");
+            }
             return item;
         }
 

+ 1 - 0
MBI/SAGA.Models/MBIItem/Builder/MBIItemFactory.cs

@@ -28,6 +28,7 @@ namespace SAGA.Models
             m_Builders["EQ"] = new EquipmentItemBuilder();
              m_Builders["EC"] = new EquipmentItemBuilder();
              m_Builders["FL"] = new FloorItemBuilder();
+            m_Builders["BD"] = new BuildingItemBuilder();
         }
 
         /// <summary>

+ 26 - 0
MBI/SAGA.Models/MBIItem/Entity/BuildingItem.cs

@@ -0,0 +1,26 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:BuildingItem
+ * 作者:xulisong
+ * 创建时间: 2019/4/26 11:51:04
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.Models
+{
+    public class BuildingItem : MBIItem
+    {
+        ///// <summary>
+        ///// 关联楼层底图key值
+        ///// </summary>
+        //public string FloorMap
+        //{
+        //    get; set;
+        //}
+    }
+}

+ 1 - 4
MBI/SAGA.Models/MBIItem/Entity/FloorItem.cs

@@ -12,10 +12,7 @@ namespace SAGA.Models
         /// <summary>
         /// 关联楼层底图key值
         /// </summary>
-        public string FloorMap
-        {
-            get;set;
-        }
+        public string FloorMap{ get;set; }
         /// <summary>
         /// 楼层类型
         /// </summary>

+ 4 - 0
MBI/SAGA.Models/MBIItem/MBIBuiltInCategory.cs

@@ -31,6 +31,10 @@ namespace SAGA.Models
         /// </summary>
         public static readonly string Fl = "Fl";
         /// <summary>
+        /// 建筑
+        /// </summary>
+        public static readonly string Bd = "Bd";
+        /// <summary>
         /// 低压开关柜
         /// </summary>
         public readonly static string TDLS = "TDLS";

+ 19 - 0
MBI/SAGA.Models/MBIItem/MBIBuiltInParameter.cs

@@ -184,5 +184,24 @@ namespace SAGA.Models
         /// </summary>
         public readonly static string CTM_StandbyCtrl = "ctm-StandbyCtrl";
         #endregion
+
+        #region 建筑通用
+        /// <summary>
+        /// 建筑名称
+        /// </summary>
+        public readonly static string BuildName = "BuildName";
+        /// <summary>
+        /// 建筑功能
+        /// </summary>
+        public readonly static string BuildFuncType = "BuildFuncType";
+        /// <summary>
+        /// 建筑本地名称
+        /// </summary>
+        public readonly static string BuildLocalName = "BuildLocalName";
+        /// <summary>
+        /// 建筑本地编码
+        /// </summary>
+        public readonly static string BuildLocalID = "BuildLocalID";
+        #endregion
     }
 }

+ 2 - 0
MBI/SAGA.Models/SAGA.Models.csproj

@@ -95,12 +95,14 @@
     <Compile Include="Graphs\VElements\VPipe.cs" />
     <Compile Include="Graphs\VElements\VSpace.cs" />
     <Compile Include="Graphs\VElements\VGroupSpace.cs" />
+    <Compile Include="MBIItem\Builder\BuildingItemBuilder.cs" />
     <Compile Include="MBIItem\Builder\EquipmentItemBuilder.cs" />
     <Compile Include="MBIItem\Builder\FloorItemBuilder.cs" />
     <Compile Include="MBIItem\Builder\IMBIItemBuilder.cs" />
     <Compile Include="MBIItem\Builder\MBIItemFactory.cs" />
     <Compile Include="MBIItem\Builder\RoomItemBuilder.cs" />
     <Compile Include="MBIItem\Entity\AssetItem.cs" />
+    <Compile Include="MBIItem\Entity\BuildingItem.cs" />
     <Compile Include="MBIItem\Entity\EquipmentItem.cs" />
     <Compile Include="MBIItem\Entity\FloorItem.cs" />
     <Compile Include="MBIItem\Entity\RoomItem.cs" />

+ 6 - 11
MBI/SAGA.Models/VerticalPipe.cs

@@ -18,24 +18,19 @@ namespace SAGA.Models
 
         public double LevelElevation { get; set; }
         public string LevelName { get; set; }
+        public string LevelId { get; set; }
 
         public Point CPoint { get; set; }
         public string PipeSytemType { get; set; }
         public string Display { get; set; }
         public string DisplayTip { get; set; }
-    }
-    [TableName("VerticalPipeDatass")]
-    public class VerticalPipeData
-    {
-        /// <summary>
-        /// 标高
-        /// </summary>
-        public List<LevelData> Levels { get; set; }=new List<LevelData>();
 
-        //立管
-        public List<VerticalPipe> Datas { get; set; }=new List<VerticalPipe>();
+        public string FloorId { get; set; }
+        public string FloorName { get; set; }
+        public string BuildingId { get; set; }
+        public string BuildingName { get; set; }
     }
-
+ 
     public class LevelData
     {
         public string Id { get; set; }