Explorar o código

xls:部分代码整理

xls %!s(int64=6) %!d(string=hai) anos
pai
achega
f97279c22d

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

@@ -370,6 +370,7 @@
     <Compile Include="Service\IServiceLocator.cs" />
     <Compile Include="Service\ServiceConfigItem.cs" />
     <Compile Include="Service\ServiceLocator.cs" />
+    <Compile Include="Utilities\GuidUtil.cs" />
     <Compile Include="Utilities\CompressUtil.cs" />
     <Compile Include="Utilities\FileUp.cs" />
     <Compile Include="Utilities\IniOperator.cs" />

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

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
-    <ProjectView>ShowAllFiles</ProjectView>
+    <ProjectView>ProjectFiles</ProjectView>
   </PropertyGroup>
 </Project>

+ 27 - 0
MBI/SAGA.DotNetUtils/Utilities/GuidUtil.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.DotNetUtils.Utilities
+{
+    public static class GuidUtil
+    {
+        /// <summary>
+        /// 生成N结构字符串。(当Id)
+        /// </summary>
+        /// <returns></returns>
+        public static string GetNString()
+        {
+            return Guid.NewGuid().ToString("N");
+        }
+
+        public static string GetNStringWidthPrefix(string prefix)
+        {
+            prefix = prefix ?? string.Empty;
+            return prefix+Guid.NewGuid().ToString("N");
+        }
+    }
+    
+}

+ 27 - 0
MBI/SAGA.GplotManage/Command.cs

@@ -10,6 +10,9 @@ using SAGA.RevitUtils;
 using SAGA.RevitUtils.Extends;
 using MainWindow = SAGA.GplotDrawData.MainWindow;
 using SAGA.GplotRelationComputerManage;
+using SAGA.GplotRelationComputerManage.SystemChecks;
+using SAGA.GplotManage.SystemChecks;
+using SAGA.DotNetUtils.Data;
 
 namespace SAGA.GplotManage
 {
@@ -170,4 +173,28 @@ namespace SAGA.GplotManage
             return Result.Succeeded;
         }
     }
+
+
+    /// <summary>
+    /// 系统检查
+    /// </summary>
+    [Transaction(TransactionMode.Manual)]
+    [Regeneration(RegenerationOption.Manual)]
+    public class CheckSystemCommand : ExternalCommand
+    {
+        public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
+        {
+            #region 核心处理
+            var reportItem = GplotSystemCheckManager.GetCacheCheckSystemResult(ExternalDataWrapper.Current.Doc, "");
+            WinSystemCheck win = new WinSystemCheck(new VmSystemCheck(reportItem));
+            win.Show();
+            #endregion
+            return Result.Succeeded;
+        }
+        public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
+        {
+            return ExternalDataWrapper.Current.Doc!=null;
+        }
+    }
+
 }

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

@@ -129,6 +129,9 @@
     <Compile Include="GplotManage\GplotView\GplotView.cs" />
     <Compile Include="Command\GplotUtil.cs" />
     <Compile Include="GraphTypeEnum.cs" />
+    <Compile Include="SystemChecks\CheckSystemResultView.xaml.cs">
+      <DependentUpon>CheckSystemResultView.xaml</DependentUpon>
+    </Compile>
     <Compile Include="SystemChecks\VmSystemCheck.cs" />
     <Compile Include="SystemChecks\WinSystemCheck.xaml.cs">
       <DependentUpon>WinSystemCheck.xaml</DependentUpon>
@@ -223,6 +226,10 @@
     </Content>
   </ItemGroup>
   <ItemGroup>
+    <Page Include="SystemChecks\CheckSystemResultView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="SystemChecks\WinSystemCheck.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>

+ 96 - 0
MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml

@@ -0,0 +1,96 @@
+<UserControl x:Class="SAGA.GplotManage.SystemChecks.CheckSystemResultView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             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"
+             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>
+        <Style x:Key="CenterAlignmentStyle" TargetType="TextBlock">
+            <Setter Property="TextAlignment" Value="Center"/>
+            <Setter Property="VerticalAlignment" Value="Center"/>
+        </Style>
+        <Style TargetType="{x:Type GroupItem}" x:Key="GroupStyle">
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="{x:Type GroupItem}">
+                        <Expander IsExpanded="False"  Foreground="Black" BorderBrush="Black" BorderThickness="0,0,0,1">
+                            <Expander.Header>
+                                <StackPanel Orientation="Horizontal" Margin="0,1"  Background="BlanchedAlmond" HorizontalAlignment="Stretch">
+                                    <TextBlock FontWeight="Bold" Text="{Binding Path=Name}"  Margin="0,0,10,0"/>
+                                    <TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount,StringFormat=({0})}"/>
+                                </StackPanel>
+                            </Expander.Header>
+                            <Expander.Content>
+                                <ItemsPresenter />
+                            </Expander.Content>
+                        </Expander>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </UserControl.Resources>
+    <Grid>
+        <DataGrid x:Name="datagrid" RowHeight="30"   AlternationCount="2" SelectionMode="Single" SelectionUnit="Cell" AutoGenerateColumns="False" CanUserAddRows="False"
+                  ItemsSource="{Binding ItemsSource,ElementName=this}" >
+            <DataGrid.RowStyle>
+                <Style TargetType="DataGridRow">
+                    <Setter Property="Height" Value="30"></Setter>
+                    <Style.Triggers>
+                        <Trigger Property="ItemsControl.AlternationIndex"
+                                 Value="0">
+                            <Setter Property="Background" Value="White" />
+                        </Trigger>
+                        <Trigger Property="ItemsControl.AlternationIndex"
+                                 Value="1">
+                            <Setter Property="Background" Value="#FFE6E3DD" />
+                        </Trigger>
+                    </Style.Triggers>
+                </Style>
+            </DataGrid.RowStyle>
+            <DataGrid.CellStyle>
+                <Style TargetType="DataGridCell">
+                    <!--<Setter Property="TextBlock.VerticalAlignment" Value="Center"></Setter>
+                    <Setter Property="TextBlock.TextAlignment" Value="Center"></Setter>
+                    <Setter Property="VerticalContentAlignment" Value="Center"></Setter>-->
+                </Style>
+            </DataGrid.CellStyle>
+            <DataGrid.GroupStyle>
+                <GroupStyle ContainerStyle="{StaticResource GroupStyle}">
+                    <GroupStyle.Panel>
+                        <ItemsPanelTemplate>
+                            <DataGridRowsPresenter/>
+                        </ItemsPanelTemplate>
+                    </GroupStyle.Panel>
+                </GroupStyle>
+            </DataGrid.GroupStyle>
+            <DataGrid.ColumnHeaderStyle>
+                <Style TargetType="DataGridColumnHeader">
+                    <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
+                </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>
+                <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>
+                                <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>
+                            </StackPanel>
+                        </DataTemplate>
+                    </DataGridTemplateColumn.CellTemplate>
+                </DataGridTemplateColumn>
+            </DataGrid.Columns>
+        </DataGrid>
+    </Grid>
+</UserControl>

+ 115 - 0
MBI/SAGA.GplotManage/SystemChecks/CheckSystemResultView.xaml.cs

@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using SAGA.GplotRelationComputerManage.SystemChecks;
+
+namespace SAGA.GplotManage.SystemChecks
+{
+    /// <summary>
+    /// CheckSystemResultView.xaml 的交互逻辑
+    /// </summary>
+    public partial class CheckSystemResultView : UserControl
+    {
+        public CheckSystemResultView()
+        {
+            InitializeComponent();
+        }
+
+        static CheckSystemResultView()
+        {
+            /*
+        * 误报:可以不考虑是否修正
+        * 错误:需要考虑是否修正
+        */
+            FixedPositionCommand = new RoutedCommand("定位", typeof(CheckSystemResultView));
+            CorrectedCommand = new RoutedCommand("改正", typeof(CheckSystemResultView));
+            MakeMisinformedCommand = new RoutedCommand("标记误报", typeof(CheckSystemResultView));
+           
+        }
+
+        /// <summary>
+        /// 定位
+        /// </summary>
+        public static RoutedCommand FixedPositionCommand { get; private set; }
+
+        /// <summary>
+        /// 已改正
+        /// </summary>
+        public static RoutedCommand CorrectedCommand { get; private set; }
+
+
+        /// <summary>
+        /// 误报
+        /// </summary>
+        public static RoutedCommand MakeMisinformedCommand { get; private set; }
+        
+
+        public static DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource",
+            typeof(List<SystemCheckResultItem>), typeof(CheckSystemResultView),
+            new PropertyMetadata(null, ItemsSourceChangedCallback));
+
+        internal static void ItemsSourceChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            var newValue = e.NewValue;
+            if (newValue != null)
+            {
+                ICollectionView vw = CollectionViewSource.GetDefaultView(newValue);
+                vw.GroupDescriptions.Add(new PropertyGroupDescription("ErrorDescription"));
+            }
+
+        }
+
+        /// <summary>
+        /// 数据源
+        /// </summary>
+        public List<SystemCheckResultItem> ItemsSource
+        {
+            get { return (List<SystemCheckResultItem>) this.GetValue(ItemsSourceProperty); }
+            set { this.SetValue(ItemsSourceProperty, value); }
+        }
+    }
+
+    [ValueConversion(typeof(bool), typeof(string))]
+    public class BoolToTextConverter : IValueConverter
+    {     
+        public string TrueText { get; set; }
+        public string FalseText { get; set; }
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value.GetType() != typeof(bool))
+                return string.Empty;
+            string result = string.Empty;
+            if((bool)value)
+            {
+                result = TrueText;
+            }
+            else
+            {
+                result = FalseText;
+            }       
+            return result;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (targetType != typeof(bool))
+                return false;
+          
+            return value.ToString()==TrueText;
+        }
+    }
+}
+

+ 96 - 1
MBI/SAGA.GplotManage/SystemChecks/VmSystemCheck.cs

@@ -7,14 +7,109 @@
 
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using SAGA.DotNetUtils.WPF;
+using SAGA.GplotRelationComputerManage.SystemChecks;
+using SAGA.RevitUtils.Extends;
 
 namespace SAGA.GplotManage.SystemChecks
 {
-    public class VmSystemCheck  :BaseViewModelStub
+    public class VmSystemCheck:BaseViewModelStub
     {
+
+        public VmSystemCheck()
+        {
+
+        }
+        public VmSystemCheck(SystemCheckReportItem reportItem)
+        {
+            this.m_CurrentReport = reportItem;
+        }
+        #region 属性相关
+        private SystemCheckReportItem m_CurrentReport;
+        /// <summary>
+        /// 当前检查结果
+        /// </summary>
+        public SystemCheckReportItem CurrentReport
+        {
+            get { return this.m_CurrentReport; }
+            set
+            {
+                this.m_CurrentReport = value;
+                if(this.m_CurrentReport!=null)
+                {
+                    this.ResultItems = new ObservableCollection<SystemCheckResultItem>(this.m_CurrentReport.ResultItems);
+                }
+                else
+                {
+                    this.ResultItems = new ObservableCollection<SystemCheckResultItem>();
+                }
+                RaisePropertyChanged(() => this.CurrentReport);
+            }
+        }
+
+
+        private ObservableCollection<SystemCheckResultItem> m_ResultItems;
+        /// <summary>
+        /// 结果元素
+        /// </summary>
+        public ObservableCollection<SystemCheckResultItem> ResultItems
+        {
+            get { return this.m_ResultItems; }
+            set
+            {
+                this.m_ResultItems = value;
+                RaisePropertyChanged(() => this.ResultItems);
+            }
+        }
+        #endregion
+        #region 重新检测
+        /// <summary>
+        /// 重新检查
+        /// </summary>
+        /// <param name="parameter"></param>
+        [Command]
+        public void ReCheckCommand(object parameter)
+        {
+            var reportItem = GplotSystemCheckManager.GetCheckSystemResult(ExternalDataWrapper.Current.Doc, "");
+            if(reportItem!=null)
+            {
+                CurrentReport = reportItem;
+            }
+        }
+        public bool CanReCheckCommand(object parameter)
+        {
+            return true;
+        }
+        #endregion
+
+        #region 定位
+        public void PositionCommand(object parameter)
+        {
+            MessageBox.Show(parameter.ToString());
+        }
+        #endregion
+
+        #region 修改改正状态
+        public void ConcrectedCommand(object parameter)
+        {
+            var item = parameter as SystemCheckResultItem;
+            MessageBox.Show(item.IsCorrected.ToString());
+            item.IsCorrected = !item.IsCorrected;
+        }
+        #endregion
+
+        #region 修改误报状态
+        public void MisinformationCommand(object parameter)
+        {
+            var item = parameter as SystemCheckResultItem;
+            MessageBox.Show(item.IsMisinformation.ToString());
+            item.IsMisinformation = !item.IsMisinformation;
+        }
+        #endregion
     }
 }

+ 3 - 29
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="网异常清单" WindowStartupLocation="CenterScreen"
                  Height="550" Width="580">
     <windows:WinBase.Resources>
         <CollectionViewSource x:Key="SourceGroupByClassCode" Source="{Binding Path=MissFMEquips,NotifyOnSourceUpdated=True}">
@@ -48,36 +48,10 @@
                 <TextBlock   Text="{Binding Path=FloorLocaltion}"  VerticalAlignment="Center"></TextBlock>
             </StackPanel>
 
-            <Button Grid.Column="1" Height="25" Width="100" Content="重新检测"   HorizontalAlignment="Right"></Button>
+            <Button Command="{Binding Commands.ReCheckCommand}" Grid.Column="1" Height="25" Width="100" Content="重新检测"   HorizontalAlignment="Right"></Button>
         </Grid>
 
-        <DataGrid x:Name="datagrid" Grid.Row="1" RowHeight="30" SelectionMode="Single" AutoGenerateColumns="False"
-                  ItemsSource="{Binding Source={StaticResource SourceGroupByClassCode}}">
-            <DataGrid.GroupStyle>
-                <GroupStyle ContainerStyle="{StaticResource GroupHeaderFamilyStyle}"/>
-            </DataGrid.GroupStyle>
-            <DataGrid.ColumnHeaderStyle>
-                <Style TargetType="DataGridColumnHeader">
-                    <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
-                </Style>
-            </DataGrid.ColumnHeaderStyle>
-            <DataGrid.Columns>
-                <DataGridTextColumn Width="*" MinWidth="80" Header="BIMID" ></DataGridTextColumn>
-                <DataGridTextColumn Width="*" MinWidth="100" Header="官网类型" ></DataGridTextColumn>
-                <DataGridTextColumn Width="*" MinWidth="80" Header="流向" ></DataGridTextColumn>
-                <DataGridTemplateColumn Header="操作" Width="*" MinWidth="350">
-                    <DataGridTemplateColumn.CellTemplate>
-                        <DataTemplate>
-                            <StackPanel Orientation="Horizontal">
-                                <Button Content="模型定位"  Command="{Binding Data.Commands.ScanProductTypeCommand,Source={StaticResource ResourceKey=DATA} }" CommandParameter="{Binding}"    HorizontalAlignment="Left" Padding="5,0,5,0"/>
-                                <Button Content="已改正" Command="{Binding Data.Commands.EditProductTypeCommand,Source={StaticResource ResourceKey=DATA} }" CommandParameter="{Binding}"    HorizontalAlignment="Left" Padding="5,0,5,0"/>
-                                <Button Content="误报" Command="{Binding Data.Commands.EditProductTypeCommand,Source={StaticResource ResourceKey=DATA} }" CommandParameter="{Binding}"   HorizontalAlignment="Left" Padding="5,0,5,0"/>
-                            </StackPanel>
-                        </DataTemplate>
-                    </DataGridTemplateColumn.CellTemplate>
-                </DataGridTemplateColumn>
-            </DataGrid.Columns>
-        </DataGrid>
+        <local:CheckSystemResultView Grid.Row="1" ItemsSource="{Binding ResultItems}"></local:CheckSystemResultView>
 
     </Grid>
 </windows:WinBase>

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

@@ -11,6 +11,7 @@ using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Shapes;
+using SAGA.GplotRelationComputerManage.SystemChecks;
 using SAGA.RevitUtils.Windows;
 
 namespace SAGA.GplotManage.SystemChecks
@@ -21,11 +22,26 @@ namespace SAGA.GplotManage.SystemChecks
     public partial class WinSystemCheck : WinBase
     {
         private VmSystemCheck m_Vm;
-        public WinSystemCheck()
+        public WinSystemCheck():this(new VmSystemCheck())
+        {
+            InitializeComponent();       
+        }
+
+        public WinSystemCheck(VmSystemCheck vm)
         {
-            InitializeComponent();
-            m_Vm = new VmSystemCheck();
             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,
+                (e, arg) => {
+                    this.m_Vm?.ConcrectedCommand(arg.Parameter);
+                }));
+
+            this.CommandBindings.Add(new CommandBinding(CheckSystemResultView.MakeMisinformedCommand,
+              (e, arg) => {
+                  this.m_Vm?.MisinformationCommand(arg.Parameter);
+              }));
         }
     }
 }

BIN=BIN
MBI/SAGA.GplotRelationComputerManage/RelationBll.zip


+ 2 - 1
MBI/SAGA.GplotRelationComputerManage/SAGA.GplotRelationComputerManage.csproj

@@ -157,11 +157,12 @@
     <Compile Include="SpaceRelation\SpaceComputerContext.cs" />
     <Compile Include="SpaceRelation\SpaceComputerHandler.cs" />
     <Compile Include="SpaceRelation\SpaceComputerManager.cs" />
+    <Compile Include="SystemChecks\ErrorCodeUtil.cs" />
     <Compile Include="SystemChecks\FloorCheckItem.cs" />
     <Compile Include="SystemChecks\GplotSystemCheckContext.cs" />
     <Compile Include="SystemChecks\GplotSystemCheckManager.cs" />
-    <Compile Include="SystemChecks\Model\SystemCheckReportItem.cs" />
     <Compile Include="SystemChecks\Model\SystemCheckResultItem.cs" />
+    <Compile Include="SystemChecks\Model\SystemCheckReportItem.cs" />
     <Compile Include="SystemRelation\Common\PointItemType.cs" />
     <Compile Include="SystemRelation\Common\RelationTypeUtil.cs" />
     <Compile Include="SystemRelation\Common\SystemCalcUtil.cs" />

+ 33 - 0
MBI/SAGA.GplotRelationComputerManage/SystemChecks/ErrorCodeUtil.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SAGA.GplotRelationComputerManage.SystemChecks
+{
+    /// <summary>
+    /// 错误码识别
+    /// </summary>
+    public static class ErrorCodeUtil
+    {
+        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");
+        }
+
+        /// <summary>
+        /// 获取验证码显示
+        /// </summary>
+        /// <param name="errorCode"></param>
+        /// <returns></returns>
+        public static string GetErrorDescription(string errorCode)
+        {
+            m_Errors.TryGetValue(errorCode, out string description);
+            return description ?? string.Empty;
+        }
+    }
+}

+ 11 - 0
MBI/SAGA.GplotRelationComputerManage/SystemChecks/FloorCheckItem.cs

@@ -11,6 +11,8 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Autodesk.Revit.DB;
+using SAGA.DotNetUtils.Utilities;
+using SAGA.MBI.Tools;
 
 namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
@@ -57,7 +59,16 @@ 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.GplotType = shell.RelationItem.Type;
+            reportItem.BuildingTime = DateTime.Now.ToString("yyyyMMddmmhhss");
+          
 
+
+            context.ReportItems.Add(reportItem);
         }
 
     }

+ 1 - 1
MBI/SAGA.GplotRelationComputerManage/SystemChecks/GplotSystemCheckContext.cs

@@ -25,7 +25,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
             ReportItems = new List<SystemCheckReportItem>();
             Relations = new List<string>();
         }
-        List<SystemCheckReportItem> ReportItems { get; set; }
+        public List<SystemCheckReportItem> ReportItems { get; set; }
 
         #region 需要计算的系统相关
         /// <summary>

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

@@ -16,7 +16,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
     public class GplotSystemCheckManager
     {
-        public void CheckSystem(List<Document> documents,List<string> gplotTypeSystems)
+        public static void CheckSystem(List<Document> documents,List<string> gplotTypeSystems)
         {
             if (gplotTypeSystems == null || !gplotTypeSystems.Any())
                 return;
@@ -32,7 +32,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
             //向数据库提交信息
         }
 
-        public SystemCheckReportItem GetCacheCheckSystemResult(Document document, string gplotType)
+        public static SystemCheckReportItem GetCacheCheckSystemResult(Document document, string gplotType)
         {
             /*
              *  判断数据库中是否存在;存在直接查询数据库返回;不存在的话进行检测,再返回
@@ -40,7 +40,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
             return GetCheckSystemResult(document, gplotType);
         }
 
-        public SystemCheckReportItem GetCheckSystemResult(Document document, string gplotType)
+        public static SystemCheckReportItem GetCheckSystemResult(Document document, string gplotType)
         {
             CheckSystem(new List<Document>() { document }, new List<string>() { gplotType });
             return new SystemCheckReportItem();

+ 23 - 69
MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/SystemCheckReportItem.cs

@@ -1,20 +1,20 @@
 /*-------------------------------------------------------------------------
- * 功能描述:SystemCHeckReportItem
+ * 功能描述:SystemCheckResultItem
  * 作者:xulisong
- * 创建时间: 2019/2/28 9:48:48
+ * 创建时间: 2019/2/28 9:52:50
  * 版本号:v1.0
  *  -------------------------------------------------------------------------*/
 
-using SAGA.DotNetUtils.WPF;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using SAGA.DotNetUtils.WPF;
 
 namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
-    public class SystemCheckReportItem  : BasePropertyChanged
+    public class SystemCheckReportItem: BasePropertyChanged
     {
         public SystemCheckReportItem()
         {
@@ -23,7 +23,7 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
 
         private string m_Id;
         /// <summary>
-        /// 检查结果Id
+        /// 报表Id
         /// </summary>
         public string Id
         {
@@ -36,93 +36,47 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         }
 
 
-        private string  m_ReportId;
-        /// <summary>
-        /// 报表Id
-        /// </summary>
-        public string  ReportId
-        {
-            get { return this.m_ReportId; }
-            set
-            {
-                this.m_ReportId = value;
-                RaisePropertyChanged(nameof(this.ReportId));
-            }
-        }
-
-
-        private string m_BimId;
-        /// <summary>
-        /// BimId
-        /// </summary>
-        public string BimId
-        {
-            get { return this.m_BimId; }
-            set
-            {
-                this.m_BimId = value;
-                RaisePropertyChanged(nameof(this.BimId));
-            }
-        }
-
-
-
-        private string m_FlowDirection;
-        /// <summary>
-        /// 流向
-        /// </summary>
-        public string FlowDirection
-        {
-            get { return this.m_FlowDirection; }
-            set
-            {
-                this.m_FlowDirection = value;
-                RaisePropertyChanged(nameof(this.FlowDirection));
-            }
-        }
-
-
-        private string  m_ErrorCode;
+        private string m_FloorId;
         /// <summary>
-        /// 错误编码
+        /// 楼层Id
         /// </summary>
-        public string  ErrorCode
+        public string FloorId
         {
-            get { return this.m_ErrorCode; }
+            get { return this.m_FloorId; }
             set
             {
-                this.m_ErrorCode = value;
-                RaisePropertyChanged(nameof(this.ErrorCode));
+                this.m_FloorId = value;
+                RaisePropertyChanged(nameof(this.FloorId));
             }
         }
 
 
-        private bool m_IsCorrect;
+        private string m_GplotType;
         /// <summary>
-        /// 是否改正
+        /// 拓扑类型Id
         /// </summary>
-        public bool IsCorrect
+        public string GplotType
         {
-            get { return this.m_IsCorrect; }
+            get { return this.m_GplotType; }
             set
             {
-                this.m_IsCorrect = value;
-                RaisePropertyChanged(nameof(this.IsCorrect));
+                this.m_GplotType = value;
+                RaisePropertyChanged(nameof(this.GplotType));
             }
         }
 
 
-        private bool m_IsMisinformation;
+        private string  m_BuildingTime;
         /// <summary>
-        /// 是否是误报
+        /// 创建时间
         /// </summary>
-        public bool IsMisinformation
+        public string  BuildingTime
         {
-            get { return this.m_IsMisinformation; }
+            get { return this.m_BuildingTime; }
             set
             {
-                this.m_IsMisinformation = value;
-                RaisePropertyChanged(nameof(this.IsMisinformation));
+                this.m_BuildingTime = value;
+                RaisePropertyChanged(nameof(this.BuildingTime));
             }
         }
 

+ 92 - 23
MBI/SAGA.GplotRelationComputerManage/SystemChecks/Model/SystemCheckResultItem.cs

@@ -1,24 +1,29 @@
 /*-------------------------------------------------------------------------
- * 功能描述:SystemCheckResultItem
+ * 功能描述:SystemCHeckReportItem
  * 作者:xulisong
- * 创建时间: 2019/2/28 9:52:50
+ * 创建时间: 2019/2/28 9:48:48
  * 版本号:v1.0
  *  -------------------------------------------------------------------------*/
 
+using SAGA.DotNetUtils.WPF;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using SAGA.DotNetUtils.WPF;
 
 namespace SAGA.GplotRelationComputerManage.SystemChecks
 {
-    public class SystemCheckResultItem: BasePropertyChanged
+    public class SystemCheckResultItem  : BasePropertyChanged
     {
+        public SystemCheckResultItem()
+        {
+            
+        }
+
         private string m_Id;
         /// <summary>
-        /// 报表Id
+        /// 检查结果Id
         /// </summary>
         public string Id
         {
@@ -31,48 +36,112 @@ namespace SAGA.GplotRelationComputerManage.SystemChecks
         }
 
 
-        private string m_FloorId;
+        private string  m_ReportId;
+        /// <summary>
+        /// 报表Id
+        /// </summary>
+        public string  ReportId
+        {
+            get { return this.m_ReportId; }
+            set
+            {
+                this.m_ReportId = value;
+                RaisePropertyChanged(nameof(this.ReportId));
+            }
+        }
+
+
+        private string m_BimId;
+        /// <summary>
+        /// BimId
+        /// </summary>
+        public string BimId
+        {
+            get { return this.m_BimId; }
+            set
+            {
+                this.m_BimId = value;
+                RaisePropertyChanged(nameof(this.BimId));
+            }
+        }
+
+
+
+        private string m_FlowDirection;
         /// <summary>
-        /// 楼层Id
+        /// 流向
         /// </summary>
-        public string FloorId
+        public string FlowDirection
         {
-            get { return this.m_FloorId; }
+            get { return this.m_FlowDirection; }
             set
             {
-                this.m_FloorId = value;
-                RaisePropertyChanged(nameof(this.FloorId));
+                this.m_FlowDirection = value;
+                RaisePropertyChanged(nameof(this.FlowDirection));
             }
         }
 
 
-        private string m_GplotType;
+        private string  m_ErrorCode;
         /// <summary>
-        /// 拓扑类型Id
+        /// 错误编码
         /// </summary>
-        public string GplotType
+        public string  ErrorCode
         {
-            get { return this.m_GplotType; }
+            get { return this.m_ErrorCode; }
             set
             {
-                this.m_GplotType = value;
-                RaisePropertyChanged(nameof(this.GplotType));
+                this.m_ErrorCode = value;
+                RaisePropertyChanged(nameof(this.ErrorCode));
             }
         }
 
 
-        private string  m_BuildingTime;
+        private string m_ErrorDescription;
+        /// <summary>
+        /// 错误编码值
+        /// </summary>
+        public string ErrorDescription
+        {
+            get {
+                if(this.m_ErrorDescription==null)
+                {
+                    this.m_ErrorDescription= ErrorCodeUtil.GetErrorDescription(ErrorCode);
+                }
+                return m_ErrorDescription;
+            }
+                     
+        }
+
+        private bool m_IsCorrected;
         /// <summary>
-        /// 创建时间
+        /// 是否改正
         /// </summary>
-        public string  BuildingTime
+        public bool IsCorrected
         {
-            get { return this.m_BuildingTime; }
+            get { return this.m_IsCorrected; }
             set
             {
-                this.m_BuildingTime = value;
-                RaisePropertyChanged(nameof(this.BuildingTime));
+                this.m_IsCorrected = value;
+                RaisePropertyChanged(nameof(this.IsCorrected));
             }
         }
+
+
+        private bool m_IsMisinformation;
+        /// <summary>
+        /// 是否是误报
+        /// </summary>
+        public bool IsMisinformation
+        {
+            get { return this.m_IsMisinformation; }
+            set
+            {
+                this.m_IsMisinformation = value;
+                RaisePropertyChanged(nameof(this.IsMisinformation));
+            }
+        }
+
+       
     }
 }