xulisong %!s(int64=6) %!d(string=hai) anos
pai
achega
9507263fa6
Modificáronse 27 ficheiros con 540 adicións e 82 borrados
  1. BIN=BIN
      MBI/MBIResource/BaseDB/MBIAssistData.db
  2. 12 0
      MBI/Menu/SAGABIM.xml
  3. 35 17
      MBI/SAGA.DotNetUtils/Data.Framework/AbstractDal.cs
  4. 17 0
      MBI/SAGA.DotNetUtils/Data.Framework/Bll.cs
  5. 39 9
      MBI/SAGA.DotNetUtils/Data.Framework/Database.cs
  6. 4 0
      MBI/SAGA.DotNetUtils/Data.Framework/IDal.cs
  7. 16 10
      MBI/SAGA.DotNetUtils/Data.Framework/Sqlite/SqliteDal.cs
  8. 6 1
      MBI/SAGA.DotNetUtils/Data.Framework/Sqlite/SqliteDatabase.cs
  9. 1 0
      MBI/SAGA.DotNetUtils/SAGA.DotNetUtils.csproj
  10. 52 0
      MBI/SAGA.DotNetUtils/Utilities/TimeUtil.cs
  11. 3 1
      MBI/SAGA.GplotManage/Command.cs
  12. 4 0
      MBI/SAGA.GplotManage/SAGA.GplotManage.csproj
  13. 9 9
      MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml
  14. 3 3
      MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml.cs
  15. 116 9
      MBI/SAGA.GplotManage/SystemChecks/VmSystemCheck.cs
  16. 3 3
      MBI/SAGA.GplotManage/SystemChecks/WinSystemCheck.xaml
  17. 3 2
      MBI/SAGA.GplotManage/SystemChecks/WinSystemCheck.xaml.cs
  18. 1 1
      MBI/SAGA.GplotRelationComputerManage/Common/FloorUtil.cs
  19. 11 0
      MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj
  20. 3 3
      MBI/SAGA.GplotRelationComputerManage/SystemChecks/ErrorCodeUtil.cs
  21. 56 9
      MBI/SAGA.GplotRelationComputerManage/SystemChecks/FloorCheckItem.cs
  22. 45 4
      MBI/SAGA.GplotRelationComputerManage/SystemChecks/GplotSystemCheckManager.cs
  23. 44 0
      MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/ModelConverterUtil.cs
  24. 13 0
      MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/SystemCheckResultItem.cs
  25. 2 0
      MBI/SAGA.GplotRelationComputerManage/packages.config
  26. 39 1
      MBI/SAGA.MBI/TestCommand.cs
  27. 3 0
      MBI/SAGA.MBIAssistData/BLL/SystemCheckReportBll.cs

BIN=BIN
MBI/MBIResource/BaseDB/MBIAssistData.db


+ 12 - 0
MBI/Menu/SAGABIM.xml

@@ -547,6 +547,18 @@
       <MenuTab>SJJC_W</MenuTab>
       <Modules>SJJC</Modules>
     </Button>
+<Button ButtonStyles="Large">
+      <ButtonName>SAGA.GplotManage.CheckSystemCommand</ButtonName>
+      <ButtonText>管网检查</ButtonText>
+      <ImageName>10、空间管理</ImageName>
+      <DllName>..\OutputDll\SAGA.GplotManage.exe</DllName>
+      <ClassName>SAGA.GplotManage.CheckSystemCommand</ClassName>
+      <ToolTip>管网检查</ToolTip>
+      <LongDescription>管网检查</LongDescription>
+      <ToolTipImage></ToolTipImage>
+      <MenuTab>SJJC_W</MenuTab>
+      <Modules>SJJC</Modules>
+    </Button>
   </Panel>
 </Menus>
 <!--名称里面换行-->

+ 35 - 17
MBI/SAGA.DotNetUtils/Data.Framework/AbstractDal.cs

@@ -186,24 +186,25 @@ namespace Saga.Framework.DB
             string commandText = string.Format("Select * From {0} ", TableName);
             if (!string.IsNullOrWhiteSpace(condition))
             {
-                commandText += string.Format("Where {0} ", condition);
+                commandText += string.Format(" Where {0} ", condition);
             }
             if (!string.IsNullOrWhiteSpace(orderBy))
             {
-                commandText = commandText + " " + orderBy;
+                commandText = commandText + " Order By " + orderBy;
             }
             else if(!string.IsNullOrWhiteSpace(DefaultSortField))
             {
-                commandText = commandText + "" + "order by " + DefaultSortField + " ASC";
+                commandText = commandText +" Order By " + DefaultSortField + " ASC";
             }
             Database database = CreateDatabase();
-            using (IDataReader dataReader = database.ExecuteReader(commandText, parameters))
-            {
-                if (dataReader.Read())
+            database.ExecuteReader(commandText, (dataReader) =>
                 {
-                    result = this.ReaderToEntity(dataReader);
-                }
-            }
+                    if (dataReader.Read())
+                    {
+                        result = this.ReaderToEntity(dataReader);
+                    }
+                },
+                parameters);          
             return result;
         }
 
@@ -235,14 +236,15 @@ namespace Saga.Framework.DB
             }
             Database database = CreateDatabase();
             List<T> list = new List<T>();
-            using (System.Data.IDataReader dataReader = database.ExecuteReader(commandText, parameters))
-            {
-                while (dataReader.Read())
+            database.ExecuteReader(commandText, (dataReader) =>
                 {
-                    var item = this.ReaderToEntity(dataReader);
-                    list.Add(item);
-                }
-            }
+                    while (dataReader.Read())
+                    {
+                        var item = this.ReaderToEntity(dataReader);
+                        list.Add(item);
+                    }
+                },
+                parameters);      
             return list;
         }
         #endregion
@@ -392,6 +394,19 @@ namespace Saga.Framework.DB
             string condition = string.Format("{0} = {1}{0}", this.PrimaryKey, this.ParameterPrefix);
             return UpdateByCondition(EntityToRecord(obj), condition, trans, CreatePrimaryKeyParameter(primaryKeyValue));
         }
+
+        public virtual bool Update(Hashtable recordFields, object primaryKeyValue)
+        {
+            string condition = string.Format("{0} = {1}{0}", this.PrimaryKey, this.ParameterPrefix);
+            return UpdateByCondition(recordFields, condition, null, CreatePrimaryKeyParameter(primaryKeyValue));
+        }
+
+        public virtual bool Update(Hashtable recordFields, object primaryKeyValue, DbTransaction trans)
+        {
+            string condition = string.Format("{0} = {1}{0}", this.PrimaryKey, this.ParameterPrefix);
+            return UpdateByCondition(recordFields, condition, trans, CreatePrimaryKeyParameter(primaryKeyValue));
+        }
+
         public virtual bool UpdateByCondition(T obj, string condition)
         {
             return UpdateByCondition(obj, condition, null);
@@ -412,7 +427,10 @@ namespace Saga.Framework.DB
                 }
                 else
                 {
-                    recordFields.Remove(this.PrimaryKey);
+                    if (!string.IsNullOrWhiteSpace(this.PrimaryKey))
+                    {
+                        recordFields.Remove(this.PrimaryKey);
+                    }                
                     if (recordFields.Count < 1)
                     {
                         return false;

+ 17 - 0
MBI/SAGA.DotNetUtils/Data.Framework/Bll.cs

@@ -65,6 +65,12 @@ namespace Saga.Framework.DB
         }
 
         #region 方法执行
+
+        public virtual Database CreateDatabase()
+        {
+            this.CheckDAL();
+            return this.m_BaseDal.CreateDatabase();
+        }
         #region 查找,查找方式有很多
         public virtual bool ExistByKey(object key)
         {
@@ -186,6 +192,17 @@ namespace Saga.Framework.DB
             this.CheckDAL();
             return this.m_BaseDal.Update(obj, primaryKeyValue, trans);
         }
+        public virtual bool Update(Hashtable recordFields, object primaryKeyValue)
+        {
+            this.CheckDAL();
+            return this.m_BaseDal.Update(recordFields, primaryKeyValue);
+        }
+
+        public virtual bool Update(Hashtable recordFields, object primaryKeyValue, DbTransaction trans)
+        {
+            this.CheckDAL();
+            return this.m_BaseDal.Update(recordFields, primaryKeyValue, trans);
+        }
         public virtual bool UpdateByCondition(T obj, string condition)
         {
             this.CheckDAL();

+ 39 - 9
MBI/SAGA.DotNetUtils/Data.Framework/Database.cs

@@ -54,21 +54,24 @@ namespace Saga.Framework.DB
 
         #region 通用基础方法
 
-        public T CommonExecute<T>(Func<DbCommand, T> realCore, string commandText, params DbParameter[] commandParameters)
+        public T CommonExecute<T>(Func<DbCommand, T> realCore, string commandText,
+            params DbParameter[] commandParameters)
         {
             T result = default(T);
             using (DbConnection connection = CreateConnection())
             {
                 DbCommand cmd = connection.CreateCommand();
                 cmd.CommandText = commandText;
-                foreach (var parameter in commandParameters)
+                if (commandParameters != null)
                 {
-                    cmd.Parameters.Add(parameter);
-                }
+                    foreach (var parameter in commandParameters)
+                    {
+                        cmd.Parameters.Add(parameter);
+                    }
 
+                }
                 result = CommonExecute(realCore, cmd);
             }
-
             return result;
         }
 
@@ -81,6 +84,14 @@ namespace Saga.Framework.DB
             {
                 cmd.Transaction = transaction;
                 cmd.CommandText = commandText;
+                if (commandParameters != null)
+                {
+                    foreach (var parameter in commandParameters)
+                    {
+                        cmd.Parameters.Add(parameter);
+                    }
+
+                }
                 result = CommonExecute(realCore, cmd);
 
             }
@@ -141,11 +152,30 @@ namespace Saga.Framework.DB
         #endregion
 
         #region 查询数据结果
-
-        public IDataReader ExecuteReader(string commandText, params DbParameter[] commandParameters)
+        public IDataReader ExecuteReader(string commandText,Action<IDataReader> shellExecute, params DbParameter[] commandParameters)
         {
-            return CommonExecute<IDataReader>((cmd) => cmd.ExecuteReader(CommandBehavior.CloseConnection),
-                commandText, commandParameters);
+            //return CommonExecute<IDataReader>((cmd) => cmd.ExecuteReader(CommandBehavior.CloseConnection),
+            //    commandText, commandParameters);
+            using (DbConnection connection = CreateConnection())
+            {
+                DbCommand command = connection.CreateCommand();
+                command.CommandText = commandText;
+                if (commandParameters != null)
+                {
+                    foreach (var parameter in commandParameters)
+                    {
+                        command.Parameters.Add(parameter);
+                    }
+                }
+               var reader= CommonExecute<IDataReader>((cmd) => cmd.ExecuteReader(CommandBehavior.CloseConnection),
+                   command);
+                if (shellExecute != null)
+                {
+                    shellExecute(reader);
+                }
+                return reader;
+            }
+          
         }
 
         public IDataReader ExecuteReader(string commandText, DbTransaction transaction,

+ 4 - 0
MBI/SAGA.DotNetUtils/Data.Framework/IDal.cs

@@ -15,6 +15,8 @@ namespace Saga.Framework.DB
      */
     public interface IDal<T> where T : new()
     {
+        Database CreateDatabase();
+       
         #region 查找,查找方式有很多
         bool ExistByKey(object key);
         bool ExistByCondition(string condition);
@@ -48,6 +50,8 @@ namespace Saga.Framework.DB
         #region 修改
         bool Update(T obj, object primaryKeyValue);
         bool Update(T obj, object primaryKeyValue, DbTransaction trans);
+        bool Update(Hashtable recordFields, object primaryKeyValue);
+        bool Update(Hashtable recordFields, object primaryKeyValue, DbTransaction trans);
         bool UpdateByCondition(T obj, string condition);
         bool UpdateByCondition(T obj, string condition, DbTransaction trans);
         bool UpdateByCondition(Hashtable recordFields, string condition, DbTransaction trans,

+ 16 - 10
MBI/SAGA.DotNetUtils/Data.Framework/Sqlite/SqliteDal.cs

@@ -14,6 +14,7 @@ using System.Data.SQLite;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using SAGA.DotNetUtils.DB;
 
 namespace Saga.Framework.DB.Sqlite
 {
@@ -22,7 +23,11 @@ namespace Saga.Framework.DB.Sqlite
     /// </summary>
     /// <typeparam name="T"></typeparam>
     public class SqliteDal<T>: AbstractDal<T>,IDal<T> where T:new ()
-    {     
+    {
+        public SqliteDal()
+        {           
+            ConnectionString = SQLiteHelper.ConnectionString;
+        }
         protected override DbParameter CreatePrimaryKeyParameter(object key)
         {
             var parameter = new SQLiteParameter(this.PrimaryKey, DatabaseUtil.ConvertToDbType(key.GetType()));
@@ -42,25 +47,26 @@ namespace Saga.Framework.DB.Sqlite
             string commandText = string.Format("Select * From {0} ", TableName);
             if (!string.IsNullOrWhiteSpace(condition))
             {
-                commandText += string.Format("Where {0} ", condition);
+                commandText += string.Format(" Where {0} ", condition);
             }
             if (!string.IsNullOrWhiteSpace(orderBy))
             {
-                commandText = commandText + " " + orderBy;
+                commandText = commandText + " Order By " + orderBy;
             }
             else if (!string.IsNullOrWhiteSpace(DefaultSortField))
             {
-                commandText = commandText + "" + "Order by " + DefaultSortField + " ASC";
+                commandText = commandText + " Order By " + DefaultSortField + " ASC";
             }
             commandText = commandText + string.Format("  LIMIT 1");
             Database database = CreateDatabase();
-            using (IDataReader dataReader = database.ExecuteReader(commandText, parameters))
-            {
-                if (dataReader.Read())
+            database.ExecuteReader(commandText, (dataReader) =>
                 {
-                    result = this.ReaderToEntity(dataReader);
-                }
-            }
+                    if (dataReader.Read())
+                    {
+                        result = this.ReaderToEntity(dataReader);
+                    }
+                },
+                parameters);         
             return result;
         }
     }

+ 6 - 1
MBI/SAGA.DotNetUtils/Data.Framework/Sqlite/SqliteDatabase.cs

@@ -36,7 +36,12 @@ namespace Saga.Framework.DB.Sqlite
         /// <returns></returns>
         public override DbTransaction CreateTransaction()
         {
-            return CreateConnection().BeginTransaction();
+            var connnection =CreateConnection();
+            if (connnection.State != ConnectionState.Open)
+            {
+                connnection.Open();
+            }
+            return connnection.BeginTransaction();
         }
         /// <summary>
         /// 生成相关参数

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

@@ -384,6 +384,7 @@
     <Compile Include="Utilities\IWaitingView.cs" />
     <Compile Include="Utilities\PinyinUtil.cs" />
     <Compile Include="Utilities\SharpZip.cs" />
+    <Compile Include="Utilities\TimeUtil.cs" />
     <Compile Include="WinForms\EditorItemValueChangedEventArgs.cs" />
     <Compile Include="WinForms\EditorValueChangedEventArgs.cs" />
     <Compile Include="WinForms\IMEItemDataReader.cs" />

+ 52 - 0
MBI/SAGA.DotNetUtils/Utilities/TimeUtil.cs

@@ -0,0 +1,52 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:TimeUtil
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 17:52:22
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.DotNetUtils.Utilities
+{
+    public class TimeUtil
+    {
+        public static DateTime ConvertDateTime(string timeStr, string format)
+        {
+            DateTime dateTime=DateTime.MinValue;
+            if (!string.IsNullOrWhiteSpace(timeStr)&&DateTime.TryParseExact(timeStr,format,
+                System.Globalization.CultureInfo.InvariantCulture,
+                System.Globalization.DateTimeStyles.None,
+                out dateTime))
+            {
+
+            }
+            return dateTime;
+        }
+        public static DateTime FromDbString(string timeStr)
+        {
+            string format = "yyyyMMdd";
+            if (timeStr.Length > 8)
+            {
+                format = "yyyyMMddhhmmss";
+            }
+            return ConvertDateTime(timeStr, format);
+        }
+    
+        public static string ToDbString(DateTime dateTime)
+        {
+            return dateTime.ToString("yyyyMMddhhmmss");
+        }
+
+        public static string ConvertDbStringFormat(string dbSring,string format)
+        {
+            //如果dbString 不合法,是否直接返回DbString
+            var dateTime = FromDbString(dbSring);
+            return dateTime.ToString(format);
+        }
+    }
+}

+ 3 - 1
MBI/SAGA.GplotManage/Command.cs

@@ -13,6 +13,7 @@ using SAGA.GplotRelationComputerManage;
 using SAGA.GplotRelationComputerManage.SystemChecks;
 using SAGA.GplotManage.SystemChecks;
 using SAGA.DotNetUtils.Data;
+using SAGA.MBI.Common;
 
 namespace SAGA.GplotManage
 {
@@ -184,8 +185,9 @@ namespace SAGA.GplotManage
     {
         public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
         {
+            MBIAssistHelper.SetDBPath();
             #region 核心处理
-            var reportItem = GplotSystemCheckManager.GetCacheCheckSystemResult(ExternalDataWrapper.Current.Doc, "");
+            var reportItem = GplotSystemCheckManager.GetCacheCheckSystemResult(ExternalDataWrapper.Current.Doc, "ChillWaterLoop");
             WinSystemCheck win = new WinSystemCheck(new VmSystemCheck(reportItem));
             win.Show();
             #endregion

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

@@ -196,6 +196,10 @@
       <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
       <Name>SAGA.DotNetUtils</Name>
     </ProjectReference>
+    <ProjectReference Include="..\SAGA.MBIAssistData\SAGA.MBIAssistData.csproj">
+      <Project>{A36305AB-217A-4A6B-8B78-EA79497B1807}</Project>
+      <Name>SAGA.MBIAssistData</Name>
+    </ProjectReference>
     <ProjectReference Include="..\SAGA.MBI\SAGA.MBI.csproj">
       <Project>{f6216892-a198-4991-820a-4a2f2637103e}</Project>
       <Name>SAGA.MBI</Name>

+ 9 - 9
MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml

@@ -3,13 +3,13 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:SqliteTest"
+             xmlns:systemChecks="clr-namespace:SAGA.GplotManage.SystemChecks"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800" Name="this" Height="{Binding Height,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}"
              Width="{Binding Width,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UIElement}}">
     <UserControl.Resources>
-        <local:BoolToTextConverter x:Key="Corrected" TrueText="重新修改" FalseText="已改正"></local:BoolToTextConverter>
-        <local:BoolToTextConverter x:Key="Misinformation" TrueText="错误" FalseText="误报"></local:BoolToTextConverter>
+        <systemChecks:BoolToTextConverter x:Key="Corrected" TrueText="重新修改" FalseText="已改正"></systemChecks:BoolToTextConverter>
+        <systemChecks:BoolToTextConverter x:Key="Misinformation" TrueText="错误" FalseText="误报"></systemChecks:BoolToTextConverter>
         <Style x:Key="CenterAlignmentStyle" TargetType="TextBlock">
             <Setter Property="TextAlignment" Value="Center"/>
             <Setter Property="VerticalAlignment" Value="Center"/>
@@ -74,17 +74,17 @@
                 </Style>
             </DataGrid.ColumnHeaderStyle>
             <DataGrid.Columns>
-                <DataGridTextColumn IsReadOnly="True" Width="*" MinWidth="80" Header="BIMID" Binding="{Binding Name}" ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="*" MinWidth="100" Header="管网类型" ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
-                <DataGridTextColumn IsReadOnly="True" Width="*" MinWidth="80" Header="流向" ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
+                <DataGridTextColumn Binding="{Binding BimId}" IsReadOnly="True" Width="*" MinWidth="80" Header="BIMID"  ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
+                <DataGridTextColumn Binding="{Binding SystemName}" IsReadOnly="True" Width="*" MinWidth="100" Header="管网类型" ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
+                <DataGridTextColumn Binding="{Binding FlowDirection}" IsReadOnly="True" Width="*" MinWidth="80" Header="流向" ElementStyle="{StaticResource CenterAlignmentStyle}"></DataGridTextColumn>
                 <DataGridTemplateColumn Header="操作" Width="Auto" MinWidth="350">
                     <DataGridTemplateColumn.CellTemplate>
                         <DataTemplate>
                             <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" >
-                                <Button Width="80" VerticalAlignment="Center" Content="模型定位"  Command="{x:Static local:CheckSystemResultView.FixedPositionCommand}" CommandParameter="{Binding}"     Margin="5,0,5,0"/>
-                                <Button Width="80" VerticalAlignment="Center" Content="{Binding IsCorrected,Converter={StaticResource Corrected}}"   Command="{x:Static local:CheckSystemResultView.CorrectedCommand}" CommandParameter="{Binding}"    Margin="5,0,5,0">
+                                <Button Width="80" VerticalAlignment="Center" Content="模型定位"  Command="{x:Static systemChecks:CheckSystemResultView.FixedPositionCommand}" CommandParameter="{Binding}"     Margin="5,0,5,0"/>
+                                <Button Width="80" VerticalAlignment="Center" Content="{Binding IsCorrected,Converter={StaticResource Corrected}}"   Command="{x:Static systemChecks:CheckSystemResultView.CorrectedCommand}" CommandParameter="{Binding}"    Margin="5,0,5,0">
                                 </Button>
-                                <Button Width="80" VerticalAlignment="Center" Content="{Binding IsMisinformation,Converter={StaticResource Misinformation}}" Command="{x:Static local:CheckSystemResultView.MakeMisinformedCommand}" CommandParameter="{Binding}"   Margin="5,0,5,0">
+                                <Button Width="80" VerticalAlignment="Center" Content="{Binding IsMisinformation,Converter={StaticResource Misinformation}}" Command="{x:Static systemChecks:CheckSystemResultView.MakeMisinformedCommand}" CommandParameter="{Binding}"   Margin="5,0,5,0">
                                 </Button>
                             </StackPanel>
                         </DataTemplate>

+ 3 - 3
MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml.cs

@@ -58,7 +58,7 @@ namespace SAGA.GplotManage.SystemChecks
         
 
         public static DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource",
-            typeof(List<SystemCheckResultItem>), typeof(CheckSystemResultView),
+            typeof(IEnumerable<SystemCheckResultItem>), typeof(CheckSystemResultView),
             new PropertyMetadata(null, ItemsSourceChangedCallback));
 
         internal static void ItemsSourceChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
@@ -75,9 +75,9 @@ namespace SAGA.GplotManage.SystemChecks
         /// <summary>
         /// 数据源
         /// </summary>
-        public List<SystemCheckResultItem> ItemsSource
+        public IEnumerable<SystemCheckResultItem> ItemsSource
         {
-            get { return (List<SystemCheckResultItem>) this.GetValue(ItemsSourceProperty); }
+            get { return (IEnumerable<SystemCheckResultItem>) this.GetValue(ItemsSourceProperty); }
             set { this.SetValue(ItemsSourceProperty, value); }
         }
     }

+ 116 - 9
MBI/SAGA.GplotManage/SystemChecks/VmSystemCheck.cs

@@ -12,9 +12,18 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using Autodesk.Revit.DB;
+using Autodesk.Revit.UI;
+using SAGA.DotNetUtils;
+using SAGA.DotNetUtils.Data;
+using SAGA.DotNetUtils.Utilities;
 using SAGA.DotNetUtils.WPF;
+using SAGA.GplotRelationComputerManage;
 using SAGA.GplotRelationComputerManage.SystemChecks;
+using SAGA.MBIAssistData;
+using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.Windows;
 
 namespace SAGA.GplotManage.SystemChecks
 {
@@ -27,9 +36,65 @@ namespace SAGA.GplotManage.SystemChecks
         }
         public VmSystemCheck(SystemCheckReportItem reportItem)
         {
-            this.m_CurrentReport = reportItem;
+            this.CurrentReport = reportItem;
+        }
+
+        private void SetFloorDisplay(SystemCheckReportItem reportItem)
+        {
+            if (reportItem == null)
+                return;
+            #region 开头显示
+            var mbiInfo = FloorUtil.GetFloorInfo(reportItem.FloorId);
+            if (mbiInfo != null)
+            {
+                FloorDisplay = string.Format("{0} → {1}", mbiInfo.BuildingName, mbiInfo.FloorName);
+            }
+            else
+            {
+                FloorDisplay = reportItem.FloorId;
+            }
+            #endregion
+
+            #region 标题显示
+            //{0}管网异常模型清单(最后检查时间  {1})
+            var relationItem = RelationTypeManager.GetRelationTypeItem(reportItem.GplotType);
+            var timestring=TimeUtil.ConvertDbStringFormat(reportItem.BuildingTime, "yyyyMMdd (hh:mm)");
+            //reportItem.BuildingTime
+            Title = string.Format("{0}管网异常模型清单(最后检查时间  {1})", relationItem?.Name, timestring);
+
+            #endregion
+
         }
         #region 属性相关
+
+        private string m_Title;
+        /// <summary>
+        /// 标题设定
+        /// </summary>
+        public string Title
+        {
+            get { return this.m_Title; }
+            set
+            {
+                this.m_Title = value;
+                RaisePropertyChanged(nameof(this.Title));
+            }
+        }
+
+        private string m_FloorDisplay;
+        /// <summary>
+        /// 楼层显示信息
+        /// </summary>
+        public string FloorDisplay
+        {
+            get { return this.m_FloorDisplay; }
+            set
+            {
+                this.m_FloorDisplay = value;
+                RaisePropertyChanged(nameof(this.FloorDisplay));
+            }
+        }
+
         private SystemCheckReportItem m_CurrentReport;
         /// <summary>
         /// 当前检查结果
@@ -48,6 +113,7 @@ namespace SAGA.GplotManage.SystemChecks
                 {
                     this.ResultItems = new ObservableCollection<SystemCheckResultItem>();
                 }
+                SetFloorDisplay(value);
                 RaisePropertyChanged(() => this.CurrentReport);
             }
         }
@@ -75,10 +141,18 @@ namespace SAGA.GplotManage.SystemChecks
         [Command]
         public void ReCheckCommand(object parameter)
         {
-            var reportItem = GplotSystemCheckManager.GetCheckSystemResult(ExternalDataWrapper.Current.Doc, "");
-            if(reportItem!=null)
+            try
             {
-                CurrentReport = reportItem;
+                var reportItem = GplotSystemCheckManager.CreateCheckSystemResult(ExternalDataWrapper.Current.Doc, CurrentReport?.GplotType);
+                if (reportItem != null)
+                {
+                    CurrentReport = reportItem;
+                }
+            }
+            catch (Exception ex)
+            {
+
+                MessageShow.Show(ex);
             }
         }
         public bool CanReCheckCommand(object parameter)
@@ -90,7 +164,17 @@ namespace SAGA.GplotManage.SystemChecks
         #region 定位
         public void PositionCommand(object parameter)
         {
-            MessageBox.Show(parameter.ToString());
+            var item = parameter as SystemCheckResultItem;
+            if (item == null)
+                return;
+            ExecuteCmd.ExecuteCommandOnce(() =>
+            {
+                var bimId = item.BimId;
+                Element elem = ExternalDataWrapper.Current.Doc.GetElement(new ElementId(bimId.ToInt()));
+                if (elem == null) return Result.Failed;
+                ExternalDataWrapper.Current.UiApp.SetShowElements(elem);
+                return Result.Succeeded;
+            }, () => Result.Succeeded);
         }
         #endregion
 
@@ -98,8 +182,19 @@ namespace SAGA.GplotManage.SystemChecks
         public void ConcrectedCommand(object parameter)
         {
             var item = parameter as SystemCheckResultItem;
-            MessageBox.Show(item.IsCorrected.ToString());
-            item.IsCorrected = !item.IsCorrected;
+            if (item == null)
+                return;
+            try
+            {
+                //MessageBox.Show(item.IsCorrected.ToString());
+                var useFlag = !item.IsCorrected;
+                SingleFactory<SystemCheckResultBll>.Instance.UpdateCorrectedFlag(useFlag, item.Id);            
+                item.IsCorrected = useFlag;
+            }
+            catch (Exception ex)
+            {
+                MessageShow.Show(ex);
+            }
         }
         #endregion
 
@@ -107,8 +202,20 @@ namespace SAGA.GplotManage.SystemChecks
         public void MisinformationCommand(object parameter)
         {
             var item = parameter as SystemCheckResultItem;
-            MessageBox.Show(item.IsMisinformation.ToString());
-            item.IsMisinformation = !item.IsMisinformation;
+            if (item == null)
+                return;
+            try
+            {
+                //MessageBox.Show(item.IsMisinformation.ToString());
+                var useFlag = !item.IsMisinformation;
+                SingleFactory<SystemCheckResultBll>.Instance.UpdateMisinformationFlag(useFlag, item.Id);
+                item.IsMisinformation = useFlag;
+            }
+            catch (Exception ex)
+            {
+
+                MessageShow.Show(ex);
+            }
         }
         #endregion
     }

+ 3 - 3
MBI/SAGA.GplotManage/SystemChecks/WinSystemCheck.xaml

@@ -5,7 +5,7 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:SAGA.GplotManage.SystemChecks"
         xmlns:windows="clr-namespace:SAGA.RevitUtils.Windows;assembly=SAGA.RevitUtils"
-        mc:Ignorable="d" Title="管网异常清单" WindowStartupLocation="CenterScreen"
+        mc:Ignorable="d" Title="{Binding Title,Mode=OneWay}" WindowStartupLocation="CenterScreen"
                  Height="550" Width="580">
     <windows:WinBase.Resources>
         <CollectionViewSource x:Key="SourceGroupByClassCode" Source="{Binding Path=MissFMEquips,NotifyOnSourceUpdated=True}">
@@ -45,13 +45,13 @@
             </Grid.ColumnDefinitions>
             <StackPanel HorizontalAlignment="Stretch" Orientation="Horizontal">
                 <Label Height="25" Content="当前模型:"  VerticalContentAlignment="Center"></Label>
-                <TextBlock   Text="{Binding Path=FloorLocaltion}"  VerticalAlignment="Center"></TextBlock>
+                <TextBlock   Text="{Binding Path=FloorDisplay}"  VerticalAlignment="Center"></TextBlock>
             </StackPanel>
 
             <Button Command="{Binding Commands.ReCheckCommand}" Grid.Column="1" Height="25" Width="100" Content="重新检测"   HorizontalAlignment="Right"></Button>
         </Grid>
 
-        <local:CheckSystemResultView Grid.Row="1" ItemsSource="{Binding ResultItems}"></local:CheckSystemResultView>
+        <local:CheckSystemResultView x:Name="View" Grid.Row="1" ItemsSource="{Binding ResultItems,Mode=TwoWay}"></local:CheckSystemResultView>
 
     </Grid>
 </windows:WinBase>

+ 3 - 2
MBI/SAGA.GplotManage/SystemChecks/WinSystemCheck.xaml.cs

@@ -24,13 +24,14 @@ namespace SAGA.GplotManage.SystemChecks
         private VmSystemCheck m_Vm;
         public WinSystemCheck():this(new VmSystemCheck())
         {
-            InitializeComponent();       
+            
         }
 
         public WinSystemCheck(VmSystemCheck vm)
         {
+            InitializeComponent();
+            this.m_Vm = vm;
             this.DataContext = this.m_Vm;
-
             this.CommandBindings.Add(new CommandBinding(CheckSystemResultView.FixedPositionCommand,
                (e, arg) => { this.m_Vm?.PositionCommand(arg.Parameter); }));
             this.CommandBindings.Add(new CommandBinding(CheckSystemResultView.CorrectedCommand,

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/Common/FloorUtil.cs

@@ -43,7 +43,7 @@ namespace SAGA.GplotRelationComputerManage
         /// <returns></returns>
         public static MBIFloorInfo GetFloorInfo(string floorId)
         {
-            m_Floors.TryGetValue(floorId, out MBIFloorInfo info);
+            Floors.TryGetValue(floorId, out MBIFloorInfo info);
             return info;
         }
     }

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

@@ -39,6 +39,9 @@
     <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="AutoMapper, Version=8.0.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
+      <HintPath>..\packages\AutoMapper.8.0.0\lib\net461\AutoMapper.dll</HintPath>
+    </Reference>
     <Reference Include="FWindSoft, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\Dlls\FirmLibDll\FWindSoft.dll</HintPath>
@@ -77,6 +80,9 @@
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Transactions" />
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
+    </Reference>
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -161,6 +167,7 @@
     <Compile Include="SystemChecks\FloorCheckItem.cs" />
     <Compile Include="SystemChecks\GplotSystemCheckContext.cs" />
     <Compile Include="SystemChecks\GplotSystemCheckManager.cs" />
+    <Compile Include="SystemChecks\Model\ModelConverterUtil.cs" />
     <Compile Include="SystemChecks\Model\SystemCheckResultItem.cs" />
     <Compile Include="SystemChecks\Model\SystemCheckReportItem.cs" />
     <Compile Include="SystemRelation\Common\PointItemType.cs" />
@@ -196,6 +203,10 @@
       <Project>{07b73c98-dcb0-4782-81fa-f50a30b563ab}</Project>
       <Name>SAGA.DotNetUtils</Name>
     </ProjectReference>
+    <ProjectReference Include="..\SAGA.MBIAssistData\SAGA.MBIAssistData.csproj">
+      <Project>{A36305AB-217A-4A6B-8B78-EA79497B1807}</Project>
+      <Name>SAGA.MBIAssistData</Name>
+    </ProjectReference>
     <ProjectReference Include="..\SAGA.MBI\SAGA.MBI.csproj">
       <Project>{f6216892-a198-4991-820a-4a2f2637103e}</Project>
       <Name>SAGA.MBI</Name>

+ 3 - 3
MBI/SAGA.GplotRelationComputerManage/SystemChecks/ErrorCodeUtil.cs

@@ -14,9 +14,9 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         private static Dictionary<string, string> m_Errors = new Dictionary<string, string>();
         static ErrorCodeUtil()
         {
-            m_Errors.Add("001", "abcd");
-            m_Errors.Add("002", "abcd");
-            m_Errors.Add("003", "abcd");
+            m_Errors.Add("001", "末端未连接任何设备");
+            m_Errors.Add("002", "管道两端存在不同类型管道");
+            m_Errors.Add("003", "设备两端存在不同类型的管道");
         }
 
         /// <summary>

+ 56 - 9
MBI/SAGA.GplotRelationComputerManage/SystemChecks/FloorCheckItem.cs

@@ -11,8 +11,12 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Autodesk.Revit.DB;
+using Autodesk.Revit.DB.Plumbing;
+using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Utilities;
 using SAGA.MBI.Tools;
+using SAGA.RevitUtils.Extends;
+using SAGA.RevitUtils.MEP;
 
 namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
@@ -46,9 +50,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         public Level UseLevel { get; private set; }
         #endregion
         public void Parse(GplotSystemCheckContext context)
-        {
-            if (UseLevel == null)
-                return;
+        {     
             var doc = Document;
             var relations = context.Relations;
             foreach (var relation in relations)
@@ -59,16 +61,61 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         }
         private void ParseSystem(GplotSystemCheckContext context,RelationTypeShell shell, Domain domain)
         {
-            SystemCheckReportItem item = new SystemCheckReportItem();
             SystemCheckReportItem reportItem = new SystemCheckReportItem();
-            reportItem.Id = GuidUtil.GetNString();
-            reportItem.FloorId = Document.PathName.GetFloorId();
+            reportItem.FloorId = Document.PathName.GetFileName();
             reportItem.GplotType = shell.RelationItem.Type;
-            reportItem.BuildingTime = DateTime.Now.ToString("yyyyMMddmmhhss");
-          
+            reportItem.BuildingTime = TimeUtil.ToDbString(DateTime.Now);
+            #region 测试
+            //reportItem.FloorId = Document.PathName.GetFileName();
+            //reportItem.GplotType = shell.RelationItem.Type;
+            //reportItem.BuildingTime = DateTime.Now.ToString("yyyyMMddmmhhss");
+            //for (int i = 0; i < 30; i++)
+            //{
+            //    SystemCheckResultItem item = new SystemCheckResultItem();
+            //    item.BimId = i.ToString();
+            //    item.SystemName = "循环供水";
+            //    item.FlowDirection = "位置";
+            //    item.IsCorrected = false;
+            //    item.IsMisinformation = false;
+            //    item.ErrorCode = "00" + (i % 3 + 1);//ErrorCodeUtil.GetErrorDescription("00" + (i % 3 + 1));
+            //    reportItem.ResultItems.Add(item);
+            //}
+            #endregion
 
+            var elements = Document.FilterElements<MEPCurve>().Where(p => shell.IsMatchSystem(p.GetSystemTypeName())).ToList();
+            foreach (var element in elements)
+            {
+                var connectors = element.GetConnectors(domain);
+                SystemCheckResultItem item = new SystemCheckResultItem();
+                item.BimId = element.Id.ToString();
+                item.SystemName = element.GetSystemTypeName();
+                item.FlowDirection = "未知";
+                item.IsCorrected = false;
+                item.IsMisinformation = false;
+                if (!connectors.All(c => c.IsConnected))
+                {
+                    item.ErrorCode = "001";
+                    reportItem.ResultItems.Add(item);
+                    continue;
+                }
 
-            context.ReportItems.Add(reportItem);
+                var pipes1 = element.GetFirstElements<MEPCurve>(connectors[0]);
+                var pipes2 = element.GetFirstElements<MEPCurve>(connectors[1]);
+                List<MEPCurve> curves = new List<MEPCurve>();
+                curves.AddRange(pipes1);
+                curves.AddRange(pipes2);
+                foreach (var pipe1 in curves)
+                {
+                    if (item.SystemName != pipe1.GetSystemTypeName())
+                    {
+                        item.ErrorCode = "002";
+                        reportItem.ResultItems.Add(item);
+                        break;
+                    }
+                }
+                //    //if(pipe)
+               }
+                context.ReportItems.Add(reportItem);
         }
 
     }

+ 45 - 4
MBI/SAGA.GplotRelationComputerManage/SystemChecks/GplotSystemCheckManager.cs

@@ -11,6 +11,12 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Autodesk.Revit.DB;
+using SAGA.DotNetUtils.Data;
+using SAGA.DotNetUtils.Extend;
+using SAGA.DotNetUtils.Utilities;
+using SAGA.MBI.Tools;
+using SAGA.MBIAssistData;
+using SAGA.MBIAssistData.Model;
 
 namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
@@ -29,7 +35,14 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
                 var floorItem = new FloorCheckItem(document);
                 floorItem.Parse(context);
             }
-            //向数据库提交信息
+            #region 向数据库提交信息
+
+            foreach (var reportItem in context.ReportItems)
+            {
+                SingleFactory<SystemCheckReportBll>.Instance.CreateReport(
+                    ModelConverterUtil.ReportFormReportItem(reportItem), reportItem.ResultItems.Select(ri=>ModelConverterUtil.ResultFormResultItem(ri)).ToList());            
+            }
+            #endregion
         }
 
         public static SystemCheckReportItem GetCacheCheckSystemResult(Document document, string gplotType)
@@ -37,13 +50,41 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
             /*
              *  判断数据库中是否存在;存在直接查询数据库返回;不存在的话进行检测,再返回
              */
-            return GetCheckSystemResult(document, gplotType);
+            string floorId = document.PathName.GetFileName();
+            if (string.IsNullOrWhiteSpace(floorId) || string.IsNullOrWhiteSpace(gplotType))
+            {
+                throw new Exception("图类型不能为null");
+            }            
+            var exist=SingleFactory<SystemCheckReportBll>.Instance.ExistReport(floorId, gplotType);
+            if (exist)
+            {
+                return GetReportItem(floorId,gplotType);
+            }
+            return CreateCheckSystemResult(document, gplotType);
         }
 
-        public static SystemCheckReportItem GetCheckSystemResult(Document document, string gplotType)
+        public static SystemCheckReportItem CreateCheckSystemResult(Document document, string gplotType)
         {
+            string floorId = document.PathName.GetFileName();
+            if (string.IsNullOrWhiteSpace(floorId) || string.IsNullOrWhiteSpace(gplotType))
+            {
+                throw new Exception("图类型不能为null");
+            }
             CheckSystem(new List<Document>() { document }, new List<string>() { gplotType });
-            return new SystemCheckReportItem();
+            return GetReportItem(floorId, gplotType);
+        }
+
+        private static SystemCheckReportItem GetReportItem(string floorId, string gplotType)
+        {
+            var report = SingleFactory<SystemCheckReportBll>.Instance.GetCurrentReport(floorId, gplotType);
+            if (report != null)
+            {
+                var item = ModelConverterUtil.ReportItemFormReport(report);
+                var results = SingleFactory<SystemCheckResultBll>.Instance.FindResults(report.Id);
+                results.ForEach(r => item.ResultItems.Add(ModelConverterUtil.ResultItemFormResult(r)));
+                return item;
+            }
+            return null;
         }
     }
 }

+ 44 - 0
MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/ModelConverterUtil.cs

@@ -0,0 +1,44 @@
+/*-------------------------------------------------------------------------
+ * 功能描述:ModelConverterUtil
+ * 作者:xulisong
+ * 创建时间: 2019/3/1 9:01:29
+ * 版本号:v1.0
+ *  -------------------------------------------------------------------------*/
+
+using SAGA.MBIAssistData.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using AutoMapper;
+using SAGA.GplotRelationComputerManage.SystemChecks;
+
+namespace SAGA.GplotRelationComputerManage
+{
+    public class ModelConverterUtil
+    {
+        public static D Map<S, D>(S source)
+        {
+            MapperConfiguration config = new MapperConfiguration((c => c.CreateMap<S, D>()));        
+            var mapper = config.CreateMapper();
+            return mapper.Map<D>(source);
+        }
+        public static SystemCheckResult ResultFormResultItem(SystemCheckResultItem  resultItem)
+        {
+            return ModelConverterUtil.Map<SystemCheckResultItem,SystemCheckResult>(resultItem);
+        }
+        public static SystemCheckResultItem ResultItemFormResult(SystemCheckResult result)
+        {
+            return ModelConverterUtil.Map<SystemCheckResult,SystemCheckResultItem>(result);
+        }
+        public static SystemCheckReport ReportFormReportItem(SystemCheckReportItem resultItem)
+        {
+            return ModelConverterUtil.Map<SystemCheckReportItem,SystemCheckReport>(resultItem);
+        }
+        public static SystemCheckReportItem ReportItemFormReport(SystemCheckReport result)
+        {
+            return ModelConverterUtil.Map<SystemCheckReport,SystemCheckReportItem>(result);
+        }
+    }
+}

+ 13 - 0
MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/SystemCheckResultItem.cs

@@ -66,6 +66,19 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         }
 
 
+        private string m_SystemName;
+        /// <summary>
+        /// 系统类型
+        /// </summary>
+        public string SystemName
+        {
+            get { return this.m_SystemName; }
+            set
+            {
+                this.m_SystemName = value;
+                RaisePropertyChanged(nameof(this.SystemName));
+            }
+        }
 
         private string m_FlowDirection;
         /// <summary>

+ 2 - 0
MBI/SAGA.GplotRelationComputerManage/packages.config

@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
+  <package id="AutoMapper" version="8.0.0" targetFramework="net461" />
   <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
 </packages>

+ 39 - 1
MBI/SAGA.MBI/TestCommand.cs

@@ -54,7 +54,45 @@ namespace SAGA.MBI
 
                                 contexts.Add(new CalcContext(floor.MFloor));
                             }
-                            MBIModelInfoUpload.UpdateMbiInfo(contexts);
+                            //MBIModelInfoUpload.UpdateMbiInfo(contexts);
+
+                            #region 检测连接模型
+                            Dictionary<string, bool> results = new Dictionary<string, bool>();
+                            foreach (var context in contexts)
+                            {
+                                if (context == null) continue;
+                                try
+                                {
+                                    context.OpenDocument();
+                                    Document doc = context.RevitDoc;
+                                    MbiElementManager.ExecuteExport(doc);
+                                    var floorId = doc.PathName.GetFileName();
+                                    var ins = doc.FilterElements<RevitLinkInstance>();
+                                    if (ins.Any())
+                                    {
+                                        results[floorId] = false;
+                                    }
+                                }
+                                catch (Exception)
+                                {
+
+                                }
+                                finally
+                                {
+                                    context.CloseDocument();
+                                }
+
+                                #endregion
+                            }
+
+                            if (results.Any())
+                            {
+                                MessageShow.Infomation(string.Join(";", results.Keys));
+                            }
+                            else
+                            {
+                                MessageShow.Infomation("不含连接模型");
+                            }
                             break;
                         }
                     case System.Windows.Forms.DialogResult.No:

+ 3 - 0
MBI/SAGA.MBIAssistData/BLL/SystemCheckReportBll.cs

@@ -56,6 +56,9 @@ namespace SAGA.MBIAssistData
 
                 try
                 {
+                    //先删除相关楼层和类型的Report
+                    string condion = string.Format("FloorId='{0}' And GplotType='{1}'", report.FloorId, report.GplotType);
+                    DeleteByCondition(condion, trans);
                     Insert(report, trans);
                     foreach (var systemCheckResult in results)
                     {