Browse Source

xls:修改关系数据

xulisong 6 years ago
parent
commit
bce4fb7924

+ 2 - 2
MBI/SAGA.GplotDrawData/View/WinMachineRoom.xaml

@@ -29,8 +29,8 @@
                 </Style>
             </TreeView.ItemContainerStyle>
             <TreeView.ItemTemplate>
-                <HierarchicalDataTemplate ItemsSource="{Binding Path=Nodes}">
-                    <TextBlock Name="Block" Text="{Binding Name}"></TextBlock>
+                <HierarchicalDataTemplate ItemsSource="{Binding Path=Children}">
+                    <TextBlock Name="Block" Text="{Binding EName}"></TextBlock>
 
                     <HierarchicalDataTemplate.Triggers>
                         <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=TreeViewItem},Path=IsSelected}" Value="True">

+ 1 - 1
MBI/SAGA.GplotDrawData/View/WinMachineRoom.xaml.cs

@@ -64,7 +64,7 @@ namespace SAGA.GplotDrawData.View
                 foreach (var drawRecord in drawData)
                 {
                     var recordNode= new DataNode(drawRecord.RelationName);
-                    recordNode.SetData(recordNode);
+                    recordNode.SetData(drawRecord);
                     treeDataSource.Add(recordNode);
                 }
             }

+ 27 - 27
MBI/SAGA.GplotManage/GplotCommand.cs

@@ -64,13 +64,13 @@ namespace SAGA.GplotManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            //List<string> useRelations = new List<string>() { "ChillWaterLoop" };
-            //SystemComputerHandler handler1 = new SystemComputerHandler();
-            //handler1.ComputerWidthCache(useRelations);
-            //WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
-            //floorWin.Show();
-            var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
-            space.Show(GplotShowType.Default);
+            List<string> useRelations = new List<string>() { "ChillWaterLoop" };
+            SystemComputerHandler handler1 = new SystemComputerHandler();
+            handler1.ComputerWidthCache(useRelations);
+            WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
+            floorWin.Show();
+            //var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
+            //space.Show(GplotShowType.Default);
             return Result.Succeeded;
         }
 
@@ -89,13 +89,13 @@ namespace SAGA.GplotManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            //List<string> useRelations = new List<string>() { "ChillWaterLoop" };
-            //SystemComputerHandler handler1 = new SystemComputerHandler();
-            //handler1.ComputerWidthCache(useRelations);
-            //WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
-            //floorWin.Show();
-            var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
-            space.Show(GplotShowType.ViewPlan);
+            List<string> useRelations = new List<string>() { "ChillWaterLoop" };
+            SystemComputerHandler handler1 = new SystemComputerHandler();
+            handler1.ComputerWidthCache(useRelations);
+            WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
+            floorWin.Show();
+            //var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
+            //space.Show(GplotShowType.ViewPlan);
             return Result.Succeeded;
         }
 
@@ -114,13 +114,13 @@ namespace SAGA.GplotManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
-            //List<string> useRelations = new List<string>() { "ChillWaterLoop" };
-            //SystemComputerHandler handler1 = new SystemComputerHandler();
-            //handler1.ComputerWidthCache(useRelations);      
-            //WinSystem verticalWin = new WinSystem(GplotShowType.VerticalPlan);
-            //verticalWin.Show();
-            var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
-            space.Show(GplotShowType.VerticalPlan);
+            List<string> useRelations = new List<string>() { "ChillWaterLoop" };
+            SystemComputerHandler handler1 = new SystemComputerHandler();
+            handler1.ComputerWidthCache(useRelations);
+            WinSystem verticalWin = new WinSystem(GplotShowType.VerticalPlan);
+            verticalWin.Show();
+            //var space = GplotFactory.Create(GraphTypeEnum.ChillWaterLoop);
+            //space.Show(GplotShowType.VerticalPlan);
             return Result.Succeeded;
 
         }
@@ -199,12 +199,12 @@ namespace SAGA.GplotManage
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
             //var relationType = RelationTypeManager.GetRelationTypeItem("ChillWaterLoop");
-            //List<string> useRelations = new List<string>() { "ChillWaterLoop" };
-            //SystemComputerHandler handler1 = new SystemComputerHandler();
-            //handler1.ComputerWidthCache(useRelations);
-            //WinMachineRoom room = new WinMachineRoom();
-            //room.Show();
-            //return Result.Succeeded;
+            List<string> useRelations = new List<string>() { "ChillWaterLoop" };
+            SystemComputerHandler handler1 = new SystemComputerHandler();
+            handler1.ComputerWidthCache(useRelations);
+            WinMachineRoom room = new WinMachineRoom();
+            room.Show();
+            return Result.Succeeded;
             RoomShowHandler handler = new RoomShowHandler("ChillWaterLoop");
             handler.Show();
             ;

+ 2 - 0
MBI/SAGA.GplotRelationComputerManage/RelationType/Data/SystemItem.cs

@@ -44,6 +44,8 @@ namespace SAGA.GplotRelationComputerManage
         /// <returns></returns>
         public bool IsMatch(string inputSystemName)
         {
+            if (string.IsNullOrWhiteSpace(inputSystemName))
+                return false;
             return inputSystemName.Contains(Name);
         }
     }

+ 6 - 2
MBI/SAGA.GplotRelationComputerManage/RevitSystemParse/Handler/SystemParse.cs

@@ -405,8 +405,12 @@ namespace SAGA.GplotRelationComputerManage
                 originEdge.SystemName = (refElements.FirstOrDefault(e => e is MEPCurve) as MEPCurve)?.GetSystemTypeName();
                 //根据系统类型和特殊设备确定旁通和补水;未完,待续
                 var systemItem = Setting.RelationTypeShell.GetFirstMatchSystem(originEdge.SystemName);
-                originEdge.EdgeCategory = systemItem.ContainEdgeTypes.FirstOrDefault();// Setting.GplotOptions.GetCategory(originEdge.SystemName);
-                originEdge.FlowType = systemItem.FlowType == FlowType.In ? 2 : 1;
+                if (systemItem != null)
+                {
+                    originEdge.EdgeCategory = systemItem.ContainEdgeTypes.FirstOrDefault();// Setting.GplotOptions.GetCategory(originEdge.SystemName);
+                    originEdge.FlowType = systemItem.FlowType == FlowType.In ? 2 : 1;
+                }
+            
             }
             #endregion
             #region 方向处理

+ 2 - 1
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/RelationTypeUtil.cs

@@ -31,7 +31,8 @@ namespace SAGA.GplotRelationComputerManage
                 DateTime dateTime = DateTime.Now;
                 if(check.IsExpired(dateTime))
                 {
-                    result.Add(relationType);
+                    //测试不验证事件
+                   // result.Add(relationType);
                     continue;
                 }
             }

+ 8 - 3
MBI/SAGA.GplotRelationComputerManage/SystemRelation/Common/SystemParseManager.cs

@@ -63,6 +63,11 @@ namespace SAGA.GplotRelationComputerManage
                         foreach (var refConnector in refConnectors)
                         {
                             var refElement = refConnector.Owner;
+                            if (reference.Reverse<ElementTreeNode>().Any(e => e.Current.Id.IntegerValue == refElement.Id.IntegerValue))
+                            {
+                                continue;
+                            }
+
                             ElementTreeNode refNode = new ElementTreeNode();
                             refNode.Current = refElement;
                             refNode.StartLocation = refConnector.Origin;
@@ -71,10 +76,10 @@ namespace SAGA.GplotRelationComputerManage
                             {
                                 continue;
                             }
-                            if (reference.All(e => e.Current.Id.IntegerValue != refElement.Id.IntegerValue))
-                            {
+                            //if (reference.All(e => e.Current.Id.IntegerValue != refElement.Id.IntegerValue))
+                            //{
                                 reference.Add(refNode);
-                            }
+                            //}
                         }
                     }
                 }

+ 40 - 31
MBI/SAGA.GplotRelationComputerManage/SystemRelation/FloorSystemItem.cs

@@ -223,6 +223,7 @@ namespace SAGA.GplotRelationComputerManage
                 var useRelation = relationSetting.GetFirstMatchSystem(startNode.Flag);
                 if (useRelation == null)
                     continue;
+                //加入开始元素
                 if (startNode.Instance.Current is FamilyInstance)
                 {
                     roomStartElements.Add(startNode.Instance.Current);
@@ -231,7 +232,7 @@ namespace SAGA.GplotRelationComputerManage
                 {
                     continue;
                 }
-
+                //加入立管
                 if (startNode.Instance.Current is MEPCurve mepCurve)
                 {
                     verticalMepCurves.Add(mepCurve);
@@ -294,39 +295,47 @@ namespace SAGA.GplotRelationComputerManage
                     }
 
                     var startNode = SystemParseManager.CreateTreeNode(useInstance, connector, e => e is MEPCurve);
-                    var useMepCurve = startNode.GetLeaves().FirstOrDefault()?.Current as MEPCurve;
-                    if (useMepCurve == null)
-                        continue;
-                    var systemTypeName = useMepCurve.GetSystemTypeName();
-                    if (!relationSetting.IsMatchSystem(systemTypeName))
+                    //查找需要遍历的路径信息
+                    var leaves = startNode.GetLeaves();
+                    //使用过的系统不再进行遍历
+                    List<string> useSystems = new List<string>();
+                    foreach (var leaf in leaves)
                     {
-                        continue;
-                    }
-
-                    //var startNode = new ElementTreeNode() { Current = useInstance };
-                    var tempIds = SystemParseManager.BuildSystemNode(startNode, useDomain,
-                        (m => !systemTypeName.Equals(m.GetSystemTypeName())));
-                    startNode.PipeSystemTypeName = systemTypeName;
-                    BuildElementNodeData(context, startNode);
-                    useIds.AddRange(tempIds);
-
-                    #region 生成绘图,计算数据
-
-                    //解析数据,找管道定系统,管道找不到,系统名为"关联类型-未知"
-                    var drawRecord = BuildFloorDrawRecord(relationSetting, startNode);
-                    drawRecord.SystemName = systemTypeName;
-                    drawRecords.Add(drawRecord);
-
-                    var relationRecord = BuildFloorRelationRecord(relationSetting, startNode,context);
-                    relationRecords.Add(relationRecord);
-
-                    #endregion
+                        var useMepCurve = leaf?.Current as MEPCurve;
+                        if (useMepCurve == null)
+                            continue;
+                        var systemTypeName = useMepCurve.GetSystemTypeName();
+                        if (!relationSetting.IsMatchSystem(systemTypeName))
+                        {
+                            continue;
+                        }
 
+                        if (useSystems.Any(s => s == systemTypeName))
+                        {
+                            continue;
+                        }
+                        useSystems.Add(systemTypeName);
+                        //创建制定的startNode;[一个分支,一个分支去处理]
+                        ElementTreeNode newStartNode = new ElementTreeNode() {Current = useInstance};
+                        var tempIds = SystemParseManager.BuildSystemNode(newStartNode, useDomain,
+                            (m => !systemTypeName.Equals(m.GetSystemTypeName())));
+                        newStartNode.PipeSystemTypeName = systemTypeName;
+                        BuildElementNodeData(context, newStartNode);
+                        useIds.AddRange(tempIds);
+
+                        #region 生成绘图,计算数据
+
+                        //解析数据,找管道定系统,管道找不到,系统名为"关联类型-未知"
+                        var drawRecord = BuildFloorDrawRecord(relationSetting, newStartNode);
+                        drawRecord.SystemName = systemTypeName;
+                        drawRecords.Add(drawRecord);
+
+                        var relationRecord = BuildFloorRelationRecord(relationSetting, newStartNode, context);
+                        relationRecords.Add(relationRecord);
+
+                        #endregion
+                    }
                 }
-
-
-
-
             }
 
             #endregion

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

@@ -23,12 +23,15 @@ namespace SAGA.GplotRelationComputerManage
         /// <param name="context"></param>
         public void Computer(SystemComputerContext context)
         {
-            List<object> items = new List<object>();
             var fileInfos = RevitModelPath.GetAllRevitFiles();
             foreach (var fileInfo in fileInfos)
             {
                 if (File.Exists(fileInfo))
                 {
+                    if (!fileInfo.Contains("Fl420105000189c43312dce811e8a5530301735c51a0.rvt"))
+                    {
+                        continue;
+                    }
                     FloorSystemItem floorItems = context.FloorItems.GetItem(fileInfo);
                     floorItems.Parse(context);
                     floorItems.Document.CloseDocSimple();

+ 1 - 1
MBI/SAGA.MBI/Interaction/MBIModelInfoManager.cs

@@ -32,7 +32,7 @@ namespace SAGA.MBI.Interaction
                     break;
                 }
                 if (element is FamilyInstance)
-                {
+                {                  
                     RevitParameterUpdate.UpdateElementByMbi(element, MBIBuiltInParameter.EquipLocalName, mbiItem.LocalName);
                     RevitParameterUpdate.UpdateElementByMbi(element, MBIBuiltInParameter.EquipLocalID, mbiItem.LocalId);                 
                     break;

+ 3 - 0
MBI/SAGA.MBI/RevitModelHandle/RevitParameterUpdate.cs

@@ -149,6 +149,9 @@ namespace SAGA.MBI
         }
         public static void UpdateElementByMbi(Element element, string mbiParameterName, string value, bool checkValueEmpty)
         {
+            //设备信息同步关闭
+            if (element is FamilyInstance)
+                return;
             if (checkValueEmpty && string.IsNullOrWhiteSpace(value))
                 return;
             ParameterDefinitionFactory.GetParameterDefinition(mbiParameterName)