Files
FATrace/FATrace.WPLApp/Views/DashboardView.xaml
2026-01-13 15:03:02 +08:00

837 lines
31 KiB
XML

<UserControl
x:Class="FATrace.WPLApp.Views.DashboardView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FATrace.WPLApp.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
d:DesignHeight="720"
d:DesignWidth="1280"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d">
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<!-- 顶部统计卡片 -->
<Grid Grid.Row="0" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border
Grid.Column="0"
Margin="0,0,10,0"
Padding="12"
Background="#F3F6FA"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,6,0"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="16"
Text="&#xeb2c;" />
<TextBlock
FontSize="14"
Foreground="#55657E"
Text="本日称重总量" />
</StackPanel>
<TextBlock
FontSize="26"
FontWeight="Bold"
Text="{Binding TodayWeight, StringFormat={}{0:N2} g}" />
</StackPanel>
</Border>
<Border
Grid.Column="1"
Margin="0,0,10,0"
Padding="12"
Background="#F3F6FA"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,6,0"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="16"
Text="&#xeb08;" />
<TextBlock
FontSize="14"
Foreground="#55657E"
Text="本月称重总量" />
</StackPanel>
<TextBlock
FontSize="26"
FontWeight="Bold"
Text="{Binding MonthWeight, StringFormat={}{0:N2} g}" />
</StackPanel>
</Border>
<Border
Grid.Column="2"
Margin="0,0,10,0"
Padding="12"
Background="#F3F6FA"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,6,0"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="16"
Text="&#xeb1a;" />
<TextBlock
FontSize="14"
Foreground="#55657E"
Text="本年称重总量" />
</StackPanel>
<TextBlock
FontSize="26"
FontWeight="Bold"
Text="{Binding YearWeight, StringFormat={}{0:N2} g}" />
</StackPanel>
</Border>
<Border
Grid.Column="3"
Margin="0,0,10,0"
Padding="12"
Background="#F3F6FA"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,6,0"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="16"
Text="&#xec1f;" />
<TextBlock
FontSize="14"
Foreground="#55657E"
Text="累计称重总量" />
</StackPanel>
<TextBlock
FontSize="26"
FontWeight="Bold"
Text="{Binding TotalWeight, StringFormat={}{0:N2} g}" />
</StackPanel>
</Border>
</Grid>
<!-- 中部:实时运行信息 + 右侧状态 -->
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 实时信息 -->
<Border
Grid.Column="0"
Margin="0,0,10,0"
Padding="8"
Background="White"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<DockPanel>
<TextBlock
Margin="2,0,0,6"
DockPanel.Dock="Top"
FontSize="14"
FontWeight="Bold"
Text="实时运行信息(扫码/喷码)" />
<ListBox ItemsSource="{Binding LiveMessages}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock
FontFamily="Consolas"
FontSize="13"
Text="{Binding}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Border>
<!-- 右侧状态 -->
<Border
Grid.Column="1"
Padding="12"
Background="White"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,6,0"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="16"
Text="&#xec98;" />
<TextBlock
FontSize="14"
FontWeight="Bold"
Text="设备/通信状态" />
</StackPanel>
<StackPanel
Margin="0,8,0,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<Ellipse Width="14" Height="14">
<Ellipse.Style>
<Style TargetType="Ellipse">
<Setter Property="Fill" Value="#D9534F" />
<Style.Triggers>
<DataTrigger Binding="{Binding PlcConnected}" Value="True">
<Setter Property="Fill" Value="#5CB85C" />
</DataTrigger>
</Style.Triggers>
</Style>
</Ellipse.Style>
</Ellipse>
<TextBlock VerticalAlignment="Center" Text=" PLC连接" />
</StackPanel>
<Separator Margin="0,10,0,10" />
<TextBlock Foreground="#55657E" Text="最近称重扫码" />
<TextBox
FontFamily="Consolas"
IsReadOnly="True"
Text="{Binding LatestWeightScanCode}" />
<TextBlock
Margin="0,8,0,0"
Foreground="#55657E"
Text="最近外箱扫码" />
<TextBox
FontFamily="Consolas"
IsReadOnly="True"
Text="{Binding LatestBoxScanCode}" />
</StackPanel>
</Border>
</Grid>
<!-- 底部:预留区域 -->
<Border
Grid.Row="2"
Margin="0,10,0,0"
Padding="12"
Background="#F9FAFB"
BorderBrush="#DDE3EB"
BorderThickness="1"
CornerRadius="6">
<Canvas Margin="-3,0,0,0">
<Rectangle
Canvas.Top="136.567"
Width="62"
Height="97"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Stroke="Black" />
<Rectangle
Canvas.Left="181"
Canvas.Top="276.816"
Width="62"
Height="11"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="181"
Canvas.Top="286.817"
Width="62"
Height="11"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="181"
Canvas.Top="296.818"
Width="62"
Height="11"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="181"
Canvas.Top="306.902"
Width="62"
Height="11"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="181"
Canvas.Top="316.82"
Width="62"
Height="11"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="174.5"
Canvas.Top="218.816"
Width="75"
Height="57"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="248.5"
Canvas.Top="234.066"
Width="10"
Height="26"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Label
Canvas.Left="185.13"
Canvas.Top="234.826"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="X光机器" />
<Rectangle
Canvas.Left="165.5"
Canvas.Top="234.066"
Width="10"
Height="26"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Path
Canvas.Left="239.5"
Canvas.Top="122.633"
Width="1"
Height="1"
Fill="#FFF4F4F5"
Stretch="Fill"
Stroke="Black">
<Path.Data>
<PathGeometry Figures="M239.5,122.63333" />
</Path.Data>
</Path>
<Rectangle
Canvas.Left="281.25"
Canvas.Top="88.066"
Width="144"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="289.5"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="298.501"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="307.502"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="316.503"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="325.504"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="334.51"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="343.511"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="352.503"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="361.504"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="370.505"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="379.506"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="388.507"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="397.513"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="406.514"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="424.251"
Canvas.Top="88.066"
Width="70"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="556.251"
Canvas.Top="88.066"
Width="297"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="493.242"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="502.243"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="511.244"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="520.25"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="529.251"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="538.244"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="547.25"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="564.492"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="573.493"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="582.494"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="591.5"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="600.501"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="609.494"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="618.5"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="627.493"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="636"
Canvas.Top="88"
Width="54"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Stroke="Black" />
<Rectangle
Canvas.Left="771.84"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="780.833"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="789.839"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="798.832"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="807.833"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="816.839"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="825.84"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="834.833"
Canvas.Top="88.066"
Width="10"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="511.244"
Canvas.Top="149.4"
Width="70"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="852.251"
Canvas.Top="88.066"
Width="70"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="852.251"
Canvas.Top="149.4"
Width="70"
Height="98"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Stroke="Black" />
<Rectangle
Canvas.Left="929"
Canvas.Top="288"
Width="70"
Height="62"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Stroke="Black" />
<Path
Canvas.Left="174.496"
Canvas.Top="87.882"
Width="107"
Height="132"
Fill="#FFF4F4F5"
Stretch="Fill"
Stroke="Black">
<Path.Data>
<PathGeometry Figures="M173,151.13333 C173,151.13333 159,22.133665 278.5,19.633665" />
</Path.Data>
</Path>
<Path
Canvas.Left="247.74"
Canvas.Top="148.882"
Width="34"
Height="71"
Fill="#FFF4F4F5"
Stretch="Fill"
Stroke="Black">
<Path.Data>
<PathGeometry Figures="M247,150.63333 C247,150.63333 236,92.633665 279,80.633665" />
</Path.Data>
</Path>
<Label
Canvas.Left="437"
Canvas.Top="105"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="称重机" />
<Label
Canvas.Left="525.25"
Canvas.Top="171.762"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="控制柜" />
<Label
Canvas.Left="704.751"
Canvas.Top="106.446"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="封箱机" />
<Label
Canvas.Left="852"
Canvas.Top="189"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Content="喷码和扫码" />
<Label
Canvas.Left="8"
Canvas.Top="171.762"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="称重侧" />
<Label
Canvas.Left="943.244"
Canvas.Top="305.133"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="工作站" />
<Label
Canvas.Left="924"
Canvas.Top="160"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="SkyBlue"
Content="喷码数据"
FontSize="6"
FontWeight="Bold" />
<TextBlock
Canvas.Left="924"
Canvas.Top="179"
Padding="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="LightGray"
FontSize="10"
Text="DYG05030013,20250923,802,3,01,0001"
TextWrapping="Wrap" />
<Label
Canvas.Left="924"
Canvas.Top="208"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="SkyBlue"
Content="扫码数据"
FontSize="6"
FontWeight="Bold" />
<TextBlock
Canvas.Left="924"
Canvas.Top="227"
Padding="2"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Background="LightGray"
FontSize="10"
Text="DYG05030013,20250923,802,3,01,0001"
TextWrapping="Wrap" />
<Label
Canvas.Left="634"
Canvas.Top="105"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Content="内包扫码" />
<Label
Canvas.Left="637"
Canvas.Top="46"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="SkyBlue"
Content="扫码数据"
FontSize="6"
FontWeight="Bold" />
<TextBlock
Canvas.Left="637"
Canvas.Top="65"
Padding="2"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="LightGray"
FontSize="10"
Text="DYG05030013,20250923,802,3,01,0001"
TextWrapping="Wrap" />
<ListView
Canvas.Left="588"
Canvas.Top="155"
Width="260"
Height="200"
HorizontalAlignment="Left"
VerticalAlignment="Center"
d:ItemsSource="{d:SampleData ItemCount=5}">
<ListView.View>
<GridView>
<GridViewColumn />
</GridView>
</ListView.View>
</ListView>
</Canvas>
</Border>
</Grid>
</UserControl>