소스 검색

xls:配电计算命令类整理

xulisong 6 년 전
부모
커밋
f7196e72e8
21개의 변경된 파일651개의 추가작업 그리고 1033개의 파일을 삭제
  1. 28 170
      MBI/SAGA.GplotDrawData/WinControlRelation-Web.xaml.cs
  2. 26 128
      MBI/SAGA.GplotDrawData/WinEquipmentRelation-Web.xaml.cs
  3. 0 1
      MBI/SAGA.GplotManage/GplotManage/GplotParse/GplotParse.cs
  4. 37 728
      MBI/SAGA.GplotRelationComputerManage/Command.cs
  5. 66 0
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/Common/DataNodeUtil.cs
  6. 90 0
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/Common/PowerComputerContext.cs
  7. 79 0
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/DistributionRelationshipHandler.cs
  8. 85 0
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/EquipPowerRelationshipHandler.cs
  9. 96 0
      MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/ObjectControlRelationshipHandler.cs
  10. 5 0
      MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj
  11. 2 3
      MBI/SAGA.MBI/RequestData/CommonRequest.cs
  12. 5 1
      MBI/SAGA.Models/MBIItem/Builder/EquipmentItemBuilder.cs
  13. 15 0
      MBI/SAGA.Models/MBIItem/Builder/MBIItemBuilder.cs
  14. 3 0
      MBI/SAGA.Models/MBIItem/Builder/RoomItemBuilder.cs
  15. 2 0
      MBI/SAGA.Models/MBIItem/Entity/EquipmentItem.cs
  16. 24 1
      MBI/SAGA.Models/MBIItem/Entity/MBIItem.cs
  17. 1 0
      MBI/SAGA.Models/MBIItem/Entity/RoomItem.cs
  18. 62 0
      MBI/SAGA.Models/MBIItem/MBIBuiltInCategory.cs
  19. 23 0
      MBI/SAGA.Models/MBIItem/MBIBuiltInParameter.cs
  20. 1 0
      MBI/SAGA.Models/SAGA.Models.csproj
  21. 1 1
      MBI/SAGA.Revit.sln.DotSettings.user

+ 28 - 170
MBI/SAGA.GplotDrawData/WinControlRelation-Web.xaml.cs

@@ -36,12 +36,14 @@ namespace SAGA.GplotDrawData
         private bool m_isReadData = true;
         private List<DataNode> dataNodes;
         private List<DataNode> orphanNodes;
+
         public WinControlRelation_Web(List<DataNode> dataNodes, List<DataNode> orphanNodes) : this()
         {
             this.dataNodes = dataNodes;
             this.orphanNodes = orphanNodes;
             m_isReadData = false;
         }
+
         public UcGplotShow UcShow => ucShowElement;
 
         public void ReLoad(List<DataNode> dataNodes, List<DataNode> orphanNodes)
@@ -50,13 +52,14 @@ namespace SAGA.GplotDrawData
             this.orphanNodes = orphanNodes;
             MainWindow_Loaded(null, null);
         }
+
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
             if (m_isReadData)
             {
 
                 var dataNodes = DbHelper.FindOneByFile<DataNode>();
-                DataNode root = new DataNode("对象受控关系") { Sno = "root", FloorName = "1" };
+                DataNode root = new DataNode("对象受控关系") {Sno = "root", FloorName = "1"};
 
 
                 dataNodes.Childrens.ForEach(d =>
@@ -76,16 +79,16 @@ namespace SAGA.GplotDrawData
 
 
                 this.InDataNodes = new ObservableCollection<DataNode>(dataNodes.Childrens);
-                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root };
+                this.rootNode.ItemsSource = new ObservableCollection<DataNode> {root};
             }
             else
             {
-                DataNode root = new DataNode("对象受控关系") { Sno = "root", FloorName = "1" };
-                var orphan = new DataNode("孤立节点") { Sno = "orphan", FloorName = "2" };
+                DataNode root = new DataNode("对象受控关系") {Sno = "root", FloorName = "1"};
+                var orphan = new DataNode("孤立节点") {Sno = "orphan", FloorName = "2"};
                 //配电箱
-                var orphanTdls = new DataNode("控制箱") { Sno = "TDLS", FloorName = "1" };
+                var orphanTdls = new DataNode("控制箱") {Sno = "TDLS", FloorName = "1"};
                 //设备
-                var orphanEq = new DataNode("设备") { Sno = "EQ", FloorName = "2" };
+                var orphanEq = new DataNode("设备") {Sno = "EQ", FloorName = "2"};
 
                 orphan.Childrens.Add(orphanTdls);
                 orphan.Childrens.Add(orphanEq);
@@ -93,7 +96,6 @@ namespace SAGA.GplotDrawData
 
                 dataNodes.ForEach(d =>
                 {
-
                     root.Childrens.Add(new DataNode(d.EName)
                     {
                         EId = d.EId,
@@ -102,8 +104,6 @@ namespace SAGA.GplotDrawData
                         InLineNo = d.InLineNo,
                         FloorName = d.FloorName
                     });
-
-
                 });
 
                 orphanNodes.ForEach(d =>
@@ -136,53 +136,14 @@ namespace SAGA.GplotDrawData
                 orphan.Childrens = orphan.Childrens.OrderBy(t => t.FloorName).ToList();
                 orphan.Childrens[0].Childrens = orphan.Childrens[0].Childrens.OrderBy(t => t.FloorName).ToList();
                 orphan.Childrens[1].Childrens = orphan.Childrens[1].Childrens.OrderBy(t => t.FloorName).ToList();
-                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root, orphan };
+                this.rootNode.ItemsSource = new ObservableCollection<DataNode> {root, orphan};
+
 
-                DrawRootNode(root);
             }
         }
-        List<UIElement> m_rootElements = new List<UIElement>();
 
-        void DrawRootNode(DataNode dn)
-        {
-            var inData = dn.Childrens;
-            var muData = dn.Childrens.Where(t => t.Type == "母联柜").ToList();
-            var n = inData.Count;
-            var left = 100;
-            for (int i = 1; i < n + 1; i++)
-            {
-                var node = inData[i - 1];
-                //判断是否连接母联柜
-                var regex = new Regex($"{node.Sno},|,{node.Sno}");
-                var mu = muData.FirstOrDefault(d => regex.IsMatch(d.InLineNo));
-                //画当前点
-                m_rootElements.Add(GetVertex(node));
-                var text = node.GetText();
-                text.Text = node.EName + "-" + node.Type;
-                m_rootElements.Add(text);
-                if (i == n) return;
-                if (mu != null)
-                {
 
-                    //画母联柜
-                    m_rootElements.Add(GetVertex(mu));
-                    var muText = mu.GetText();
-                    muText.Text = mu.EName + "-" + mu.Type;
-                    m_rootElements.Add(muText);
-                    //画母联柜上下连线
-                    m_rootElements.Add(new SgLine(node.Postition, mu.Postition));
-                    //移除母联柜
-                    muData.Remove(mu);
-                }
-                else
-                {
 
-                }
-            }
-        }
-        private int CurrentNodeCount = 0;
-        private int level = 0;
-        private double PerHeight;
 
         void Draw(DataNode dn)
         {
@@ -191,133 +152,30 @@ namespace SAGA.GplotDrawData
             ConstData.ResponseData = db.CreateJObjectGroup();
             ucShowElement.Show(WebGplotSettings.MindMapUrl);
 
-            //CountNode(dn);
-            //CurrentNodeCount = 0;
-            //dn.Postition = new Point(100, 0);
-            //DrawData(dn);
         }
 
 
-        /// <summary>
-        /// 计算节点总数
-        /// </summary>
-        /// <param name="dn"></param>
-        void CountNode(DataNode dn)
+        private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
         {
-
-            System.Diagnostics.Debug.WriteLine(dn.EName + ":" + dn.Type + ":" + dn.Sno);
-            if (dn.Childrens.Count > 0)
-            {
-                foreach (var node in dn.Childrens)
+            Dispatcher.BeginInvoke(DispatcherPriority.Background,
+                (Action) delegate
                 {
-                    if (node.Childrens.Count == 0)
-                    {
-
-                        CurrentNodeCount += 1;
-                    }
-                    else
+                    if (this.rootNode.SelectedItem is DataNode currNode)
                     {
-                        CountNode(node);
+                        if (currNode.Sno == "root")
+                        {
+                        }
+                        else
+                        {
+                            var data = InDataNodes.FirstOrDefault(d => d.EId == currNode.EId);
+                            if (data != null)
+                            {
+                                Draw(data);
+                                RevitModelFileUpload.ShowSpaceProperty(data.EId);
+                            }
+                        }
                     }
-                }
-            }
-
-        }
-
-        /// <summary>
-        /// 将数据画呈现到窗体
-        /// </summary>
-        /// <param name="dn"></param>
-        private void DrawData(DataNode dn)
-        {
-
-            CountNode(dn);
-            double y;
-            if (dn.Childrens.Count > 0)
-            {
-                y = ((CurrentNodeCount) / 2.0d + 1 + level) * PerHeight;
-            }
-            else
-            {
-                y = (CurrentNodeCount + 1 + level) * PerHeight;
-            }
-
-            var vertex = GetVertex(dn, y);
-
-            if (dn.Parent != null)//连接父节点
-            {
-                var turningPoint = new Point(dn.Postition.X - 100, dn.Postition.Y);
-                var turningLine = new SgLine(turningPoint, dn.Postition);
-
-                //备电使用虚线
-                if (!string.IsNullOrEmpty(dn.InLineNo1))
-                {
-                    ConvertToDotLine(turningLine);
-                }
-            }
-            // dn.GetLines().ForEach((d) => m_canvas.Children.Add(d));
-            CurrentNodeCount = 0;
-            if (dn.Childrens.Count == 0) level += 1;
-
-            string Sno(DataNode d)
-            {
-                var no = Regex.Match(d.Sno, "\\d+$").Value;
-                return string.IsNullOrEmpty(no) ? "0" : no;
-            }
-
-            foreach (var d in dn.Childrens.OrderBy(t => t.FloorName).ThenBy(t => int.Parse(Sno(t))).ToList())
-            {
-
-                d.Parent = dn;
-                DrawData(d);
-            }
-        }
-
-        SgLine ConvertToDotLine(SgLine l)
-        {
-            l.StrokeThickness = 2;
-            l.StrokeDashArray = new DoubleCollection() { 2, 3 };
-            l.StrokeDashCap = PenLineCap.Triangle;
-            l.StrokeEndLineCap = PenLineCap.Square;
-            l.StrokeStartLineCap = PenLineCap.Round;
-            return l;
-        }
-        Vertex GetVertex(DataNode dn, double y = double.MaxValue)
-        {
-            var v = y == double.MaxValue ? dn.GetVertex() : dn.GetVertex(y);
-            v.ShowAction = (eid) =>
-            {
-
-                //显示属性窗体
-                RevitModelFileUpload.ShowSpaceProperty(dn.EId);
-
-            };
-            return v;
-        }
-
-        private delegate void NoArgDelegate();
-        private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
-        {
-            Dispatcher.BeginInvoke(DispatcherPriority.Background,
-  (NoArgDelegate)delegate
-  {
-      if (this.rootNode.SelectedItem is DataNode currNode)
-      {
-          if (currNode.Sno == "root")
-          {
-          }
-          else
-          {
-              var data = InDataNodes.FirstOrDefault(d => d.EId == currNode.EId);
-              if (data != null)
-              {
-                  level = 0;
-                  Draw(data);
-                  RevitModelFileUpload.ShowSpaceProperty(data.EId);
-              }
-          }
-      }
-  });
+                });
         }
     }
 }

+ 26 - 128
MBI/SAGA.GplotDrawData/WinEquipmentRelation-Web.xaml.cs

@@ -22,7 +22,7 @@ namespace SAGA.GplotDrawData
     {
         public WinEquipmentRelation_Web()
         {
-              InitializeComponent();
+            InitializeComponent();
             this.Loaded += MainWindow_Loaded;
         }
 
@@ -30,12 +30,14 @@ namespace SAGA.GplotDrawData
         private bool m_isReadData = true;
         private List<DataNode> dataNodes;
         private List<DataNode> orphanNodes;
+
         public WinEquipmentRelation_Web(List<DataNode> dataNodes, List<DataNode> orphanNodes) : this()
         {
             this.dataNodes = dataNodes;
             this.orphanNodes = orphanNodes;
             m_isReadData = false;
         }
+
         public UcGplotShow UcShow => ucShowElement;
 
         public void ReLoad(List<DataNode> dataNodes, List<DataNode> orphanNodes)
@@ -44,15 +46,15 @@ namespace SAGA.GplotDrawData
             this.orphanNodes = orphanNodes;
             MainWindow_Loaded(null, null);
         }
+
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
         {
             if (m_isReadData)
             {
 
+                #region 自定义读取
                 var dataNodes = DbHelper.FindOneByFile<DataNode>();
                 DataNode root = new DataNode("低压配电图") { Sno = "root", FloorName = "1" };
-
-
                 dataNodes.Childrens.ForEach(d =>
                 {
                     //if (d.Type != "母联柜")
@@ -69,10 +71,12 @@ namespace SAGA.GplotDrawData
                 });
 
                 this.InDataNodes = new ObservableCollection<DataNode>(dataNodes.Childrens);
-                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root };
+                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root }; 
+                #endregion
             }
             else
             {
+                #region 整理显示数据
                 DataNode root = new DataNode("低压配电图") { Sno = "root", FloorName = "1" };
                 var orphan = new DataNode("孤立节点") { Sno = "orphan", FloorName = "2" };
                 //配电箱
@@ -86,7 +90,6 @@ namespace SAGA.GplotDrawData
 
                 dataNodes.ForEach(d =>
                 {
-
                     root.Childrens.Add(new DataNode(d.EName)
                     {
                         EId = d.EId,
@@ -95,8 +98,6 @@ namespace SAGA.GplotDrawData
                         InLineNo = d.InLineNo,
                         FloorName = d.FloorName
                     });
-
-
                 });
 
                 orphanNodes.ForEach(d =>
@@ -129,138 +130,35 @@ namespace SAGA.GplotDrawData
                 orphan.Childrens = orphan.Childrens.OrderBy(t => t.FloorName).ToList();
                 orphan.Childrens[0].Childrens = orphan.Childrens[0].Childrens.OrderBy(t => t.FloorName).ToList();
                 orphan.Childrens[1].Childrens = orphan.Childrens[1].Childrens.OrderBy(t => t.FloorName).ToList();
-                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root, orphan };
-
-                DrawRootNode(root);
+                this.rootNode.ItemsSource = new ObservableCollection<DataNode> { root, orphan }; 
+                #endregion
             }
         }
-        List<UIElement> m_rootElements = new List<UIElement>();
-
-        void DrawRootNode(DataNode dn)
-        {
-
-        }
-        private int CurrentNodeCount = 0;
-        private int level = 0;
-        private double PerHeight;
-
-        void Draw(DataNode dn)
-        {
-            CountNode(dn);
-            CurrentNodeCount = 0;
-            dn.Postition = new Point(100, 0);
-            DrawData(dn);
-        }
-        /// <summary>
-        /// 计算节点总数
-        /// </summary>
-        /// <param name="dn"></param>
-        void CountNode(DataNode dn)
+        private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
         {
-            System.Diagnostics.Debug.WriteLine(dn.EName + ":" + dn.Type + ":" + dn.Sno);
-            if (dn.Childrens.Count > 0)
+            Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action) delegate
             {
-                foreach (var node in dn.Childrens)
+                if (this.rootNode.SelectedItem is DataNode currNode)
                 {
-                    if (node.Childrens.Count == 0)
+                    if (currNode.Sno == "root")
                     {
-
-                        CurrentNodeCount += 1;
+                        // this.m_rootElements.ForEach(t => this.Canvas.Children.Add(t));
                     }
                     else
                     {
-                        CountNode(node);
+                        var data = InDataNodes.FirstOrDefault(d => d.EId == currNode.EId);
+                        if (data != null)
+                        {
+                            EquipmentGraphView view = new EquipmentGraphView();
+                            var db = view.CreateDb(data);
+                            ConstData.ResponseData = db.CreateJObjectGroup();
+                            ucShowElement.Show(WebGplotSettings.MindMapUrl);
+                            //显示属性窗体
+                            RevitModelFileUpload.ShowSpaceProperty(data.EId);
+                        }
                     }
                 }
-            }
-
-        }
-        private void DrawData(DataNode dn)
-        {
-
-            CountNode(dn);
-            double y;
-            if (dn.Childrens.Count > 0)
-            {
-                y = ((CurrentNodeCount) / 2.0d + 1 + level) * PerHeight;
-            }
-            else
-            {
-                y = (CurrentNodeCount + 1 + level) * PerHeight;
-            }
-
-            var vertex = GetVertex(dn, y);
-
-
-
-            // dn.GetLines().ForEach((d) => m_canvas.Children.Add(d));
-            CurrentNodeCount = 0;
-            if (dn.Childrens.Count == 0) level += 1;
-
-            string Sno(DataNode d)
-            {
-                var no = Regex.Match(d.Sno, "\\d+$").Value;
-                return string.IsNullOrEmpty(no) ? "0" : no;
-            }
-
-            foreach (var d in dn.Childrens.OrderBy(t => t.FloorName).ThenBy(t => int.Parse(Sno(t))).ToList())
-            {
-
-                d.Parent = dn;
-                DrawData(d);
-            }
-        }
-
-        SgLine ConvertToDotLine(SgLine l)
-        {
-            l.StrokeThickness = 2;
-            l.StrokeDashArray = new DoubleCollection() { 2, 3 };
-            l.StrokeDashCap = PenLineCap.Triangle;
-            l.StrokeEndLineCap = PenLineCap.Square;
-            l.StrokeStartLineCap = PenLineCap.Round;
-            return l;
-        }
-        Vertex GetVertex(DataNode dn, double y = double.MaxValue)
-        {
-            var v = y == double.MaxValue ? dn.GetVertex() : dn.GetVertex(y);
-            v.ShowAction = (eid) =>
-            {
-
-                //显示属性窗体
-                RevitModelFileUpload.ShowSpaceProperty(dn.EId);
-
-            };
-            return v;
-        }
-
-        private delegate void NoArgDelegate();
-        private void RootNode_OnSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
-        {
-            Dispatcher.BeginInvoke(DispatcherPriority.Background, (NoArgDelegate)delegate
-   {
-       if (this.rootNode.SelectedItem is DataNode currNode)
-       {
-           if (currNode.Sno == "root")
-           {
-               // this.m_rootElements.ForEach(t => this.Canvas.Children.Add(t));
-           }
-           else
-           {
-               var data = InDataNodes.FirstOrDefault(d => d.EId == currNode.EId);
-               if (data != null)
-               {
-                   level = 0;
-                   Draw(data);
-                   EquipmentGraphView view = new EquipmentGraphView();
-                   var db = view.CreateDb(data);
-                   ConstData.ResponseData = db.CreateJObjectGroup();
-                   ucShowElement.Show(WebGplotSettings.MindMapUrl);
-                   //显示属性窗体
-                   RevitModelFileUpload.ShowSpaceProperty(data.EId);
-               }
-           }
-       }
-   });
+            });
         }
     }
 

+ 0 - 1
MBI/SAGA.GplotManage/GplotManage/GplotParse/GplotParse.cs

@@ -118,7 +118,6 @@ namespace SAGA.GplotManage
                 return true;
             //集合比较
             List<string> ids = changeIds ?? new List<string>();
-            //todo 获取日志文件集合
             if (ids.Intersect(parseData.RefIds).Any())
                 return true;
             return false;

+ 37 - 728
MBI/SAGA.GplotRelationComputerManage/Command.cs

@@ -16,6 +16,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
+using SAGA.GplotRelationComputerManage;
 using MainWindow = SAGA.GplotDrawData.MainWindow;
 
 namespace SAGA.GplotRelationComputerManage
@@ -58,227 +59,38 @@ namespace SAGA.GplotRelationComputerManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            var result = ComputerFromServer();
-            if (result[0].Childrens.Count > 0)
+
+            #region 核心
+            try
             {
-                // MainWindow window = new MainWindow(result[0].Childrens, result[1].Childrens);
-             
-                //window.UcShow.ComputerAction = () =>
-                //{
-                //    result = ComputerFromServer();
-                //    window.ReLoad(result[0].Childrens, result[1].Childrens);
-                //};
-                //window.Title = "配电拓扑图:配电柜--配电柜";
-                //window.Show();
-               
-                if (result[0].Childrens.Any())
+                DistributionRelationshipHandler handler = new DistributionRelationshipHandler();
+                var re = handler.GetViewData(new PowerComputerContext());
+                if (re[0].Childrens.Any())
                 {
-                    WinEquipmentRelation_Web window = new WinEquipmentRelation_Web(result[0].Childrens, result[1].Childrens);
+                    WinEquipmentRelation_Web window =
+                        new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
                     window.Title = "配电拓扑图:配电柜--配电柜";
                     window.Show();
                 }
-            }
-            return Result.Succeeded;
-        }
-
-        /// <summary>
-        /// 计算
-        /// </summary>
-        public void Computer()
-        {
-            ComputerFromServer();
-        }
-        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
-        {
-            return true;
-        }
-
-        private Dictionary<string, string> floorNameAndId;
-        /// <summary>
-        /// 计算服务端配电
-        /// </summary>
-        public List<DataNode> ComputerFromServer()
-        {
-            var str = new[] { "TDHS", "TDLS", "TDTF", "TDLSDW" };
-            List<JObject> datas = CommonConvert.QueryObjectInfoByTypes(str);
-            var result = new List<DataNode>();
-            floorNameAndId = DalProjectTree.GetFloorNameAndId();
-            var allDataNodes = ConvertToDataNode(datas);
-
-            DealServerDatas(allDataNodes);
-            //独立树形:有子节点,父节点为空
-            var incomingCabinet = allDataNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
-            //孤立节点:无父无子
-            var orphanNodes = allDataNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
-            DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "LUDistribution");
 
-
-            result.Add(new DataNode() { Childrens = incomingCabinet });
-            result.Add(new DataNode() { Childrens = orphanNodes });
-            return result;
-        }
-        public void SaveData(List<DataNode> datas)
-        {
-            var orphanNodes = DealDatas(datas, out var incomingCabinet);
-            if (incomingCabinet.Count > 0)
-            {
-                //将数据保存到数据库
-                DataNode dn = new DataNode("低压配电");
-                incomingCabinet.ToList().ForEach(t => dn.Childrens.Add(t));
-                DbHelper.SaveAsFile<DataNode>(dn);
-            }
-        }
-        private List<DataNode> DealDatas(List<DataNode> familyInstances, out List<DataNode> incomingCabinet)
-        {
-            var allDataNodes = familyInstances;
-            //无信息节点的孤儿节点
-            var orphanNodes = allDataNodes.Where(t => t.Sno == "" || t.Type == "" || t.EName == "").ToList();
-            //正常数据
-            var dataNodes = allDataNodes.Where(t => t.Sno != "" && t.Type != "" && t.EName != "").ToList();
-            //找出所有出线柜(outgoingCubicle)
-            //找出所有进线柜
-            incomingCabinet = dataNodes.Where(t => t.Type == "进线柜" || t.Type == "母联柜").ToList();
-            //总数据里面移除所有进线柜,并移除进线柜中非根节点的进线柜(进线柜的进线号为变压器)
-            for (var i = 0; i < incomingCabinet.Count; i++)
-            {
-                var node = incomingCabinet[i];
-                if ((dataNodes.Any(t => t.Sno == node.InLineNo && t.Type == "低压变压器") || node.Type == "母联柜" ||
-                     node.InLineNo == "") && node.EName != "")
-                {
-                    dataNodes.Remove(node);
-                }
-                else
-                {
-                    incomingCabinet.Remove(node);
-                    i--;
-                }
             }
-            //incomingCabinet.ForEach(d => );
-            //List<DataNode> incomingCabinetNode =
-            incomingCabinet.ForEach(d =>
+            catch (Exception ex)
             {
-                if (d.Type != "母联柜")
-                {
-                    GetRelationNode(d, dataNodes);
-                }
-                RemoveNode(d, dataNodes); //剩余的节点中去除已成数列的节点
-            });
 
-            //剩余节点中找到进线号不存在或者为空的节点,作为孤立点的子节点
-            var oroot = dataNodes.Where(t => t.InLineNo == "" || dataNodes.All(o => o.Sno != t.InLineNo)).ToList();
-            oroot.ForEach(d => { GetRelationNode(d, dataNodes); });
-            orphanNodes.AddRange(oroot);
-            return orphanNodes;
-        }
-        private void DealServerDatas(List<DataNode> familyInstances)
-        {
-            var count = familyInstances.Count;
-            for (int i = 0; i < familyInstances.Count; i++)
-            {
-                var dn = familyInstances[i];
-                GetRelationNodes(dn, familyInstances);
-            }
-        }
-        public List<DataNode> ConvertToDataNode(List<JObject> datas)
-        {
-            var allDataNodes = datas.Select(f =>
-            {
-                var node = new DataNode(GetValue(f, "EquipLocalName"))//设备本地名称,  
-                {
-                    EId = GetValue(f, "EquipID"),
-                    Sno = GetValue(f, "EquipLocalID"),//设备本地编码
-                    InLineNo = GetValue(f, "ctm-MainPower"), //进线号,主电
-                    InLineNo1 = GetValue(f, "ctm-StandbyPower"), //进线号,主电
-                    FloorName = GetFloorNameByBimId(GetValue(f, "BIMID")), //+                                //+ f.GetParameterString("所属柜号"),
-                    Infos = f,
-                    Type = (f["category"] + "").Remove(0, 2)//设备类型编码 
-                };
-
-                return node;
-            });
-            return allDataNodes.ToList();
-        }
-        string GetFloorNameByBimId(string bimId)
-        {
-            if (string.IsNullOrEmpty(bimId)) return "";
-            var id = bimId.Split(':')[0];
-            if (floorNameAndId.ContainsKey(id))
-                return floorNameAndId[id];
-            return id;
-        }
-        public string GetValue(JObject equip, string propertyName)
-        {
-            string result = "";
-            if (equip != null)
-            {
-                result = equip["infos"][propertyName] + "";
-                //本地名称为空显示设备名称
-                if (propertyName == "EquipLocalName" && result == "")
-                {
-                    result = equip["infos"]["EquipName"] + "";
-                }
-            }
-
-            return result;
-        }
-        public List<DataNode> ConvertToDataNode(List<FamilyInstance> familyInstances)
-        {
-            var allDataNodes = familyInstances.Select(f =>
-            {
-                var node = new DataNode(f.GetParameterString("设备本地名称"))
-                {
-                    EId = f.Id.ToString(),
-                    Sno = f.GetParameterString("设备本地编码"),
-                    InLineNo = f.GetParameterString("进线号") + f.GetParameterString("所属柜号"),
-                    Type = f.GetFamilySymbol().Name
-                };
-                return node;
-            });
-            return allDataNodes.ToList();
-        }
-        void GetRelationNode(DataNode dn, List<DataNode> datas)
-        {
-            var nodes = datas.Where(t => t.InLineNo == dn.Sno).ToList();
-            if (nodes.Count > 0)
-            {
-                dn.Childrens.AddRange(nodes);
-                datas.Remove(dn);
-                foreach (var dataNode in nodes)
-                {
-                    GetRelationNode(dataNode, datas);
-                }
-            }
-        }
-        void GetRelationNodes(DataNode dn, List<DataNode> datas)
-        {
-            var nodes = datas.Where(t => t.InLineNo == dn.Sno && dn.Sno != "").ToList();
-            if (nodes.Count > 0 && dn.Childrens.Count == 0)
-            {
-                dn.Childrens.AddRange(nodes);
-
-                foreach (var dataNode in nodes)
-                {
-                    dataNode.Parent = dn;
-                    if (dataNode.Childrens.Count > 0) continue;//已查找过子节点
-                    GetRelationNodes(dataNode, datas);
-                }
-            }
+                MessageShow.Show(ex);
+            } 
+            #endregion
+            return Result.Succeeded;
         }
-        void RemoveNode(DataNode dn, List<DataNode> datas)
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
         {
-            datas.Remove(dn);
-            if (dn.Childrens.Count > 0)
-            {
-
-                foreach (var dataNode in dn.Childrens)
-                {
-                    RemoveNode(dataNode, datas);
-                }
-            }
+            return true;
         }
+      
     }
 
 
+
     /// <summary>
     /// 配电关系图--配电柜与配电设备
     /// </summary>
@@ -288,179 +100,23 @@ namespace SAGA.GplotRelationComputerManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            var result = ComputerFromServer();
-            //if (result[0].Childrens.Count > 0)
-            //{
-            //    MainWindow window = new MainWindow(result[0].Childrens, result[1].Childrens);
-            //    window.UcShow.ComputerAction = () =>
-            //     {
-            //         result = ComputerFromServer();
-            //         window.ReLoad(result[0].Childrens, result[1].Childrens);
-            //     };
-            //    window.Title = "配电拓扑图:配电柜--末端";
-            //    window.Show();
-            //}
-            if (result[0].Childrens.Any())
+            #region 核心处理
+            EquipPowerRelationshipHandler handler = new EquipPowerRelationshipHandler();
+            var re = handler.GetViewData(new PowerComputerContext());
+            if (re[0].Childrens.Any())
             {
-                WinEquipmentRelation_Web window = new WinEquipmentRelation_Web(result[0].Childrens, result[1].Childrens);
+                WinEquipmentRelation_Web window =
+                    new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
                 window.Title = "配电拓扑图:配电柜--末端";
                 window.Show();
-            }
-         
+            } 
+            #endregion
             return Result.Succeeded;
-        }
-
-        /// <summary>
-        /// 计算
-        /// </summary>
-        public void Computer()
-        {
-            ComputerFromServer();
-        }
+        }    
         public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
         {
             return true;
         }
-        /// <summary>
-        /// 计算服务端配电
-        /// </summary>
-        public List<DataNode> ComputerFromServer()
-        {
-            List<DataNode> result = new List<DataNode>();
-            //查询所有设备
-            var str = new string[] { "Eq", "Si" };//元空间为Si
-            List<JObject> datas = CommonConvert.QueryObjectInfoByTypes(str);
-            floorNameAndId = DalProjectTree.GetFloorNameAndId();
-            var allDataNodes = ConvertToDataNode(datas);
-            DealServerDatas(allDataNodes);
-
-            //查询低压开关柜,有父级的去掉。此功能只查看或检测有配电柜与设备的关系
-            allDataNodes = allDataNodes.Where(t => t.Childrens.Count == 0 || t.Childrens.Any(n => n.Type != "TDLS"))
-                .ToList();
-            var incomingCabinet = allDataNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
-            var orphanNodes = allDataNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
-
-            //保存数据
-            DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "EquipPower");
-            result.Add(new DataNode() { Childrens = incomingCabinet });
-            result.Add(new DataNode() { Childrens = orphanNodes });
-            return result;
-        }
-    
-        /// <summary>
-        /// 处理配电数据
-        /// </summary>
-        /// <param name="familyInstances"></param>
-        private void DealServerDatas(List<DataNode> familyInstances)
-        {
-            var tdls = familyInstances.Where(t => t.Type == "TDLS").ToList();
-            var eqs = familyInstances.Where(t => t.Type != "TDLS").ToList();
-            foreach (var dn in tdls)
-            {
-                GetRelationNodes(dn, eqs);
-            }
-        }
-
-        /// <summary>
-        /// 转换数据
-        /// </summary>
-        /// <param name="datas"></param>
-        /// <returns></returns>
-        public List<DataNode> ConvertToDataNode(List<JObject> datas)
-        {
-            //参与配电拓扑计算的必须是配置主电自定义信息点的设备
-            var allDataNodes = datas.Where(t => ((JObject)t["infos"]).Property("ctm-MainPower") != null).Select(f =>
-             {
-                 DataNode node;
-                 //空间
-                 if (((JObject)f["infos"]).Property("RoomID") != null)
-                 {
-                     node = new DataNode(GetValue(f, "RoomLocalName"))//设备本地名称,  
-                     {
-                         EId = GetValue(f, "RoomID"),
-                         Sno = "",// GetValue(f, "EquipLocalID"),//设备本地编码
-                         InLineNo = GetValue(f, "ctm-MainPower"), //进线号,主电
-                         InLineNo1 = GetValue(f, "ctm-StandbyPower"), //进线号,主电
-                         FloorName = GetFloorNameByBimId(GetValue(f, "BIMID")), //+ f.GetParameterString("所属柜号"),
-                         Type = "Si",//设备类型编码 
-                         Infos = f
-                     };
-                 }
-                 else
-                 {
-                     node = new DataNode(GetValue(f, "EquipLocalName"))//设备本地名称,  
-                     {
-                         EId = GetValue(f, "EquipID"),
-                         Sno = GetValue(f, "EquipLocalID"),//设备本地编码
-                         InLineNo = GetValue(f, "ctm-MainPower").Split(' ')[0], //进线号,主电
-                         InLineNo1 = GetValue(f, "ctm-StandbyPower"), //进线号,主电
-                         FloorName = GetFloorNameByBimId(GetValue(f, "BIMID")), //+                                          //+ f.GetParameterString("所属柜号"),
-                         Type = (f["category"] + "").Remove(0, 2),//设备类型编码 
-                         Infos = f
-                     };
-                 }
-
-                 return node;
-             });
-            return allDataNodes.ToList();
-        }
-
-        /// <summary>
-        /// 获取属性值
-        /// </summary>
-        /// <param name="equip"></param>
-        /// <param name="propertyName"></param>
-        /// <returns></returns>
-        public string GetValue(JObject equip, string propertyName)
-        {
-            return RelationshipTools.GetValue(equip,propertyName);
-        }
-        /// <summary>
-        /// 楼层名称与ID对应字典
-        /// </summary>
-        private Dictionary<string, string> floorNameAndId;
-
-        /// <summary>
-        /// 根据Id获取楼层名称
-        /// </summary>
-        /// <param name="bimId"></param>
-        /// <returns></returns>
-        string GetFloorNameByBimId(string bimId)
-        {
-            {
-                if (string.IsNullOrEmpty(bimId)) return "";
-                var id = bimId.Split(':')[0];
-                if (floorNameAndId.ContainsKey(id))
-                    return floorNameAndId[id];
-                return id;
-            }
-        }
-
-        /// <summary>
-        /// 处理对应关系
-        /// </summary>
-        /// <param name="dn"></param>
-        /// <param name="datas"></param>
-        void GetRelationNodes(DataNode dn, List<DataNode> datas)
-        {
-            var nodes = datas.Where(t => (t.InLineNo == dn.Sno || t.InLineNo1 == dn.Sno) && dn.Sno != "").ToList();
-            if (nodes.Count > 0 && dn.Childrens.Count == 0)
-            {
-                dn.Childrens.AddRange(nodes);
-
-                foreach (var dataNode in nodes)
-                {
-                    dataNode.Parent = dn;
-                    if (dataNode.Childrens.Count > 0) continue;
-                    GetRelationNodes(dataNode, datas);
-                }
-            }
-            else
-            {//移除已有父节点的叶子节点
-                if (dn.Parent != null)
-                    datas.Remove(dn);
-            }
-        }
     }
 
 
@@ -473,373 +129,26 @@ namespace SAGA.GplotRelationComputerManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            var result = ComputerFromServer();
-            if (result[0].Childrens.Count > 0)
+
+            #region 核心处理
+            ObjectControlRelationshipHandler handler = new ObjectControlRelationshipHandler();
+            var re = handler.GetViewData(new PowerComputerContext());
+            if (re[0].Childrens.Any())
             {
-                //WinControlRelation window = new WinControlRelation(result[0].Childrens, result[1].Childrens);
-                WinControlRelation_Web window = new WinControlRelation_Web(result[0].Childrens, result[1].Childrens);
-                
-                //window.ComputerAction = () =>
-                //{
-                //    result = ComputerFromServer();
-                //    window.ReLoad(result[0].Childrens, result[1].Childrens);
-                //};
+                WinControlRelation_Web window =
+                    new WinControlRelation_Web(re[0].Childrens, re[1].Childrens);
                 window.Title = "对象受控关系图";
                 window.Show();
-            }
+            } 
+            #endregion
+
             return Result.Succeeded;
         }
 
-        public void Computer()
-        {
-            ComputerFromServer();
-        }
         public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
         {
             return true;
         }
-        /// <summary>
-        /// 计算服务端配电
-        /// </summary>
-        public List<DataNode> ComputerFromServer()
-        {
-            List<DataNode> result = new List<DataNode>();
-            //查询所有设备
-            //  var str = new string[] { "Eq", "BACP","BANC" };
-            var str = new string[] { "BACP", "BANC" };
-            List<JObject> ctrollersDatas = CommonConvert.QueryObjectInfoByTypes(str);
-            var eqs = CommonConvert.QueryObjectInfoByTypes(new[] { "Eq" });
-            floorNameAndId = DalProjectTree.GetFloorNameAndId();
-            var cotrollersNodes = ConvertToDataNode(ctrollersDatas);
-            var eqsNodes = ConvertEqToDataNode(eqs);
-
-
-            foreach (var dn in cotrollersNodes)
-            {
-                GetRelationNodes(dn, eqsNodes);
-            }
-
-            //查询低压开关柜,有父级的去掉。此功能只查看或检测有配电柜与设备的关系
-            cotrollersNodes = cotrollersNodes.Where(t => t.Childrens.Count == 0 || t.Childrens.Any(n => n.Type != "TDLS"))
-                .ToList();
-            var incomingCabinet = cotrollersNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
-
-            var orphanNodes = eqsNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
-            orphanNodes.AddRange(cotrollersNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList());
-
-            //保存数据到本地
-            DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "ControlRelation");
-            result.Add(new DataNode() { Childrens = incomingCabinet });
-            result.Add(new DataNode() { Childrens = orphanNodes });
-            return result;
-        }
-
-        /// <summary>
-        /// 转换数据
-        /// </summary>
-        /// <param name="datas"></param>
-        /// <returns></returns>
-        public List<DataNode> ConvertEqToDataNode(List<JObject> datas)
-        {
-            //参与配电拓扑计算的必须是配置主电自定义信息点的设备
-            var allDataNodes = datas.Where(t => ((JObject)t["infos"]).Property("ctm-MainCtrl") != null).Select(f =>
-             {
-                 DataNode node;
-
-                 node = new DataNode(GetValue(f, "EquipLocalName"))//设备本地名称,  
-                 {
-                     EId = GetValue(f, "EquipID"),
-                     Sno = GetValue(f, "EquipLocalID"),//设备本地编码
-                     InLineNo = GetValue(f, "ctm-MainCtrl").Split(' ')[0], //进线号,主电
-                     InLineNo1 = GetValue(f, "ctm-StandbyCtrl"), //进线号,主电
-                     FloorName = GetFloorNameByBimId(GetValue(f, "BIMID")), //+                                          //+ f.GetParameterString("所属柜号"),
-                     Type = (f["category"] + "").Remove(0, 2),//设备类型编码 
-                     Infos = f
-                 };
-
-                 return node;
-             });
-            return allDataNodes.ToList();
-        }
-
-        public static string GetValue(JObject equip, string propertyName)
-        {
-            return RelationshipTools.GetValue(equip, propertyName);
-        }
-
-        public List<DataNode> ConvertToDataNode(List<JObject> datas)
-        {
-            //参与配电拓扑计算的必须是配置主电自定义信息点的设备
-            var allDataNodes = datas.Select(f =>
-             {
-                 DataNode node;
-
-                 node = new DataNode(GetValue(f, "EquipLocalName"))//设备本地名称,  
-                 {
-                     EId = GetValue(f, "EquipID"),
-                     Sno = GetValue(f, "EquipLocalID"),//设备本地编码
-                     InLineNo = GetValue(f, "ctm-MainCtrl").Split(' ')[0], //进线号,主电
-                     InLineNo1 = GetValue(f, "ctm-StandbyCtrl"), //进线号,主电
-                     FloorName = GetFloorNameByBimId(GetValue(f, "BIMID")), //+                                          //+ f.GetParameterString("所属柜号"),
-                     Type = (f["category"] + "").Remove(0, 2),//设备类型编码 
-                     Infos = f
-                 };
-
-                 return node;
-             });
-            return allDataNodes.ToList();
-        }
-
-
-        private Dictionary<string, string> floorNameAndId;
-        string GetFloorNameByBimId(string bimId)
-        {
-            {
-                if (string.IsNullOrEmpty(bimId)) return "";
-                var id = bimId.Split(':')[0];
-                if (floorNameAndId.ContainsKey(id))
-                    return floorNameAndId[id];
-                return id;
-            }
-        }
-        void GetRelationNodes(DataNode dn, List<DataNode> datas)
-        {
-            var nodes = datas.Where(t => (t.InLineNo == dn.Sno || t.InLineNo1 == dn.Sno) && dn.Sno != "").ToList();
-            if (nodes.Count > 0 && dn.Childrens.Count == 0)
-            {
-                dn.Childrens.AddRange(nodes);
-
-                foreach (var dataNode in nodes)
-                {
-                    dataNode.Parent = dn;
-                    if (dataNode.Childrens.Count > 0) continue;
-                    GetRelationNodes(dataNode, datas);
-                }
-            }
-            else
-            {//移除已有父节点的叶子节点
-                if (dn.Parent != null)
-                    datas.Remove(dn);
-            }
-        }
-    }
-
-    
-    /// <summary>
-    /// 参数设置
-    /// </summary>
-    [Transaction(TransactionMode.Manual)]
-    [Regeneration(RegenerationOption.Manual)]
-    public class SettingCommand : ExternalCommand
-    {
-        public SettingCommand()
-        {
-            IsShowNoDocument = true;
-        }
-
-        private Document linkDoc;
-        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
-        {
-            base.Execute(commandData, ref message, elements);
-            var uiApp = ExternalDataWrapper.Current.UiApp;
-            //打开所有楼层数据
-            var fileInfos = RevitModelPath.GetAllRevitFiles();
-            //所有项目中所有文档
-            //  Document linkDoc = uiApp.Application.OpenDocumentFile(@"C:\Users\sagacloud\Documents\项目1.rvt");
-            linkDoc = ExternalDataWrapper.Current.Doc;
-            using (Transaction trans = new Transaction(linkDoc, "读取风管系统"))
-            {
-                trans.Start();
-                try
-                {
-                    var element = uiApp.PickElement("选择空间", typeof(SpatialElement));
-                    //  GplotRelationComputerManage.ReadSpaceCommand cmd = new ReadSpaceCommand();
-
-                    //   type = linkDoc.GetElements<ConduitType>().FirstOrDefault();
-
-                    List<Space> rooms = linkDoc.GetElements<SpatialElement>().OfType<Space>().ToList();
-                    // var zls = new ReleSpace(rooms.FirstOrDefault(t => t.Id.IntegerValue==329732)
-                    //);
-                    if (element is Space space)
-                    {
-                        var zls = rooms.FirstOrDefault();
-                        var curves = zls.GetBoundaryCurves();
-                        var combin = curves;// CombinCurves(curves);
-                                            //foreach (var curve in combin)
-                                            //{
-                                            //    curve.NewDetailCurve();
-                                            //}
-
-                        ReadSpaceCommand cmd = new ReadSpaceCommand();
-                        var s = cmd.ConvertSpace(space);
-                        foreach (var edgeInfo in s)
-                        {
-                            var line = edgeInfo.SegEdge.NewDetailCurve();
-
-                        }
-                        //zls.DoorLocation = zls.RoomCenter;
-                        //level = zls.Room.Level;
-                        //cmd.Test(zls, rooms);
-                        //Connection(zls);
-                    }
-                    else
-                    {
-                        var zls = rooms.FirstOrDefault();
-                        //  var curves = zls.GetBoundaryCurves();
-                        //var combin = curves;// CombinCurves(curves);
-                        foreach (var ss in rooms)
-                        {
-                            ReadSpaceCommand cmd = new ReadSpaceCommand();
-                            var s = cmd.ConvertSpace(ss);
-                            foreach (var edgeInfo in s)
-                            {
-                                var line = edgeInfo.SegEdge.NewDetailCurve();
-
-                            }
-
-                        }
-                    }
-
-                    trans.Commit();
-                }
-                catch (Exception ex)
-                {
-                    MessageBox.Show(ex.StackTrace);
-                    trans.RollBack();
-                }
-
-                return Result.Succeeded;
-            }
-        }
-        public List<Curve> CombinCurves(List<Curve> closeCurves)
-        {
-            List<Curve> curves = new List<Curve>();
-            var first = closeCurves.FirstOrDefault();
-            closeCurves.Remove(first);
-            var start = first.StartPoint();
-            var end = first.EndPoint();
-            while (closeCurves.Count > 0)
-            {
-                var second = closeCurves.FirstOrDefault(t => t.StartPoint().IsEqual(start) || t.EndPoint().IsEqual(start));
-                if (second == null) return curves;
-                if (first.IsParallel(second)) //平行且共点合并
-                {
-                    start = start.IsEqual(second.StartPoint()) ? second.EndPoint() : second.StartPoint();
-                    //拼接成新的直线
-                    curves.Add(start.NewLine(end));
-                }
-                else
-                {
-                    end = start;
-                    start = start.IsEqual(second.StartPoint()) ? second.EndPoint() : second.StartPoint();
-                    curves.Add(second);
-                }
-                closeCurves.Remove(second);
-            }
-
-            return curves;
-        }
-    }
-
-    /// <summary>
-    /// 参数设置
-    /// </summary>
-    [Transaction(TransactionMode.Manual)]
-    [Regeneration(RegenerationOption.Manual)]
-    public class GetBoundSegsCommand : ExternalCommand
-    {
-        public GetBoundSegsCommand()
-        {
-            IsShowNoDocument = true;
-        }
-
-        private Document linkDoc;
-
-        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
-        {
-            base.Execute(commandData, ref message, elements);
-            var uiApp = ExternalDataWrapper.Current.UiApp;
-            //打开所有楼层数据
-            var fileInfos = RevitModelPath.GetAllRevitFiles();
-            //所有项目中所有文档
-            //  Document linkDoc = uiApp.Application.OpenDocumentFile(@"C:\Users\sagacloud\Documents\项目1.rvt");
-            linkDoc = ExternalDataWrapper.Current.Doc;
-            using (Transaction trans = new Transaction(linkDoc, "读取风管系统"))
-            {
-                trans.Start();
-                try
-                {
-                    var element = uiApp.PickElement("选择空间", typeof(SpatialElement));
-                    //  GplotRelationComputerManage.ReadSpaceCommand cmd = new ReadSpaceCommand();
-
-                    //   type = linkDoc.GetElements<ConduitType>().FirstOrDefault();
-
-                    List<Space> rooms = linkDoc.GetElements<SpatialElement>().OfType<Space>().ToList();
-                    // var zls = new ReleSpace(rooms.FirstOrDefault(t => t.Id.IntegerValue==329732)
-                    //);
-                    if (element is Space space)
-                    {
-                        var zls = rooms.FirstOrDefault();
-                        var curves = zls.GetBoundaryCurves();
-                        var combin = curves; // CombinCurves(curves);
-                        //foreach (var curve in combin)
-                        //{
-                        //    curve.NewDetailCurve();
-                        //}
-
-                        ReadSpaceCommand cmd = new ReadSpaceCommand();
-                        var s = cmd.ConvertSpace(space);
-                        foreach (var edgeInfo in s)
-                        {
-                            var line = edgeInfo.SegEdge.NewDetailCurve();
-
-                        }
-
-                        //zls.DoorLocation = zls.RoomCenter;
-                        //level = zls.Room.Level;
-                        //cmd.Test(zls, rooms);
-                        //Connection(zls);
-                    }
-                    else
-                    {
-                        var zls = rooms.FirstOrDefault();
-
-                        foreach (var room in rooms)
-                        {
-                            var curves = room.GetBoundarySegments(new SpatialElementBoundaryOptions());
-                            var combin = curves; // CombinCurves(curves);
-                            foreach (var curve in curves)
-                            {
-                                foreach (var boundarySegment in curve)
-                                {
-                                    var elem = linkDoc.GetElement(boundarySegment.ElementId);
-                                    if (elem is Wall wall)
-                                    {
-                                        var wallLine = wall.Location.GetCurve();
-                                        wallLine.NewDetailCurve();
-                                    }
-                                    else if (elem is ModelCurve modelCurve)
-                                    {
-                                        var wallLine = modelCurve.GetCurve();
-                                        wallLine.NewDetailCurve();
-                                    }
-
-                                }
-                            }
-                        }
-                    }
-
-                    trans.Commit();
-                }
-                catch (Exception ex)
-                {
-                    MessageBox.Show(ex.StackTrace);
-                    trans.RollBack();
-                }
-
-                return Result.Succeeded;
-            }
-        }
     }
 
     /// <summary>

+ 66 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/Common/DataNodeUtil.cs

@@ -0,0 +1,66 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:DataNodeUtil
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 14:51:29
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.Models;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    public class DataNodeUtil
+    {
+        public static void BuildNode(DataNode node, List<DataNode> sourceNodes)
+        {
+            //从上往下遍历可以控制父节点的范围
+            var isHandled = node.GetData<bool>();
+            node.SetData(true);
+            #region 结束条件
+            if (string.IsNullOrWhiteSpace(node.Sno))
+            {
+                return;
+            }
+            if (node.Childrens.Count != 0 ||isHandled)
+            {
+                return;
+            }
+            #endregion
+            #region 父子关系整理
+            var baseNo = node.Sno;
+            List<DataNode> mainNodes = new List<DataNode>();
+            List<DataNode> standbyNodes = new List<DataNode>();
+            foreach (var sourceNode in sourceNodes)
+            {
+                if (sourceNode.InLineNo == baseNo)
+                {
+                    sourceNode.Parent = node;
+                    mainNodes.Add(sourceNode);
+                }
+
+                if (sourceNode.InLineNo1 == baseNo)
+                {
+                    sourceNode.Parent = node;
+                    standbyNodes.Add(sourceNode);
+                }
+            }
+
+            node.Childrens.AddRange(mainNodes);
+            node.Childrens.AddRange(standbyNodes);
+            #endregion
+
+            #region 递归调用
+
+            foreach (var nodeChildren in node.Childrens)
+            {
+                BuildNode(nodeChildren, sourceNodes);
+            }
+            #endregion
+        }
+    }
+}

+ 90 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/Common/PowerComputerContext.cs

@@ -0,0 +1,90 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:PowerComputerContext
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 10:19:00
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SAGA.MBI.DataArrange;
+using SAGA.Models;
+using MBIEquipItem = SAGA.Models.EquipmentItem;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    /*
+     * 使用此类,可隔离计算。处理一些局部缓存的项;
+     * 备用:如果以后分层计算可以使用此类加入控制量
+     */
+    /// <summary>
+    /// 配电计算上下文
+    /// </summary>
+    public class PowerComputerContext
+    {
+        #region 楼层相关处理
+        private Dictionary<string,string> m_DicFloorNames { get; set; }
+        /// <summary>
+        /// 通过楼层id获取楼层名称
+        /// </summary>
+        /// <param name="floorId"></param>
+        /// <returns></returns>
+        public string GetFloorName(string floorId)
+        {
+            string name = floorId;
+            if (string.IsNullOrWhiteSpace(floorId))
+            {
+                return name;
+            }
+
+            if (m_DicFloorNames == null)
+            {
+                m_DicFloorNames= DalProjectTree.GetFloorNameAndId();
+            }
+
+            if (m_DicFloorNames == null)
+            {
+                return name;
+            }
+
+            m_DicFloorNames.TryGetValue(floorId, out name);
+            return (name??floorId)??string.Empty;
+        }
+        #endregion
+
+        #region 数据转换
+        /// <summary>
+        /// 转换成数据节点
+        /// </summary>
+        /// <param name="item"></param>
+        /// <returns></returns>
+        public DataNode ItemConvert(MBIItem item)
+        {
+            DataNode node = new DataNode(item.GetDisplay());
+            
+            node.EId = item.Id;
+            node.Sno = item.LocalId;//设备本地编码
+            node.InLineNo = item.CTM_MainPower?.Split(' ')[0];//进线号,主电
+            node.InLineNo1 = item.CTM_StandbyPower; //进线号,备电
+            node.FloorName = GetFloorName(item.FloorId);
+            if (item is MBIEquipItem mbiItem)
+            {
+                 node.Type = mbiItem.Category.Remove(0, 2);       
+            }
+            else
+            {
+                node.Type = MBIBuiltInCategory.Si;
+            }
+
+
+
+            //node.Infos =           
+            return node;
+        }
+
+        #endregion
+    }
+}

+ 79 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/DistributionRelationshipHandler.cs

@@ -0,0 +1,79 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:DistributionRelationshipHandler
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 10:34:41
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using SAGA.MBI.RequestData;
+using SAGA.Models;
+using MBIEquipItem = SAGA.Models.EquipmentItem;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    public class DistributionRelationshipHandler
+    {
+        /// <summary>
+        /// 获取解析数据源
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<MBIEquipItem> GetParseData(PowerComputerContext context)
+        {
+            List<MBIEquipItem> items = new List<MBIEquipItem>();         
+             var types = new[] { MBIBuiltInCategory.TDHS, MBIBuiltInCategory.TDLS, MBIBuiltInCategory.TDTF, MBIBuiltInCategory.TDLSDW };
+            List<JObject> equipDatas = CommonConvert.QueryObjectInfoByTypes(types);
+            foreach (var jobject in equipDatas)
+            {
+                var item = MBIItemFactory.Create<MBIEquipItem>(jobject);
+                if (item != null)
+                {
+                    items.Add(item);
+                }
+            }
+            return items;
+        }
+
+        /// <summary>
+        /// 获取显示数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<DataNode> GetViewData(PowerComputerContext context)
+        {
+          
+            var items = GetParseData(context);
+            var originNodes = items.Select(i => context.ItemConvert(i)).ToList();
+            foreach (var originNode in originNodes)
+            {
+                DataNodeUtil.BuildNode(originNode, originNodes);
+            }
+            //有子节点,顶级根节点
+            var incomingCabinet = originNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
+            //孤立节点
+            var orphanNodes = originNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
+            DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "LUDistribution");
+
+            List<DataNode> nodes = new List<DataNode>();
+            nodes.Add(new DataNode() { Childrens = incomingCabinet });
+            nodes.Add(new DataNode() { Childrens = orphanNodes });
+            return nodes;
+        }
+
+        /// <summary>
+        /// 获取计算数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<string> GetComputeData(PowerComputerContext context)
+        {
+            return null;
+        }
+    }
+}

+ 85 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/EquipPowerRelationshipHandler.cs

@@ -0,0 +1,85 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:EquipPowerRelationshipHandler
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 15:57:21
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using SAGA.MBI.RequestData;
+using SAGA.Models;
+using MBIEquipItem = SAGA.Models.EquipmentItem;
+namespace SAGA.GplotRelationComputerManage
+{
+    public class EquipPowerRelationshipHandler
+    {
+        /// <summary>
+        /// 获取解析数据源
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<MBIItem> GetParseData(PowerComputerContext context)
+        {
+            List<MBIItem> items = new List<MBIItem>();
+            var rootTypes = new[] {MBIBuiltInCategory.Eq, MBIBuiltInCategory.Si};
+            List<JObject> nodeDatas = CommonConvert.QueryObjectInfoByTypes(rootTypes);
+            foreach (var jobject in nodeDatas)
+            {
+                //排除没有设置主控线的设备
+                if (((JObject)jobject["infos"]).Property(MBIBuiltInParameter.CTM_MainPower) == null)
+                    continue;
+                var item = MBIItemFactory.Create(jobject);
+                if (item != null)
+                {
+                    items.Add(item);
+                }
+            }
+            return items;
+        }
+
+        /// <summary>
+        /// 获取显示数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<DataNode> GetViewData(PowerComputerContext context)
+        {
+
+            var items = GetParseData(context);
+            var originNodes = items.Select(i => context.ItemConvert(i)).ToList();
+            #region 构建树形结构
+            var tdls = originNodes.Where(t => t.Type ==MBIBuiltInCategory.TDLS).ToList();
+            var eqs = originNodes.Where(t => t.Type != MBIBuiltInCategory.TDLS).ToList();
+            foreach (var dn in tdls)
+            {
+                 DataNodeUtil.BuildNode(dn, eqs);
+            }
+            #endregion
+            var allDataNodes = originNodes.Where(t => t.Childrens.Count == 0 || t.Childrens.Any(n => n.Type != MBIBuiltInCategory.TDLS))
+              .ToList();
+            var incomingCabinet = allDataNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
+            var orphanNodes = allDataNodes.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
+            DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "EquipPower");
+
+            List<DataNode> nodes = new List<DataNode>();
+            nodes.Add(new DataNode() { Childrens = incomingCabinet });
+            nodes.Add(new DataNode() { Childrens = orphanNodes });
+            return nodes;
+        }
+
+        /// <summary>
+        /// 获取计算数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<string> GetComputeData(PowerComputerContext context)
+        {
+            return null;
+        }
+    }
+}

+ 96 - 0
MBI/SAGA.GplotRelationComputerManage/PowerDistribution/ComputerHandler/ObjectControlRelationshipHandler.cs

@@ -0,0 +1,96 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:ObjectControlRelationshipHandler
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 17:30:36
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Newtonsoft.Json.Linq;
+using SAGA.MBI.RequestData;
+using SAGA.Models;
+using MBIEquipItem = SAGA.Models.EquipmentItem;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    public class ObjectControlRelationshipHandler
+    {
+        /// <summary>
+        /// 获取解析数据源
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<MBIEquipItem> GetParseData(PowerComputerContext context)
+        {
+            List<MBIEquipItem> items = new List<MBIEquipItem>();
+            var controls = new string[] {MBIBuiltInCategory.BACP, MBIBuiltInCategory.BANC };
+            var types = new[] { MBIBuiltInCategory.Eq};
+            List<JObject> equipDatas = CommonConvert.QueryObjectInfoByTypes(types);
+            foreach (var jobject in equipDatas)
+            {
+                var item = MBIItemFactory.Create<MBIEquipItem>(jobject);   
+                //category带系统
+                string useCategory = item.Category.Remove(0, 2);
+                if (controls.All(c => c != useCategory) &&string.IsNullOrWhiteSpace(item.CTM_MainCtrl))
+                {
+                    continue;
+                }
+                items.Add(item);
+            }
+            return items;
+        }
+
+        /// <summary>
+        /// 获取显示数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<DataNode> GetViewData(PowerComputerContext context)
+        {
+
+            var items = GetParseData(context);
+            var originNodes = items.Select(i =>ConvertToDataNode(context,i)).ToList();
+            #region 构建树形结构
+            var controls = new string[] {MBIBuiltInCategory.BACP, MBIBuiltInCategory.BANC };
+            var controlNodes = originNodes.Where(t =>controls.Contains(t.Type)).ToList();
+            var eqs = originNodes.ToList();
+            foreach (var dn in controlNodes)
+            {
+                DataNodeUtil.BuildNode(dn, eqs);
+            }
+            #endregion
+            //有子节点,顶级根节点
+            var incomingCabinet = controlNodes.Where(t => t.Childrens.Count != 0 && t.Parent == null).ToList();
+            //孤立节点
+            var orphanNodes = eqs.Where(t => t.Childrens.Count == 0 && t.Parent == null).ToList();
+
+             DrawDataServer.SaveAsFile<DataNode>(new DataNode("root") { Childrens = incomingCabinet }, "ControlRelation");
+            List<DataNode> nodes = new List<DataNode>();
+            nodes.Add(new DataNode() { Childrens = incomingCabinet });
+            nodes.Add(new DataNode() { Childrens = orphanNodes });
+            return nodes;
+        }
+
+        /// <summary>
+        /// 获取计算数据
+        /// </summary>
+        /// <param name="context"></param>
+        /// <returns></returns>
+        public List<string> GetComputeData(PowerComputerContext context)
+        {
+            return null;
+        }
+
+        private DataNode ConvertToDataNode(PowerComputerContext context,MBIEquipItem item)
+        {
+            var node = context.ItemConvert(item);
+            node.InLineNo = item.CTM_MainCtrl?.Split(' ')[0];
+            node.InLineNo1 = item.CTM_StandbyCtrl;
+            return node;
+        }
+    }
+}

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

@@ -87,6 +87,11 @@
     <Compile Include="ComputerWalls\WallRelation.cs" />
     <Compile Include="ComputerWalls\WrapperedWall.cs" />
     <Compile Include="LvSpace.cs" />
+    <Compile Include="PowerDistribution\Common\DataNodeUtil.cs" />
+    <Compile Include="PowerDistribution\Common\PowerComputerContext.cs" />
+    <Compile Include="PowerDistribution\ComputerHandler\DistributionRelationshipHandler.cs" />
+    <Compile Include="PowerDistribution\ComputerHandler\EquipPowerRelationshipHandler.cs" />
+    <Compile Include="PowerDistribution\ComputerHandler\ObjectControlRelationshipHandler.cs" />
     <Compile Include="PumpEnd\DrawEnd.cs" />
     <Compile Include="PumpEnd\DuctTerminalBll.cs" />
     <Compile Include="ReadSpaceCommand.cs" />

+ 2 - 3
MBI/SAGA.MBI/RequestData/CommonRequest.cs

@@ -241,8 +241,7 @@ namespace SAGA.MBI.RequestData
         }
 
         /// <summary>
-        /// 获取项目下所有配电设备
-        /// "TDHS","TDLS","TDTF","TDLSDW"
+        /// 获取项目下指定类型的电气设备
         /// </summary>
         /// <returns></returns>
         public static string GetDistribution(JArray array)
@@ -305,7 +304,7 @@ namespace SAGA.MBI.RequestData
         /// <summary>
         /// 批量更新
         /// </summary>
-        /// <param name="id"></param>
+        /// <param name="criterias"></param>
         /// <returns></returns>
         public static string BatchUpdate(JArray criterias)
         {

+ 5 - 1
MBI/SAGA.Models/MBIItem/Builder/EquipmentItemBuilder.cs

@@ -18,7 +18,11 @@ namespace SAGA.Models
             var infos = item.Infos;
             item.Name = infos.GetValueEx(MBIBuiltInParameter.EquipName);
             item.LocalName = infos.GetValueEx(MBIBuiltInParameter.EquipLocalName);
-
+            item.LocalId = infos.GetValueEx(MBIBuiltInParameter.EquipLocalID);
+            item.CTM_MainPower = infos.GetValueEx(MBIBuiltInParameter.CTM_MainPower);
+            item.CTM_StandbyPower = infos.GetValueEx(MBIBuiltInParameter.CTM_StandbyPower);
+            item.CTM_MainCtrl = infos.GetValueEx(MBIBuiltInParameter.CTM_MainCtrl);
+            item.CTM_StandbyCtrl = infos.GetValueEx(MBIBuiltInParameter.CTM_StandbyCtrl);
             return item;
         }
     }

+ 15 - 0
MBI/SAGA.Models/MBIItem/Builder/MBIItemBuilder.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -40,6 +41,20 @@ namespace SAGA.Models
             if (infos != null)
             {
                   item.BimId = infos.GetValueEx(MBIBuiltInParameter.BIMID);
+                if (!string.IsNullOrWhiteSpace(item.BimId))
+                {
+                    try
+                    {
+                        var bimId = item.BimId;
+                        item.FloorId = bimId.Substring(0, bimId.IndexOf(":"));
+                    }
+                    catch (Exception ex)
+                    {
+                        Debug.WriteLine(ex.StackTrace.ToString());
+                    }
+                }
+
+              
             }          
             return item;
         }

+ 3 - 0
MBI/SAGA.Models/MBIItem/Builder/RoomItemBuilder.cs

@@ -17,7 +17,10 @@ namespace SAGA.Models
             base.Create(item, jobject);
             var infos = item.Infos;
             item.Name = infos.GetValueEx(MBIBuiltInParameter.RoomName);
+            item.LocalId = infos.GetValueEx(MBIBuiltInParameter.RoomLocalID);
             item.LocalName = infos.GetValueEx(MBIBuiltInParameter.RoomLocalName);
+            item.CTM_MainPower = infos.GetValueEx(MBIBuiltInParameter.CTM_MainPower);
+            item.CTM_StandbyPower = infos.GetValueEx(MBIBuiltInParameter.CTM_StandbyPower);
             return item;
         }
     }

+ 2 - 0
MBI/SAGA.Models/MBIItem/Entity/EquipmentItem.cs

@@ -32,5 +32,7 @@ namespace SAGA.Models
             return jobject;
         }
 
+
+       
     }
 }

+ 24 - 1
MBI/SAGA.Models/MBIItem/Entity/MBIItem.cs

@@ -82,6 +82,10 @@ namespace SAGA.Models
         /// 本地名称
         /// </summary>
         public string LocalName { get; set; }
+        /// <summary>
+        /// 本地编码
+        /// </summary>
+        public string LocalId { get; set; }
         #endregion
 
         #region 控制相关
@@ -133,8 +137,27 @@ namespace SAGA.Models
 
         #endregion
 
+        #region 自定义信息点
+        /// <summary>
+        /// 进线柜
+        /// </summary>
+        public string CTM_MainPower { get; set; }
+        /// <summary>
+        /// 备电设备
+        /// </summary>
+        public string CTM_StandbyPower { get; set; }
+        /// <summary>
+        /// 主控
+        /// </summary>
+        public string CTM_MainCtrl { get; set; }
+        /// <summary>
+        /// 备控
+        /// </summary>
+        public string CTM_StandbyCtrl { get; set; }
+        #endregion
+
     }
 
-   
+
 
 }

+ 1 - 0
MBI/SAGA.Models/MBIItem/Entity/RoomItem.cs

@@ -12,5 +12,6 @@ namespace SAGA.Models
     /// </summary>
     public class RoomItem : MBIItem
     {
+       
     }
 }

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

@@ -0,0 +1,62 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:MBIBuiltInCategory
+ * 作者:xulisong
+ * 创建时间: 2018/12/10 10:27:03
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.Models
+{
+    /// <summary>
+    /// 数据平台内部设备分类
+    /// </summary>
+    public class MBIBuiltInCategory
+    {
+        /// <summary>
+        /// 设备
+        /// </summary>
+        public static readonly string Eq = "Eq";
+        /// <summary>
+        /// 元空间
+        /// </summary>
+        public static readonly string Si = "Si";
+        /// <summary>
+        /// 低压开关柜
+        /// </summary>
+        public readonly static string TDLS = "TDLS";
+        /// <summary>
+        /// 低压配电抽屉
+        /// </summary>
+        public readonly static string TDLSDW = "TDLSDW";
+        /// <summary>
+        /// 高压开关柜
+        /// </summary>
+        public readonly static string TDHS = "TDHS";
+        /// <summary>
+        /// 综合保护装置
+        /// </summary>
+        public readonly static string TDHSIP = "TDHSIP";
+        /// <summary>
+        /// 变压器
+        /// </summary>
+        public readonly static string TDTF = "TDTF";
+        /// <summary>
+        /// 楼控网络控制器
+        /// </summary>
+        public readonly static string BANC = "BANC";
+        /// <summary>
+        /// 楼控主机
+        /// </summary>
+        public readonly static string BAHT = "BAHT";
+        /// <summary>
+        /// 楼控控制面板
+        /// </summary>
+        public readonly static string BACP = "BACP";
+    }
+}

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

@@ -118,6 +118,10 @@ namespace SAGA.Models
 
         #region 房间通用
         /// <summary>
+        /// 空间本地编码
+        /// </summary>
+        public readonly static string RoomLocalID = "RoomLocalID";
+        /// <summary>
         /// 空间名称
         /// </summary>
         public readonly static string RoomName = "RoomName";
@@ -147,5 +151,24 @@ namespace SAGA.Models
         /// </summary>
         public readonly static string FloorMap = "FloorMap";
         #endregion
+
+        #region 设备自定义
+        /// <summary>
+        /// 主供电设备
+        /// </summary>
+        public readonly static string CTM_MainPower = "ctm-MainPower";
+        /// <summary>
+        /// 备电设备
+        /// </summary>
+        public readonly static string CTM_StandbyPower = "ctm-StandbyPower";
+        /// <summary>
+        /// 主控
+        /// </summary>
+        public readonly static string CTM_MainCtrl = "ctm-MainCtrl";
+        /// <summary>
+        /// 备控
+        /// </summary>
+        public readonly static string CTM_StandbyCtrl = "ctm-StandbyCtrl";
+        #endregion
     }
 }

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

@@ -95,6 +95,7 @@
     <Compile Include="MBIItem\Entity\EquipmentItem.cs" />
     <Compile Include="MBIItem\Entity\FloorItem.cs" />
     <Compile Include="MBIItem\Entity\RoomItem.cs" />
+    <Compile Include="MBIItem\MBIBuiltInCategory.cs" />
     <Compile Include="MBIItem\MBIBuiltInParameter.cs" />
     <Compile Include="MBIItem\Entity\MBIItem.cs" />
     <Compile Include="MBIItem\Builder\MBIItemBuilder.cs" />

+ 1 - 1
MBI/SAGA.Revit.sln.DotSettings.user

@@ -2,5 +2,5 @@
 	<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
   &lt;Assembly Path="D:\SVNCode\MBI\Dlls\Newtonsoft.Json.dll" /&gt;&#xD;
   &lt;Assembly Path="D:\SVNCode\MBI\Dlls\FirmLibDll\FWindSoft.Wpf.dll" /&gt;&#xD;
-  &lt;ProjFile Path="C:\Users\SAGACLOUD\Desktop\FWindSoft.Wpf\FWindSoft.Wpf.csproj" /&gt;&#xD;
+  &lt;Assembly Path="D:\MBI\Revit\SAGA.MBI\SAGA.MBI\MBI\Dlls\RevitRefDll\AdWindows.dll" /&gt;&#xD;
 &lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>