Browse Source

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

mengxiangge 6 years ago
parent
commit
ac35d307ba

BIN
MBI/MBIResource/Config/物理世界关系定义列表-2019-1.xlsx


+ 12 - 1
MBI/Menu/MBITool.xml

@@ -222,7 +222,18 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
-
+<Button ButtonStyles="Large">
+      <ButtonName>SAGA.GplotManage.SearchShaftCommand</ButtonName>
+      <ButtonText>导出竖井关系</ButtonText>
+      <ImageName>10、空间管理</ImageName>
+      <DllName>..\OutputDll\SAGA.GplotManage.exe</DllName>
+      <ClassName>SAGA.GplotManage.SearchShaftCommand</ClassName>
+      <ToolTip>导出竖井关系</ToolTip>
+      <LongDescription>导出竖井关系</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>MBITool_W</MenuTab>
+      <Modules>MBITool</Modules>
+    </Button>
 </Panel>
 </Menus>
 <!--名称里面换行-->

+ 9 - 9
MBI/Menu/SAGABIM.xml

@@ -486,12 +486,12 @@
     <!--冷凍水供水-->
     <Button ButtonStyles="Large">
       <ButtonName>SAGA.GplotManage.ChillWaterLoopComputerSupplyGraph</ButtonName>
-      <ButtonText>水系统</ButtonText>
+      <ButtonText>水系统-平面</ButtonText>
       <ImageName>10、空间管理</ImageName>
       <DllName>..\OutputDll\SAGA.GplotManage.exe</DllName>
       <ClassName>SAGA.GplotManage.ChillWaterLoopComputerSupplyGraph</ClassName>
-      <ToolTip>冷冻水-供水</ToolTip>
-      <LongDescription>冷冻水-供水</LongDescription>
+      <ToolTip>水系统平面</ToolTip>
+      <LongDescription>水系统平面</LongDescription>
       <ToolTipImage></ToolTipImage>
       <MenuTab>SJJC_W</MenuTab>
       <Modules>SJJC</Modules>
@@ -513,24 +513,24 @@
     <!--冷凍水立管-->
     <Button ButtonStyles="Large">
       <ButtonName>SAGA.GplotManage.ChillWaterLoopComputerVGraph</ButtonName>
-      <ButtonText>冷冻水-立管</ButtonText>
+      <ButtonText>水系统-立面</ButtonText>
       <ImageName>10、空间管理</ImageName>
       <DllName>..\OutputDll\SAGA.GplotManage.exe</DllName>
       <ClassName>SAGA.GplotManage.ChillWaterLoopComputerVGraph</ClassName>
-      <ToolTip>冷冻水-立管</ToolTip>
-      <LongDescription>冷冻水-立管</LongDescription>
+      <ToolTip>水系统立面</ToolTip>
+      <LongDescription>水系统立面</LongDescription>
       <ToolTipImage></ToolTipImage>
       <MenuTab>SJJC_W</MenuTab>
       <Modules>SJJC</Modules>
     </Button>
     <Button ButtonStyles="Large">
       <ButtonName>SAGA.GplotManage.ChillWaterLoopRoom</ButtonName>
-      <ButtonText>冷站</ButtonText>
+      <ButtonText>机房</ButtonText>
       <ImageName>10、空间管理</ImageName>
       <DllName>..\OutputDll\SAGA.GplotManage.exe</DllName>
       <ClassName>SAGA.GplotManage.ChillWaterLoopRoom</ClassName>
-      <ToolTip>冷站</ToolTip>
-      <LongDescription>冷站</LongDescription>
+      <ToolTip>机房拓扑图</ToolTip>
+      <LongDescription>机房拓扑图</LongDescription>
       <ToolTipImage></ToolTipImage>
       <MenuTab>SJJC_W</MenuTab>
       <Modules>SJJC</Modules>

+ 30 - 0
MBI/SAGA.GplotDrawData/CommonControlUtils.cs

@@ -0,0 +1,30 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:CommonControlUtils
+ * 作者:xulisong
+ * 创建时间: 2019/4/11 11:16:28
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace SAGA.GplotDrawData
+{
+    public class CommonControlUtils
+    {
+        public static UIElement CreatMaskElement(string message)
+        {
+            Grid grid = new Grid();
+            grid.Background = Brushes.Gray;
+            grid.Opacity = 0.8;
+            grid.Children.Add(new TextBlock() { Text = message??"空", FontSize = 30, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center });
+            return grid;
+        }
+    }
+}

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

@@ -76,6 +76,7 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="CommonControlUtils.cs" />
     <Compile Include="Common\WebGplotSettings.cs" />
     <Compile Include="DBView\EquipmentGraphView.cs" />
     <Compile Include="DBView\FloorSystemGraphView.cs" />

+ 28 - 15
MBI/SAGA.GplotDrawData/View/WinMachineRoom.xaml.cs

@@ -2,11 +2,13 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
-
+using System.Windows.Controls;
+using System.Windows.Media;
 using CEFSharpWPF;
 using Newtonsoft.Json.Linq;
 using SAGA.GplotRelationComputerManage;
 using SAGA.Models;
+using SAGA.RevitUtils;
 using SAGA.RevitUtils.Windows;
 
 namespace SAGA.GplotDrawData.View
@@ -57,26 +59,37 @@ namespace SAGA.GplotDrawData.View
         /// </summary>
         private void InitTreeNode()
         {
-            List<List<MachineRoomDrawRecord>> drawDatas = GetMachineRoomDrawData();
-            List<DataNode> treeDataSource = new List<DataNode>();
-            foreach (var drawData in drawDatas)
+            try
             {
-                foreach (var drawRecord in drawData)
+                List<List<MachineRoomDrawRecord>> drawDatas = GetMachineRoomDrawData();
+                List<DataNode> treeDataSource = new List<DataNode>();
+                foreach (var drawData in drawDatas)
                 {
-                    if (!drawRecord.NodePaths.Any())
-                        continue;
-                    var relationNode = treeDataSource.FirstOrDefault(d => d.EName == drawRecord.RelationName);
-                    if (relationNode == null)
+                    foreach (var drawRecord in drawData)
                     {
-                        relationNode= new DataNode(drawRecord.RelationName);
-                        treeDataSource.Add(relationNode);
+                        if (!drawRecord.NodePaths.Any())
+                            continue;
+                        var relationNode = treeDataSource.FirstOrDefault(d => d.EName == drawRecord.RelationName);
+                        if (relationNode == null)
+                        {
+                            relationNode = new DataNode(drawRecord.RelationName);
+                            treeDataSource.Add(relationNode);
+                        }
+                        var recordNode = new DataNode(drawRecord.FloorName);
+                        recordNode.SetData(drawRecord);
+                        relationNode.Childrens.Add(recordNode);
                     }
-                    var recordNode= new DataNode(drawRecord.FloorName);
-                    recordNode.SetData(drawRecord);
-                    relationNode.Childrens.Add(recordNode);
                 }
+                this.TreeRootNode.ItemsSource = treeDataSource;
+                if (treeDataSource.Count == 0)
+                {
+                    this.Content = CommonControlUtils.CreatMaskElement("未发现计算数据");
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageShow.Show(ex);
             }
-           this.TreeRootNode.ItemsSource = treeDataSource;
         }
         private void Draw(MachineRoomDrawRecord record)
         {

+ 5 - 0
MBI/SAGA.GplotDrawData/View/WinSystem.xaml.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
 using CEFSharpWPF;
+using SAGA.DotNetUtils;
 using SAGA.GplotRelationComputerManage;
 using SAGA.Models;
 using SAGA.RevitUtils.Windows;
@@ -43,6 +44,10 @@ namespace SAGA.GplotDrawData.View
                 InitFloorData();
             }
             RootNode_OnSelectedItemChanged(null, null);
+            if (rootNode.ItemsSource==null|| !rootNode.ItemsSource.OfType<DataNode>().Any())
+            {
+                this.Content = CommonControlUtils.CreatMaskElement("未发现计算数据");
+            }
         }
 
         private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

+ 28 - 18
MBI/SAGA.GplotManage/Command.cs

@@ -31,13 +31,16 @@ namespace SAGA.GplotManage
             {
                 DistributionRelationshipHandler handler = new DistributionRelationshipHandler();
                 var re = handler.GetViewData(new PowerComputerContext());
-                if (re[0].Childrens.Any())
+
+                if (re[0].Childrens.Count == 0 && re[1].Childrens.Count == 0)
                 {
-                    WinEquipmentRelation_Web window =
-                        new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
-                    window.Title = "配电拓扑图:配电柜--配电柜";
-                    window.Show();
+                    MessageShow.Infomation("不存在相关拓扑数据");
+                    return Result.Succeeded;
                 }
+                WinEquipmentRelation_Web window =
+                    new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
+                window.Title = "配电拓扑图:配电柜--配电柜";
+                window.Show();
 
             }
             catch (Exception ex)
@@ -69,16 +72,19 @@ namespace SAGA.GplotManage
             #region 核心处理
             EquipPowerRelationshipHandler handler = new EquipPowerRelationshipHandler();
             var re = handler.GetViewData(new PowerComputerContext());
-            if (re[0].Childrens.Any())
+            if (re[0].Childrens.Count == 0 && re[1].Childrens.Count == 0)
             {
-                WinEquipmentRelation_Web window =
-                    new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
-                window.Title = "配电拓扑图:配电柜--末端";
-                window.Show();
-            } 
+                MessageShow.Infomation("不存在相关拓扑数据");
+                return Result.Succeeded;
+            }
+
+            WinEquipmentRelation_Web window =
+                new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
+            window.Title = "配电拓扑图:配电柜--末端";
+            window.Show();
             #endregion
             return Result.Succeeded;
-        }    
+        }  
         public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
         {
             return true;
@@ -99,13 +105,17 @@ namespace SAGA.GplotManage
             #region 核心处理
             ObjectControlRelationshipHandler handler = new ObjectControlRelationshipHandler();
             var re = handler.GetViewData(new PowerComputerContext());
-            if (re[0].Childrens.Any())
+            if (re[0].Childrens.Count == 0 && re[1].Childrens.Count == 0)
             {
-                WinControlRelation_Web window =
-                    new WinControlRelation_Web(re[0].Childrens, re[1].Childrens);
-                window.Title = "对象受控关系图";
-                window.Show();
-            } 
+                MessageShow.Infomation("不存在相关拓扑数据");
+                return Result.Succeeded;
+            }
+
+            WinControlRelation_Web window =
+                new WinControlRelation_Web(re[0].Childrens, re[1].Childrens);
+            window.Title = "对象受控关系图";
+            window.Show();
+
             #endregion
 
             return Result.Succeeded;

File diff suppressed because it is too large
+ 310 - 1
MBI/SAGA.GplotManage/GplotCommand.cs


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

@@ -67,6 +67,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Dlls\NPOI.OOXML.dll</HintPath>
     </Reference>
+    <Reference Include="NPOI.OpenXml4Net, Version=2.2.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1" />
     <Reference Include="RevitAPI, Version=16.0.0.0, Culture=neutral, processorArchitecture=AMD64">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Dlls\R2017\RevitAPI.dll</HintPath>

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

@@ -35,10 +35,10 @@ namespace SAGA.GplotRelationComputerManage
                 {
 
 #if DEBUG
-                    if (testFiles.All(f => !fileInfo.Contains(f)))
-                    {
-                        continue;
-                    }
+                    //if (testFiles.All(f => !fileInfo.Contains(f)))
+                    //{
+                    //    continue;
+                    //}
 #endif
                     FloorSystemItem floorItems = context.FloorItems.GetItem(fileInfo);
                     //FloorSystemItemTest floorItems = context.TestFloorItems.GetItem(fileInfo);

+ 8 - 8
MBI/SAGA.MBI/Common/MessageManager.cs

@@ -22,14 +22,14 @@ namespace SAGA.MBI.Common
              * 本来想根据地址,映射变量动态生成。现在简化写成固定的
              */
             MessageMap map = new MessageMap();
-            map.Add(new MessageMapItem() {MessageCode = "godhand", MessageDescription = "上帝之后后台"});
-            map.Add(new MessageMapItem() { MessageCode = "ScanBuilding", MessageDescription = "扫楼后台" });
-            map.Add(new MessageMapItem() { MessageCode = "data-platform-3", MessageDescription = "数据平台" });
-            map.Add(new MessageMapItem() { MessageCode = "venders", MessageDescription = "厂商库" });
-            map.Add(new MessageMapItem() { MessageCode = "venders-dp", MessageDescription = "厂商库辅助" });
-            map.Add(new MessageMapItem() { MessageCode = "image-service", MessageDescription = "文件服务器" });
-            map.Add(new MessageMapItem() { MessageCode = ":8888/#/", MessageDescription = "前端页面" });
-            map.Add(new MessageMapItem() { MessageCode = ":8889/#/", MessageDescription = "前端页面" });
+            map.Add(new MessageMapItem() {MessageCode = "godhand", MessageDescription = "上帝之后后台",MatchType=CodeMatchType.Mistiness});
+            map.Add(new MessageMapItem() { MessageCode = "ScanBuilding", MessageDescription = "扫楼后台", MatchType = CodeMatchType.Mistiness });
+            map.Add(new MessageMapItem() { MessageCode = "data-platform-3", MessageDescription = "数据平台", MatchType = CodeMatchType.Mistiness });        
+            map.Add(new MessageMapItem() { MessageCode = "venders-dp", MessageDescription = "厂商库辅助", MatchType = CodeMatchType.Mistiness });
+            map.Add(new MessageMapItem() { MessageCode = "venders", MessageDescription = "厂商库", MatchType = CodeMatchType.Mistiness });
+            map.Add(new MessageMapItem() { MessageCode = "image-service", MessageDescription = "文件服务器", MatchType = CodeMatchType.Mistiness });
+            map.Add(new MessageMapItem() { MessageCode = ":8888/#/", MessageDescription = "前端页面", MatchType = CodeMatchType.Mistiness });
+            map.Add(new MessageMapItem() { MessageCode = ":8889/#/", MessageDescription = "前端页面", MatchType = CodeMatchType.Mistiness });
             map.Save();
         }
     }

+ 127 - 0
MBI/SAGA.MBI/RequestData/RelationRequest.cs

@@ -10,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using Newtonsoft.Json.Linq;
 using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Http;
 using SAGA.DotNetUtils.Others;
 using SAGA.MBI.Common;
@@ -288,5 +289,131 @@ namespace SAGA.MBI.RequestData
             }
             return null;
         }
+
+        /// <summary>
+        ///查询与指定Id的关系
+        /// </summary>
+        /// <param name="itemId"></param>
+        /// <param name="graphId"></param>
+        /// <param name="relType"></param>
+        /// <returns></returns>
+        public static List<string> QueryRelations(string itemId, string graphId, string relType)
+        {
+            if (string.IsNullOrWhiteSpace(itemId))
+            {
+                throw new ArgumentNullException(nameof(itemId));
+            }
+            List<string> items = new List<string>();
+            try
+            {
+                string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/relation/query?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
+
+                JObject fromObject = new JObject();
+                fromObject.Add("from_id", itemId);
+                fromObject.Add("graph_id", graphId);
+            
+                JObject toObject = new JObject();
+                toObject.Add("to_id", itemId);
+                toObject.Add("graph_id", graphId);
+
+                if (!string.IsNullOrWhiteSpace(relType))
+                {
+                    fromObject.Add("rel_type", relType);
+                    toObject.Add("rel_type", relType);
+                }
+
+                JArray array = new JArray();
+                array.Add(fromObject);
+                array.Add(toObject);
+                JObject queryObject = new JObject();
+                queryObject.Add("criterias", array);
+
+                string postData = queryObject.ToString();
+                RestClient client = new RestClient(url, HttpVerb.POST, postData);
+                string request = client.PostRequest();
+                if (request.IsRequestHasItem())
+                {
+                    JObject jObject = JObject.Parse(request);
+                    foreach (JObject jobj in jObject["Content"])
+                    {
+                        string toid = jobj.GetValueEx("to_id");
+                        if (toid != itemId)
+                        {
+                            items.Add(toid);
+                            continue;
+                        }
+                        string fromid = jobj.GetValueEx("from_id");
+                        if (fromid != itemId)
+                        {
+                            items.Add(fromid);
+                            continue;
+                        }
+                    }
+                }
+                return items;
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+            return items;
+        }
+
+        /// <summary>
+        /// 查询实例的所有关系
+        /// </summary>
+        /// <param name="graphId"></param>
+        /// <param name="relType"></param>
+        /// <returns></returns>
+        public static List<Tuple<string,string>> QueryRelations(string graphId, string relType)
+        {       
+            List<Tuple<string, string>> items =new List<Tuple<string, string>>();
+            try
+            {
+                string url = MBIConst.DataPlatformLocalHost + $"data-platform-3/relation/query?secret={MBIControl.ProjectCur.Password}&projectId={MBIControl.ProjectCur.Id}";
+
+                JObject fromObject = new JObject();
+                fromObject.Add("graph_id", graphId);
+                if (!string.IsNullOrWhiteSpace(relType))
+                {
+                    fromObject.Add("rel_type", relType);
+                }
+                JArray array = new JArray();
+                array.Add(fromObject);
+                JObject queryObject = new JObject();
+                queryObject.Add("criterias", array);
+
+                string postData = queryObject.ToString();
+                RestClient client = new RestClient(url, HttpVerb.POST, postData);
+                string request = client.PostRequest();
+                //if (request.IsRequestHasItem())
+                //{
+                JObject jObject = JObject.Parse(request);
+                if(jObject.IsContainKeyEx("Content"))
+                {
+                    foreach (JObject item in jObject["Content"])
+                    {
+                        foreach (JObject jobj in item["Content"])
+                        {
+                            string toid = jobj.GetValueEx("to_id");
+                            string fromid = jobj.GetValueEx("from_id");
+                            if (!string.IsNullOrWhiteSpace(toid) && !string.IsNullOrWhiteSpace(fromid))
+                            {
+                                items.Add(new Tuple<string, string>(toid, fromid));
+                            }
+                        }
+                       
+                    }
+                }
+                  
+                //}
+                return items;
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+            return items;
+        }
     }
 }

+ 2 - 0
MBI/SAGA.MBI/TestCommand.cs

@@ -493,4 +493,6 @@ namespace SAGA.MBI
         }
 
     }
+
+   
 }

+ 2 - 0
MBI/SAGA.Models/MBIItem/Builder/FloorItemBuilder.cs

@@ -18,6 +18,8 @@ namespace SAGA.Models
             item.Name = infos.GetValueEx(MBIBuiltInParameter.FloorName);
             item.LocalName = infos.GetValueEx(MBIBuiltInParameter.FloorLocalName);
             item.FloorMap = infos.GetValueEx(MBIBuiltInParameter.FloorMap);
+            item.FloorType = infos.GetValueEx(MBIBuiltInParameter.FloorType);
+            item.FloorSequenceID = infos.GetValueEx(MBIBuiltInParameter.FloorSequenceID);
             return item;
         }
     }

+ 5 - 0
MBI/SAGA.Models/MBIItem/Entity/FloorItem.cs

@@ -16,5 +16,10 @@ namespace SAGA.Models
         {
             get;set;
         }
+        /// <summary>
+        /// 楼层类型
+        /// </summary>
+        public string FloorType { get; set; }
+        public string FloorSequenceID { get; set; }
     }
 }

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

@@ -27,6 +27,10 @@ namespace SAGA.Models
         /// </summary>
         public static readonly string Si = "Si";
         /// <summary>
+        /// 楼层
+        /// </summary>
+        public static readonly string Fl = "Fl";
+        /// <summary>
         /// 低压开关柜
         /// </summary>
         public readonly static string TDLS = "TDLS";

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

@@ -155,6 +155,15 @@ namespace SAGA.Models
         /// 楼层底图信息点
         /// </summary>
         public readonly static string FloorMap = "FloorMap";
+        /// <summary>
+        /// 楼层顺序Id
+        /// </summary>
+        public readonly static string FloorSequenceID = "FloorSequenceID";
+        /// <summary>
+        /// 楼层类型
+        /// </summary>
+        public readonly static string FloorType = "FloorType";
+        
         #endregion
 
         #region 设备自定义

+ 4 - 4
MBI/SAGA.RevitUtils/SAGA.RevitUtils.csproj

@@ -158,6 +158,10 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Dlls\RevitRefDll\RevitAPIUI.dll</HintPath>
     </Reference>
+    <Reference Include="SAGA.RevitAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>G:\2019\SAGA.MBI\SAGA.MBI\MBI\OutputDll\SAGA.RevitAPI.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Drawing" />
@@ -335,10 +339,6 @@
       <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
       <Name>SAGA.DotNetUtils</Name>
     </ProjectReference>
-    <ProjectReference Include="..\SAGA.RevitAPI\SAGA.RevitAPIR2018.csproj">
-      <Project>{fb86504f-29db-4766-a2da-22842e5f770d}</Project>
-      <Name>SAGA.RevitAPIR2018</Name>
-    </ProjectReference>
     <ProjectReference Include="..\SAGA.RevitUtility\SAGA.RevitUtility.csproj">
       <Project>{5f78f5f7-95ba-4b72-8181-230b11192eca}</Project>
       <Name>SAGA.RevitUtility</Name>