Quellcode durchsuchen

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

xulisong vor 6 Jahren
Ursprung
Commit
76846f5e5f

+ 1 - 1
MBI/MBIResource/Config/HttpSetting - 测试.ini

@@ -1,7 +1,7 @@
 [Configure]
 SaasLocalHost = http://192.168.30.96:8080/
 DataPlatformLocalHost = http://192.168.20.225:8080/
-ScanBuildingLocalHost = http://172.16.0.141:8080/ScanBuilding/
+ScanBuildingLocalHost = http://192.168.20.235:8080/ScanBuilding/
 Html5ImageLocalHost = http://172.16.0.181:8890/
 Html5DetailLocalHost = http://172.16.0.181:8889/#/
 Html5ScanLocalHost = http://172.16.0.181:8888/#/

BIN
MBI/MBIResource/DataCheck/模型检查结果输出格式-模版.xlsx


+ 14 - 0
MBI/Menu/MBITool.xml

@@ -185,6 +185,20 @@
       <MenuTab>MBITool_W</MenuTab>
       <Modules>MBITool</Modules>
     </Button>
+
+    <Button ButtonStyles="Stacked">
+      <ButtonName>SAGA.MBI.ExportMEPSystemCommand</ButtonName>
+      <ButtonText>导出系统</ButtonText>
+      <ImageName>1、打开楼层模型</ImageName>
+      <DllName>..\OutputDll\SAGA.MBI.exe</DllName>
+      <ClassName>SAGA.MBI.ExportMEPSystemCommand</ClassName>
+      <ToolTip>导出风管系统和水管系统</ToolTip>
+      <LongDescription>导出风管系统和水管系统</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>MBITool_W</MenuTab>
+      <Modules>MBITool</Modules>
+    </Button>
+    
   </Panel>
  <Panel PanelName="功能扩展" GroupFlag="True" GroupImage="" RevitVer="R14,R15,R16,R17"  ButtonStyles="Large">   
     <Button ButtonStyles="Large">

BIN
MBI/SAGA.MBI/Image/delete.png


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

@@ -358,6 +358,7 @@
     <Compile Include="ToolsData\DataCheck\WinDataCheckSetting.xaml.cs">
       <DependentUpon>WinDataCheckSetting.xaml</DependentUpon>
     </Compile>
+    <Compile Include="ToolsData\ExportMEPSystem.cs" />
     <Compile Include="ToolsData\IDataCorrect.cs" />
     <Compile Include="ToolsData\ModeCheck\EquipReferSystemCheck.cs" />
     <Compile Include="ToolsData\ModeCheck\EquipReferSystemCheckResult.cs" />
@@ -1084,6 +1085,9 @@
   </ItemGroup>
   <ItemGroup>
     <Content Include="FodyWeavers.xml" />
+    <Resource Include="Image\delete.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
     <Content Include="sagacloud.ico" />
     <Resource Include="Image\correlation.png">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>

+ 38 - 14
MBI/SAGA.MBI/Test/CopyParameterValue.cs

@@ -6,6 +6,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using Autodesk.Revit.DB;
@@ -35,10 +36,15 @@ namespace SAGA.MBI.Test
     /// </summary>
     public class CopyParameterValue : IDataCorrect
     {
-        private Dictionary<string, string> m_parameterDic;
-        public void SetCopyParameterDic(Dictionary<string, string> dic)
+        public static string AllStr = "All";
+        private ObservableCollection<PropertyItem> m_parameterDic;
+        private string m_copyFamilyRange;
+        public bool SetCopyParameterDic(ObservableCollection<PropertyItem> dic, string copyRange)
         {
+
             m_parameterDic = dic;
+            m_copyFamilyRange = copyRange;
+            return (dic == null || m_copyFamilyRange == null);
         }
 
         public string Execute(MFloor floor)
@@ -71,26 +77,44 @@ namespace SAGA.MBI.Test
 
         private void OperateFloor(Document doc)
         {
+
             using (Transaction trans = new Transaction(doc, "复制属性"))
             {
-                trans.Start();
-                var elements = doc.GetMbiElements();
-                foreach (Element element in elements)
+                try
                 {
-                    if (element.GetFamilyCode() == "GMMP")
-                        foreach (var pair in m_parameterDic)
-                        {
-                            string origin = pair.Key;
-                            string target = pair.Value;
-                            if (origin.IsNotNullEmpty() && target.IsNotNullEmpty())
+                    trans.Start();
+                    var elements = doc.GetMbiElements();
+                    var codes = GetCodes();
+
+                    foreach (Element element in elements)
+                    {
+                        var code = element.GetFamilyCode();
+                        if (codes.Contains(AllStr) || code.Contains(code))
+                            foreach (var pair in m_parameterDic)
                             {
-                                element.SetParameterValue(target, element.GetParameterString(origin));
+                                string origin = pair.Name;
+                                string target = pair.Value;
+                                if (origin.IsNotNullEmpty() && target.IsNotNullEmpty())
+                                {
+                                    element.SetParameterValue(target, element.GetParameterString(origin));
+                                }
                             }
-                        }
+                    }
+
+                    trans.Commit();
+                }
+                catch (Exception e)
+                {
+                    Console.WriteLine(e);
                 }
 
-                trans.Commit();
             }
         }
+
+        private string[] GetCodes()
+        {
+            var codes = m_copyFamilyRange?.Split(';', ';');
+            return codes;
+        }
     }
 }

+ 54 - 5
MBI/SAGA.MBI/Test/WinParameterDic.xaml

@@ -5,27 +5,58 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:SAGA.MBI.Test"
              mc:Ignorable="d" Title="配置参数" WindowStartupLocation="CenterScreen"
-             Height="300" Width="400">
+                  Height="300" Width="400">
     <Window.Resources>
         <Style  TargetType="TextBox">
             <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
             <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
             <Setter Property="Height" Value="24"></Setter>
         </Style>
+        <Style TargetType="DataGridColumnHeader">
+            <Setter Property="Height" Value="25"></Setter>
+            <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
+            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+        </Style>
+        <Style x:Key="dgtextblock">
+            <Setter Property="TextBlock.Height" Value="25"></Setter>
+            <Setter Property="TextBlock.HorizontalAlignment" Value="Center"></Setter>
+        </Style>
+        <Style x:Key="dgtextbox">
+            <Setter Property="TextBox.Height" Value="25"></Setter>
+            <Setter Property="TextBox.HorizontalContentAlignment" Value="Center"></Setter>
+        </Style>
     </Window.Resources>
     <Grid Margin="5">
         <Grid.RowDefinitions>
-            <RowDefinition Height="20"></RowDefinition>
+            <RowDefinition Height="50"></RowDefinition>
             <RowDefinition></RowDefinition>
             <RowDefinition Height="50"></RowDefinition>
         </Grid.RowDefinitions>
+        <Grid Grid.Row="0">
+            <WrapPanel>
+                <Label Content="请输入设备类别(族的四位编码,多个请用分号分割,所有请输入All):"></Label>
+                <TextBox Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Grid }, Path=ActualWidth}" Text="{Binding Path=CopyRange,UpdateSourceTrigger=PropertyChanged}" HorizontalContentAlignment="Left" ></TextBox>
+            </WrapPanel>
+        </Grid>
         <Grid Grid.Row="1">
             <Grid.ColumnDefinitions>
                 <ColumnDefinition></ColumnDefinition>
                 <ColumnDefinition></ColumnDefinition>
-                <ColumnDefinition Width="30"></ColumnDefinition>
+                <ColumnDefinition Width="20"></ColumnDefinition>
             </Grid.ColumnDefinitions>
-            <StackPanel Grid.Column="0">
+            <DataGrid Grid.Column="0" Grid.ColumnSpan="2" ItemsSource="{Binding Path=ParameterDic,UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" CanUserAddRows="False"
+                      SelectedItem="{Binding Path=SelectItem}">
+                <DataGrid.Columns>
+                    <DataGridTextColumn Header="源参数名称(旧)"  Width="*" Binding="{Binding Path=Name,UpdateSourceTrigger=PropertyChanged}"
+                                       ElementStyle="{StaticResource dgtextblock}" 
+                                        EditingElementStyle="{StaticResource dgtextbox}"></DataGridTextColumn>
+                    <DataGridTextColumn Header="目标参数名称(新)" Width="*" Binding="{Binding Path=Value,UpdateSourceTrigger=PropertyChanged}"
+                                        ElementStyle="{StaticResource dgtextblock}"
+                                        EditingElementStyle="{StaticResource dgtextbox}"></DataGridTextColumn>
+                </DataGrid.Columns>
+            </DataGrid>
+
+            <!--<StackPanel Grid.Column="0">
                 <Label Height="25" Content="源参数名称(旧)" HorizontalContentAlignment="Center" Background="LightGray"></Label>
                 <TextBox Name="txt00" Text="车位编号"></TextBox>
                 <TextBox Name="txt10"></TextBox>
@@ -34,7 +65,24 @@
                 <Label Height="25" Content="目标参数名称(新)" HorizontalContentAlignment="Center" Background="LightGray"></Label>
                 <TextBox  Name="txt01" Text="设备本地编码"></TextBox>
                 <TextBox  Name="txt11"></TextBox>
-            </StackPanel>
+            </StackPanel>-->
+            <Grid Grid.Column="2">
+                <StackPanel VerticalAlignment="Center">
+                    <Button Margin="0,5"
+                        Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Grid},Path=ActualWidth}"
+                            Click="BtnAdd_OnClick">
+                        <Image Source="../Image/add.png"></Image>
+                    </Button>
+
+                    <Button Margin="0,5"
+                        Height="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=Grid},Path=ActualWidth}"
+                            Click="BtnDel_OnClick">
+                        <Image Source="../Image/delete.png">
+                        </Image>
+                    </Button>
+
+                </StackPanel>
+            </Grid>
         </Grid>
         <WrapPanel Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center">
             <Button Height="24" Width="100" Content="执行" Margin="10,0" IsDefault="True" Click="ButtonBase_OnClick"></Button>
@@ -42,3 +90,4 @@
         </WrapPanel>
     </Grid>
 </Window>
+

+ 81 - 6
MBI/SAGA.MBI/Test/WinParameterDic.xaml.cs

@@ -1,5 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -19,27 +21,100 @@ namespace SAGA.MBI.Test
     /// <summary>
     /// WinParameterDic.xaml 的交互逻辑
     /// </summary>
-    public partial class WinParameterDic
+    public partial class WinParameterDic : INotifyPropertyChanged
     {
         public WinParameterDic()
         {
             InitializeComponent();
+            CopyRange = CopyParameterValue.AllStr;
+            ParameterDic = new ObservableCollection<PropertyItem>();
+            ParameterDic.Add(new PropertyItem() { Name = "车位编号", Value = "设备本地编码" });
+            this.DataContext = this;
         }
-        public Dictionary<string,string> ParameterDic { get; set; }
+
+        #region Binding
+
+        private ObservableCollection<PropertyItem> m_ParameterDic;
+
+        public ObservableCollection<PropertyItem> ParameterDic
+        {
+            get { return m_ParameterDic; }
+            set
+            {
+                m_ParameterDic = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ParameterDic)));
+            }
+        }
+
+        private PropertyItem m_SelectItem;
+
+        public PropertyItem SelectItem
+        {
+            get { return m_SelectItem; }
+            set
+            {
+                m_SelectItem = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectItem)));
+            }
+        }
+
+        private string m_CopyRange;
+
+        public string CopyRange
+        {
+            get { return m_CopyRange; }
+            set
+            {
+                m_CopyRange = value;
+                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CopyRange)));
+            }
+        }
+
+
+        #endregion
+
+
+        public event PropertyChangedEventHandler PropertyChanged;
+
         private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
         {
-            ParameterDic=new System.Collections.Generic.Dictionary<string, string>();
             try
             {
-                ParameterDic.Add(txt00.Text,txt01.Text);
-                ParameterDic.Add(txt10.Text,txt11.Text);
+
             }
             catch (Exception exception)
             {
                 Console.WriteLine(exception);
-                
+
             }
+
             this.DialogResult = true;
         }
+
+
+        private void BtnAdd_OnClick(object sender, RoutedEventArgs e)
+        {
+            var item = ParameterDic.FirstOrDefault(t => t.Name == null && t.Value == null);
+            if (item == null)
+            {
+                item = new PropertyItem();
+                ParameterDic.Add(item);
+            }
+
+            SelectItem = item;
+        }
+
+        private void BtnDel_OnClick(object sender, RoutedEventArgs e)
+        {
+            if (SelectItem != null)
+                ParameterDic.Remove(SelectItem);
+        }
+    }
+
+    public class PropertyItem
+    {
+        public string Name { get; set; }
+
+        public string Value { get; set; }
     }
 }

+ 40 - 1
MBI/SAGA.MBI/ToolCommand.cs

@@ -227,6 +227,44 @@ namespace SAGA.MBI
             return true;
         }
     }
+    /// <summary>
+    /// 导出系统
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class ExportMEPSystemCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            try
+            {
+                var tip = MessageShowBase.Question2("确定要导出系统?\r\n是:全部楼层\r\n否:当前楼层\r\n取消:取消。");
+                switch (tip)
+                {
+                    case DialogResult.Yes:
+                        ExportMEPSystem.OperateAll();
+                        break;
+                    case DialogResult.No:
+                        ExportMEPSystem.OperateCurFloor();
+                        break;
+                    default:
+                        break;
+                }
+
+            }
+            catch (Exception e)
+            {
+                MessageShow.Show(e);
+                return Result.Cancelled;
+            }
+            return Result.Succeeded;
+        }
+
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return true;
+        }
+    }
 
     /// <summary>
     /// 复制指定参数A的值到指定参数B中
@@ -246,7 +284,8 @@ namespace SAGA.MBI
 
                     if (win.ShowDialog() == true)
                     {
-                        SingleInstance<CopyParameterValue>.Instance.SetCopyParameterDic(win.ParameterDic);
+                        if (!SingleInstance<CopyParameterValue>.Instance.SetCopyParameterDic(win.ParameterDic,
+                            win.CopyRange)) return Result.Cancelled;
                         switch (tip)
                         {
                             case DialogResult.Yes:

+ 3 - 3
MBI/SAGA.MBI/ToolsData/ExportAllDuty.cs

@@ -121,12 +121,12 @@ namespace SAGA.MBI.ToolsData
 
                     ICell cell3 = row.CreateCell(3);
                     cell3.SetCellType(NPOI.SS.UserModel.CellType.String);
-                    cell3.SetCellValue("Dutyid");
+                    cell3.SetCellValue("物理世界Id");
 
 
-                    ICell cell4 = row.CreateCell(3);
+                    ICell cell4 = row.CreateCell(4);
                     cell4.SetCellType(NPOI.SS.UserModel.CellType.String);
-                    cell4.SetCellValue("BIMID");
+                    cell4.SetCellValue("模型中的Id");
 
                     #endregion
 

+ 290 - 0
MBI/SAGA.MBI/ToolsData/ExportMEPSystem.cs

@@ -0,0 +1,290 @@
+/* ==============================================================================
+ * 功能描述:导出所有的岗位
+ * 创 建 者:Garrett
+ * 创建日期:2018/8/10 16:36:26
+ * ==============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Mechanical;
+using FWindSoft.Tools;
+using Microsoft.Win32;
+using Newtonsoft.Json.Linq;
+using NPOI.SS.UserModel;
+using NPOI.XSSF.UserModel;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Logger;
+using SAGA.DotNetUtils.Others;
+using SAGA.MBI.Calc;
+using SAGA.MBI.Common;
+using SAGA.MBI.DataArrange;
+using SAGA.MBI.Model;
+using SAGA.MBI.RequestData;
+using SAGA.MBI.Tools;
+using SAGA.MBI.WinView.Upload;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
+using CellType = Autodesk.Revit.DB.CellType;
+
+namespace SAGA.MBI.ToolsData
+{
+    /// <summary>
+    /// UpdateRelationEquipinFloor
+    /// </summary>
+    public class ExportMEPSystem
+    {
+        /// <summary>
+        /// 检查并处理所有楼层
+        /// </summary>
+        public static void OperateAll()
+        {
+            var floors = DalProjectTree.GetAllFloors(false);
+            List<ExportItemGroup> contexts = new List<ExportItemGroup>();
+            foreach (var floor in floors)
+            {
+                contexts.Add(Operate(floor));
+            }
+            ExportToExcel(contexts);
+        }
+        /// <summary>
+        /// 只处理当前楼层
+        /// </summary>
+        public static void OperateCurFloor()
+        {
+            MFloor floor = ExternalDataWrapper.Current.Doc.GetCurMFloor();
+            if (floor != null)
+            {
+                var context = Operate(floor);
+                ExportToExcel(new List<ExportItemGroup>() { context });
+            }
+        }
+        /// <summary>
+        /// 检查并处理
+        /// </summary>
+        /// <param name="floor"></param>
+        /// <returns></returns>
+        private static ExportItemGroup Operate(MFloor floor)
+        {
+            string fullPah = floor.FullPath;
+            Document doc = ExternalDataWrapper.Current.UiApp.Application.OpenDocumentFile(fullPah);
+
+            ExportItemGroup group =new ExportItemGroup(floor.ToString());
+            var systems = doc.GetElements<MEPSystem>();
+            foreach (var mepSystem in systems)
+            {
+                string name = mepSystem.Name;
+                string systemType = doc.GetElement(mepSystem.GetTypeId()).Name;
+                string type = mepSystem is MechanicalSystem ? "风管" : "水管";
+                group.Items.Add(new ExportItem(){SystemName = name,SystemType = systemType,Type = type});
+            }
+            return group;
+        }
+
+        /// <summary>
+        /// 导出数据
+        /// </summary>
+        /// <param name="xyzsList"></param>
+        static void ExportToExcel(List<ExportItemGroup> contexts)
+        {
+            SaveFileDialog sflg = new SaveFileDialog();
+            sflg.Filter = "Excel(*.xlsx)|*.xlsx";
+            sflg.FileName = $"{MBIControl.ProjectCur}系统汇总表";
+            if (sflg.ShowDialog() != true) return;
+            ExportToExcel(contexts, sflg.FileName, sflg.FilterIndex);
+        }
+
+        /// <summary>
+        /// 导出数据到指定目录
+        /// </summary>
+        /// <param name="xyzsList"></param>
+        /// <param name="fileName"></param>
+        private static void ExportToExcel(List<ExportItemGroup> contexts, string fileName, int filterIndex = 0)
+        {
+            try
+            {
+                IWorkbook book = new XSSFWorkbook();
+
+                #region 添加数据
+
+                foreach (var context in contexts)
+                {
+                    int index = 0;
+                    var floorName = context.FloorName;
+                    ISheet sheet = book.CreateSheet(floorName);
+
+                    #region 添加表头
+
+                    IRow row = sheet.CreateRow(0);
+                    NPOI.SS.UserModel.ICell cell0 = row.CreateCell(0);
+                    cell0.SetCellType(NPOI.SS.UserModel.CellType.String);
+                    cell0.SetCellValue("楼层名称");
+
+                    ICell cell1 = row.CreateCell(1);
+                    cell1.SetCellType(NPOI.SS.UserModel.CellType.String);
+                    cell1.SetCellValue("类型");
+
+                    ICell cell2 = row.CreateCell(2);
+                    cell2.SetCellType(NPOI.SS.UserModel.CellType.String);
+                    cell2.SetCellValue("系统名称");
+
+                    ICell cell3 = row.CreateCell(3);
+                    cell3.SetCellType(NPOI.SS.UserModel.CellType.String);
+                    cell3.SetCellValue("系统类型名称");
+
+                    #endregion
+                    
+                    foreach (var item in context.Items)
+                    {
+                        string type = item.Type;
+                        string name = item.SystemName;
+                        string sytemName = item.SystemType;
+                        index++;
+
+                        row = sheet.CreateRow(index);
+
+                        ICell cell = row.CreateCell(0, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(floorName);
+
+                        cell = row.CreateCell(1, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(type);
+
+                        cell = row.CreateCell(2, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(name);
+
+                        cell = row.CreateCell(3, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(sytemName);
+                    }
+                }
+
+                #endregion
+
+                #region 写入
+
+                MemoryStream ms = new MemoryStream();
+                book.Write(ms);
+                book = null;
+
+                using (System.IO.FileStream fs = new System.IO.FileStream(fileName, FileMode.Create, FileAccess.Write))
+                {
+                    byte[] data = ms.ToArray();
+                    fs.Write(data, 0, data.Length);
+                    fs.Flush();
+                }
+                ms.Close();
+                ms.Dispose();
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+
+        /// <summary>
+        /// 导出数据到指定目录
+        /// </summary>
+        /// <param name="xyzsList"></param>
+        /// <param name="fileName"></param>
+        private static void ExportToExcel2(List<CalcContext> contexts, string fileName, int filterIndex = 0)
+        {
+            try
+            {
+                IWorkbook book = new XSSFWorkbook();
+
+                #region 添加数据
+                ISheet sheet = book.CreateSheet("Summary");
+
+                #region 添加表头
+
+                IRow row = sheet.CreateRow(0);
+                NPOI.SS.UserModel.ICell cell0 = row.CreateCell(0);
+                cell0.SetCellType(NPOI.SS.UserModel.CellType.String);
+                cell0.SetCellValue("楼层名称");
+
+                ICell cell1 = row.CreateCell(1);
+                cell1.SetCellType(NPOI.SS.UserModel.CellType.String);
+                cell1.SetCellValue("类型");
+
+                ICell cell2 = row.CreateCell(2);
+                cell2.SetCellType(NPOI.SS.UserModel.CellType.String);
+                cell2.SetCellValue("总数");
+
+                List<string> list = new List<string>() { "FASE-光电感烟探测器", "FASE-智能感温探测器", "FSCP-消火栓起泵按钮" };
+                var list2 = list.Select(tt => tt.Substring(0, 4)).ToList();
+                int index = 0;
+                foreach (var context in contexts)
+                {
+                    var floorName = context.MFloor.ToString();
+
+
+                    #endregion
+                    Action<int> action = (count) =>
+                    {
+                        index++;
+
+                        row = sheet.CreateRow(index);
+
+                        ICell cell = row.CreateCell(0, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(floorName);
+
+                        cell = row.CreateCell(1, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(string.Join(",", list));
+
+                        cell = row.CreateCell(2, NPOI.SS.UserModel.CellType.String);
+                        cell.SetCellValue(count);
+
+                    };
+                    action(context.MEquipments.Where(t => list2.Contains(t.EquipClassCode)).Count());
+
+                }
+
+                #endregion
+
+                #region 写入
+
+                MemoryStream ms = new MemoryStream();
+                book.Write(ms);
+                book = null;
+
+                using (System.IO.FileStream fs = new System.IO.FileStream(fileName, FileMode.Create, FileAccess.Write))
+                {
+                    byte[] data = ms.ToArray();
+                    fs.Write(data, 0, data.Length);
+                    fs.Flush();
+                }
+                ms.Close();
+                ms.Dispose();
+
+                #endregion
+
+            }
+            catch (Exception e)
+            {
+                MessageShowBase.Show(e);
+            }
+        }
+
+        class ExportItemGroup
+        {
+            public ExportItemGroup(string floorName)
+            {
+                FloorName = floorName;
+                Items = new List<ExportItem>();
+            }
+            public List<ExportItem> Items { get; set; }
+            public string FloorName { get; set; }
+        }
+        class ExportItem
+        {
+            public string  SystemName { get; set; }
+            public string SystemType { get; set; }
+            public string Type { get; set; }
+        }
+    }
+}

+ 5 - 1
MBI/SAGA.MBI/ToolsData/ModeCheck/ElementRangeCheck.cs

@@ -195,7 +195,7 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                     zb = space.GetBaseStaticHeight();
                     zt = space.GetTopStaticHeight();
                 }
-                else 
+                else if(element is FamilyInstance)
                 {
                     if (element.IsAllColumn())
                     {
@@ -218,6 +218,10 @@ namespace SAGA.MBI.ToolsData.ModeCheck
                         result = null;
                     }
                 }
+                else
+                {
+                    result = null;
+                }
                 if (isBoxInst)
                 {
                     rb = zb.IsBetween(hb - w, hb);