Files
YuPu-OrpaonEMS/OrpaonEMS.App/Views/BmsView.xaml
2025-02-28 22:23:13 +08:00

587 lines
33 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<UserControl
x:Class="OrpaonEMS.App.Views.BmsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
xmlns:Syncfusion="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:datapager="clr-namespace:Syncfusion.UI.Xaml.Controls.DataPager;assembly=Syncfusion.SfGrid.WPF"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:OrpaonEMS.App.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
d:DesignHeight="708"
d:DesignWidth="1024"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="myHeaderStyle" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="FontSize" Value="24" />
<Setter Property="Width" Value="218" />
</Style>
<Style x:Key="myHeaderStyle1" TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="FontSize" Value="16" />
</Style>
</UserControl.Resources>
<Grid>
<!--<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="1.3*" />
<RowDefinition Height="0.6*" />
<RowDefinition Height="1.3*" />
</Grid.RowDefinitions>
<Grid>
<TabControl
materialDesign:ColorZoneAssist.Background="{DynamicResource MaterialDesignLightBackground}"
materialDesign:ColorZoneAssist.Foreground="{DynamicResource PrimaryHueMidBrush}"
materialDesign:ColorZoneAssist.Mode="Custom"
Style="{StaticResource MaterialDesignFilledTabControl}">
<TabItem>
<TabItem.Header>
<TextBlock FontSize="16" Text="主要参数" />
</TabItem.Header>
<Grid>
<Border
Margin="5"
Background="White"
CornerRadius="5"
Opacity="1" />
<Grid Margin="5">
<Grid.Resources>
<Style x:Key="StackPanelBlock" TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style x:Key="BorderBlock" TargetType="Border">
<Setter Property="Background" Value="Gray" />
<Setter Property="Margin" Value="10" />
<Setter Property="Opacity" Value="0.3" />
<Setter Property="CornerRadius" Value="3" />
</Style>
<Style x:Key="IcoStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="../Assets/Fonts/#iconfont" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="25" />
<Setter Property="Margin" Value="15,0" />
</Style>
<Style x:Key="TitleLab" TargetType="Label">
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="Gray" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="TextBlockValue" TargetType="TextBlock">
<Setter Property="FontSize" Value="22" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5,0" />
<Setter Property="Foreground" Value="BlueViolet" />
</Style>
<Style x:Key="UnitLab" TargetType="Label">
<Setter Property="FontSize" Value="16" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Margin" Value="15,0,0,15" />
<Setter Property="Foreground" Value="Blue" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Style="{StaticResource BorderBlock}" />
<StackPanel Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe717;" />
<Label Style="{StaticResource TitleLab}">电池簇电压</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.BmsVol.RtValue, StringFormat=0.0}" />
<Label Style="{StaticResource UnitLab}">V</Label>
</StackPanel>
<Border Grid.Row="1" Style="{StaticResource BorderBlock}" />
<StackPanel Grid.Row="1" Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe820;" />
<Label Style="{StaticResource TitleLab}">最大充电功率</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.MaxChargePowerCell.RtValue, StringFormat=0.0}" />
<Label Style="{StaticResource UnitLab}">kW</Label>
</StackPanel>
<Border Grid.Row="2" Style="{StaticResource BorderBlock}" />
<StackPanel Grid.Row="2" Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe70a;" />
<Label Style="{StaticResource TitleLab}">最高温度</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.BmsMaxBatTemp.RtValue, StringFormat=0}" />
<Label Style="{StaticResource UnitLab}"></Label>
</StackPanel>
<Border Grid.Column="1" Style="{StaticResource BorderBlock}" />
<StackPanel Grid.Column="1" Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe716;" />
<Label Style="{StaticResource TitleLab}">电池簇电流</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.BmsCur.RtValue, StringFormat=0.0}" />
<Label Style="{StaticResource UnitLab}">Kwh</Label>
</StackPanel>
<Border
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource BorderBlock}" />
<StackPanel
Grid.Row="1"
Grid.Column="1"
Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe820;" />
<Label Style="{StaticResource TitleLab}">最大放电功率</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.MaxDisChargePowerCell.RtValue, StringFormat=0.0}" />
<Label Style="{StaticResource UnitLab}">kW</Label>
</StackPanel>
<Border
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource BorderBlock}" />
<StackPanel
Grid.Row="2"
Grid.Column="1"
Style="{StaticResource StackPanelBlock}">
<TextBlock Style="{StaticResource IcoStyle}" Text="&#xe70a;" />
<Label Style="{StaticResource TitleLab}">最低温度</Label>
<TextBlock Style="{StaticResource TextBlockValue}" Text="{Binding bmsDataService.BmsMinBatTemp.RtValue, StringFormat=0}" />
<Label Style="{StaticResource UnitLab}"></Label>
</StackPanel>
</Grid>
</Grid>
</TabItem>
<TabItem>
<TabItem.Header>
<TextBlock
FontSize="16"
Foreground="Red"
Text="BMS实时报警" />
</TabItem.Header>
<Border
Margin="1"
BorderBrush="DimGray"
BorderThickness="1">
<ListView
x:Name="ListviewAlarm"
Background="Beige"
BorderThickness="1"
Foreground="DimGray"
ItemsSource="{Binding bmsDataService.CurAlarmModel.RtListViewItems}">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="BorderThickness" Value="0,0,0,1" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="FontSize" Value="20" />
</Style>
</ListView.ItemContainerStyle>
<ListView.View>
<GridView>
<GridViewColumn Width="400" DisplayMemberBinding="{Binding Content}">
<GridViewColumn.Header>
<TextBlock
HorizontalAlignment="Center"
FontSize="18"
Foreground="Black"
Text="报警内容"
TextAlignment="Center" />
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn Width="100" DisplayMemberBinding="{Binding Level}">
<GridViewColumn.Header>
<TextBlock
HorizontalAlignment="Center"
FontSize="18"
Foreground="DimGray"
Text="等级"
TextAlignment="Center" />
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn Width="140" DisplayMemberBinding="{Binding CreatTime}">
<GridViewColumn.Header>
<TextBlock
HorizontalAlignment="Center"
FontSize="18"
Foreground="DimGray"
Text="开始时间"
TextAlignment="Center" />
</GridViewColumn.Header>
</GridViewColumn>
</GridView>
</ListView.View>
<!-- 设置ListViewItem的背景色模拟网格效果 -->
<!--<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Background" Value="LightGray" />
</Style>
</ListView.ItemContainerStyle>-->
</ListView>
</Border>
</TabItem>
</TabControl>
</Grid>
<Grid Grid.Row="1">
<Border
Margin="1"
BorderBrush="Gray"
BorderThickness="1">
<!--<Syncfusion:SfChart x:Name="PcsRtPw" Margin="2">
<Syncfusion:SfChart.PrimaryAxis>
<Syncfusion:DateTimeAxis
Header="小时"
LabelFormat="HH:mm"
ShowGridLines="False" />
</Syncfusion:SfChart.PrimaryAxis>
<Syncfusion:SfChart.SecondaryAxis>
<Syncfusion:NumericalAxis Header="功率(Wh)" Minimum="0" />
</Syncfusion:SfChart.SecondaryAxis>
<Syncfusion:LineSeries
EnableAnimation="True"
ItemsSource="{Binding SneakersDetail}"
Palette="Custom"
XBindingPath="Month"
YBindingPath="Rainfall" />
</Syncfusion:SfChart>-->
</Border>
</Grid>
<Grid Grid.Row="2">
<TabControl
materialDesign:ColorZoneAssist.Background="{DynamicResource MaterialDesignLightBackground}"
materialDesign:ColorZoneAssist.Foreground="{DynamicResource PrimaryHueMidBrush}"
materialDesign:ColorZoneAssist.Mode="Custom"
Style="{StaticResource MaterialDesignFilledTabControl}">
<TabItem Header="详细数据">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<!-- 表格数据 -->
<syncfusion:SfDataGrid
x:Name="sfDataGrid1"
Margin="3"
AutoGenerateColumns="False"
ColumnSizer="Star"
ItemsSource="{Binding ListBMSPageRoCell}"
ShowRowHeader="True">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn
Width="500"
HeaderText="名称"
MappingName="Name"
TextAlignment="Center" />
<syncfusion:GridNumericColumn
HeaderText="数据"
MappingName="RtValue"
TextAlignment="Center" />
<syncfusion:GridTextColumn
Width="80"
HeaderText="单位"
MappingName="Unit"
TextAlignment="Center" />
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
<StackPanel Grid.Row="1">
<syncfusion:SfDataPager
NumericButtonCount="{Binding NumericButtonCount, Mode=TwoWay}"
PageCount="{Binding PageCount, Mode=TwoWay}"
PageSize="{Binding Path=SelectedValue, Mode=TwoWay, ElementName=PageSizeCombobox}"
UseOnDemandPaging="True"
PageIndex="{Binding PageIndex, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="OnDemandLoading">
<i:InvokeCommandAction Command="{Binding PageIndexChangeCmd}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</syncfusion:SfDataPager>
<ComboBox
Name="PageSizeCombobox"
Width="50"
Height="20"
Margin="5,0"
DisplayMemberPath="Text"
ItemsSource="{Binding PageSizeComboBoxList}"
SelectedIndex="0"
SelectedValuePath="Text" />
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="BMS配置">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<!-- 表格数据 -->
<syncfusion:SfDataGrid
x:Name="sfDataGridConfig"
Margin="3"
AutoGenerateColumns="False"
ColumnSizer="Star"
ItemsSource="{Binding ListBmsPageRwCell}"
RowHeight="35"
SelectionMode="None"
ShowRowHeader="True">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn
Width="400"
HeaderText="名称"
MappingName="Name"
TextAlignment="Center" />
<syncfusion:GridNumericColumn
HeaderText="数据"
MappingName="RtValue"
TextAlignment="Center" />
<syncfusion:GridTextColumn
Width="80"
HeaderText="单位"
MappingName="Unit"
TextAlignment="Center" />
<syncfusion:GridTemplateColumn HeaderText="操作">
<syncfusion:GridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
Height="30"
Margin="2"
Command="{Binding DataContext.ConfigBmsSelectedBtnCmd, RelativeSource={RelativeSource AncestorType={x:Type syncfusion:SfDataGrid}}}"
CommandParameter="{Binding}"
Content="编辑">
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DataContext.ConfigBmsSelectedBtnCmd, RelativeSource={RelativeSource AncestorType={x:Type syncfusion:SfDataGrid}}}" />
</i:EventTrigger>
</i:Interaction.Triggers>-->
</Button>
</StackPanel>
</DataTemplate>
</syncfusion:GridTemplateColumn.CellTemplate>
</syncfusion:GridTemplateColumn>
</syncfusion:SfDataGrid.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding ElementName=sfDataGridConfig, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</syncfusion:SfDataGrid>
<StackPanel Grid.Row="1">
<syncfusion:SfDataPager
NumericButtonCount="{Binding ConfigNumericButtonCount, Mode=TwoWay}"
PageCount="{Binding ConfigPageCount, Mode=TwoWay}"
PageSize="{Binding Path=SelectedValue, Mode=TwoWay, ElementName=PageSizeComboboxConfig}"
UseOnDemandPaging="True"
PageIndex="{Binding ConfigPageIndex, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="OnDemandLoading">
<i:InvokeCommandAction Command="{Binding ConfigPageIndexChangeCmd}" PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
</syncfusion:SfDataPager>
<ComboBox
Name="PageSizeComboboxConfig"
Width="50"
Height="20"
Margin="5,0"
DisplayMemberPath="Text"
ItemsSource="{Binding ConfigPageSizeComboBoxList}"
SelectedIndex="0"
SelectedValuePath="Text" />
</StackPanel>
</Grid>
</TabItem>
<!--<TabItem Header="报警阀值">
<TextBlock Margin="5" Text="Custom Tab 3" />
</TabItem>
<TabItem Header="报警阀值">
<TextBlock Margin="5" Text="Custom Tab 4" />
</TabItem>-->
</TabControl>
</Grid>
</Grid>
<Border
Grid.Column="2"
Background="Gray"
CornerRadius="8"
Opacity="0.2" />
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="2.5*" />
</Grid.RowDefinitions>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5"
VerticalAlignment="Center"
FontFamily="../Assets/Fonts/#iconfont"
FontSize="24"
Foreground="Black"
Text="&#xe685;" />
<TextBlock
Margin="5"
VerticalAlignment="Center"
FontSize="20"
Foreground="#596B75"
Text="电池簇SOC" />
</StackPanel>
<syncfusion:SfChart
x:Name="chart"
Height="160"
AreaBorderThickness="0">
<syncfusion:DoughnutSeries
x:Name="doughnutSeries"
CapStyle="BothCurve"
DoughnutCoefficient="1"
EnableAnimation="True"
EnableSmartLabels="True"
EndAngle="270"
IsStackedDoughnut="True"
ItemsSource="{Binding bmsDataService.ListSoxValue}"
ListenPropertyChange="True"
MaximumValue="100"
SegmentSpacing="0.2"
StartAngle="-90"
XBindingPath="Title"
YBindingPath="Value">
<syncfusion:DoughnutSeries.CenterView>
<ContentControl HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock
FontFamily="../Assets/Fonts/#iconfont"
FontSize="40"
Foreground="Green"
Text="&#xe607;" />
</ContentControl>
</syncfusion:DoughnutSeries.CenterView>
</syncfusion:DoughnutSeries>
</syncfusion:SfChart>
</StackPanel>
<Grid Grid.Row="1">
<Grid.Resources>
<Style x:Key="borderStyle" TargetType="Border">
<Setter Property="Margin" Value="10,5" />
<Setter Property="Background" Value="White" />
<Setter Property="CornerRadius" Value="5" />
<Setter Property="Opacity" Value="0.8" />
</Style>
<Style x:Key="StackPanelBigStyle" TargetType="StackPanel">
<Setter Property="Margin" Value="10,5" />
<Setter Property="Orientation" Value="Horizontal" />
</Style>
<Style x:Key="TextBlockIcoStyle" TargetType="TextBlock">
<Setter Property="Margin" Value="15,5" />
<Setter Property="FontFamily" Value="../Assets/Fonts/#iconfont" />
<Setter Property="FontSize" Value="30" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style x:Key="LabelTitleStyle" TargetType="Label">
<Setter Property="FontSize" Value="12" />
<Setter Property="Margin" Value="0,8" />
</Style>
<Style x:Key="TextBlockValueStyle" TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Margin" Value="0,-5" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border Style="{StaticResource borderStyle}" />
<Border Grid.Row="1" Style="{StaticResource borderStyle}" />
<Border Grid.Row="2" Style="{StaticResource borderStyle}" />
<Border Grid.Row="3" Style="{StaticResource borderStyle}" />
<Border Grid.Row="4" Style="{StaticResource borderStyle}" />
<Border Grid.Row="5" Style="{StaticResource borderStyle}" />
<StackPanel Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe607;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">电池簇总SOH (%)</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsSOH.RtValue, StringFormat=0.0}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="1" Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe613;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">电池簇总SOE (%)</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsSOE.RtValue, StringFormat=0.0}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe75b;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">累计充电次数(次)</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsAccChargCount.RtValue, StringFormat=0}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="3" Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe761;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">累计放电次数(次)</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsAccDisChargCount.RtValue, StringFormat=0}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="4" Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe768;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">电池最高温度 (℃)</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsMaxBatTemp.RtValue, StringFormat=0.0}" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="5" Style="{StaticResource StackPanelBigStyle}">
<TextBlock Style="{StaticResource TextBlockIcoStyle}" Text="&#xe642;" />
<StackPanel>
<Label Style="{StaticResource LabelTitleStyle}">电池簇电池状态</Label>
<TextBlock Style="{StaticResource TextBlockValueStyle}" Text="{Binding bmsDataService.BmsBatState}" />
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</Grid>
</UserControl>