You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

239 lines
14 KiB
XML

<Window x:Class="Sln_Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sln_wpf="clr-namespace:Sln_Wpf"
Title="WCS平台" Height="700" Width="1200"
WindowStartupLocation="CenterScreen" Background="#F5F7FA"
WindowStyle="None" ResizeMode="NoResize"
AllowsTransparency="True">
<Window.Resources>
<!-- 按钮悬停效果样式 -->
<Style x:Key="NavButtonStyle" TargetType="Button">
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#3A7CA5"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Height" Value="70"/>
<Setter Property="Width" Value="200"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="8"
Margin="10">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#2C5A7A"/>
<Setter Property="Cursor" Value="Hand"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="#1F405A"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 窗口控制按钮样式 -->
<Style x:Key="WindowControlButtonStyle" TargetType="Button">
<Setter Property="Width" Value="46"/>
<Setter Property="Height" Value="46"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="Foreground" Value="#5A6E7A"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E9ECF1"/>
<Setter Property="Foreground" Value="#2C3E50"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 关闭按钮悬停样式(红色) -->
<Style x:Key="CloseButtonStyle" TargetType="Button" BasedOn="{StaticResource WindowControlButtonStyle}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E74C3C"/>
<Setter Property="Foreground" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- 卡片样式 -->
<Style x:Key="CardStyle" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="CornerRadius" Value="12"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="LightGray" BlurRadius="15" ShadowDepth="2" Opacity="0.3"/>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
<RowDefinition Height="*"/>
<RowDefinition Height="120"/>
</Grid.RowDefinitions>
<!-- 顶部栏:标题 + 自定义窗口按钮 -->
<Grid Grid.Row="0" Background="White" Margin="0,0,0,0">
<Border BorderBrush="#E9ECF1" BorderThickness="0,0,0,1" Background="White">
<Grid Margin="30,0,30,0">
<!-- 窗口拖拽区域 -->
<Rectangle Fill="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown" Cursor="SizeAll"/>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="🏭 " FontSize="32" VerticalAlignment="Center"/>
<TextBlock Text="WCS系统" FontSize="26" FontWeight="Bold" Foreground="#2C3E50" VerticalAlignment="Center"/>
<TextBlock Text=" | 智能调度平台" FontSize="16" Foreground="#7F8C8D" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<!-- 右上角:时钟 + 自定义窗口按钮 -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
<!-- 时钟显示 -->
<Border Background="#F0F2F5" CornerRadius="20" Padding="15,8,20,8" Margin="0,0,15,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="🕒 " FontSize="20" VerticalAlignment="Center"/>
<TextBlock x:Name="ClockText" Text="2025-04-02 14:30:25" FontSize="18" FontWeight="Medium" Foreground="#2C3E50"/>
</StackPanel>
</Border>
<!-- 自定义窗口按钮组 -->
<StackPanel Orientation="Horizontal">
<Button x:Name="BtnMinimize" Style="{StaticResource WindowControlButtonStyle}" Content="─" Click="BtnMinimize_Click" ToolTip="最小化"/>
<Button x:Name="BtnMaximizeRestore" Style="{StaticResource WindowControlButtonStyle}" Content="□" Click="BtnMaximizeRestore_Click" ToolTip="全屏/恢复"/>
<Button x:Name="BtnClose" Style="{StaticResource CloseButtonStyle}" Content="✕" Click="BtnClose_Click" ToolTip="关闭"/>
</StackPanel>
</StackPanel>
</Grid>
</Border>
</Grid>
<!-- 内容区域:展示当前模块的概览信息 -->
<ContentControl x:Name="MainContentArea" Grid.Row="1" Margin="0">
<Grid Margin="30,20,30,20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 欢迎卡片 -->
<Border Grid.Row="0" Style="{StaticResource CardStyle}" Padding="25,20" Margin="0,0,0,20">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel>
<TextBlock Text="欢迎回来," FontSize="20" Foreground="#5A6E7A"/>
<TextBlock Text="WCS 平台已就绪" FontSize="28" FontWeight="Bold" Foreground="#2C3E50" Margin="0,5,0,10"/>
<TextBlock Text="" FontSize="14" Foreground="#7F8C8D"/>
</StackPanel>
<Border Grid.Column="1" Background="#E8F0FE" CornerRadius="12" Padding="15,10" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<TextBlock Text="✅" FontSize="24"/>
<TextBlock x:Name="PlcConnectedFlag" Text="PLC已连接" FontSize="14" Foreground="#2C5A7A" VerticalAlignment="Center" Margin="5,0,0,0"/>
</StackPanel>
</Border>
</Grid>
</Border>
<!-- 统计卡片区:展示设备、仓库、任务概览 -->
<Grid Grid.Row="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 设备统计卡片 -->
<Border Grid.Column="0" Style="{StaticResource CardStyle}" Margin="0,0,15,0" Padding="20">
<StackPanel>
<TextBlock Text="📡 设备状态" FontSize="16" FontWeight="Bold" Foreground="#3A7CA5" Margin="0,0,0,12"/>
<TextBlock Text="提升机" FontSize="14" Foreground="#4A627A"/>
<TextBlock Text="在线: 4 / 离线: 0" FontSize="22" FontWeight="Bold" Foreground="#2C3E50" Margin="0,5,0,10"/>
<TextBlock Text="AGV 小车" FontSize="14" Foreground="#4A627A" Margin="0,10,0,0"/>
<TextBlock Text="在线: 8 / 离线: 1" FontSize="22" FontWeight="Bold" Foreground="#2C3E50" Margin="0,5,0,0"/>
<TextBlock Text="● 全部设备通讯正常" FontSize="12" Foreground="#27AE60" Margin="0,15,0,0"/>
</StackPanel>
</Border>
<!-- 仓库统计卡片 -->
<Border Grid.Column="1" Style="{StaticResource CardStyle}" Margin="0,0,15,0" Padding="20">
<StackPanel>
<TextBlock Text="🏚️ 仓储概况" FontSize="16" FontWeight="Bold" Foreground="#3A7CA5" Margin="0,0,0,12"/>
<TextBlock Text="总库位" FontSize="14" Foreground="#4A627A"/>
<TextBlock Text="1,280" FontSize="28" FontWeight="Bold" Foreground="#2C3E50" Margin="0,5,0,5"/>
<TextBlock Text="已用库位: 845 | 空闲: 435" FontSize="13" Foreground="#7F8C8D"/>
<ProgressBar Value="66" Height="8" Background="#E9ECF1" Foreground="#3A7CA5" Margin="0,12,0,0"/>
<TextBlock Text="库容利用率 66%" FontSize="12" Foreground="#5A6E7A" Margin="0,5,0,0"/>
</StackPanel>
</Border>
<!-- 任务统计卡片 -->
<Border Grid.Column="2" Style="{StaticResource CardStyle}" Padding="20">
<StackPanel>
<TextBlock Text="📋 任务看板" FontSize="16" FontWeight="Bold" Foreground="#3A7CA5" Margin="0,0,0,12"/>
<TextBlock Text="执行中" FontSize="14" Foreground="#4A627A"/>
<TextBlock Text="23" FontSize="28" FontWeight="Bold" Foreground="#E67E22" Margin="0,5,0,5"/>
<TextBlock Text="等待队列: 12 | 今日完成: 156" FontSize="13" Foreground="#7F8C8D"/>
<Border Background="#FEF5E8" CornerRadius="8" Padding="8,5" Margin="0,12,0,0">
<TextBlock Text="⏱️ 平均响应 2.3s" FontSize="12" Foreground="#E67E22" HorizontalAlignment="Center"/>
</Border>
</StackPanel>
</Border>
</Grid>
<!-- 最近任务动态 -->
<Border Grid.Row="2" Style="{StaticResource CardStyle}" Padding="20" Margin="0,25,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="📌 最近动态" FontSize="16" FontWeight="Bold" Foreground="#2C3E50" Margin="0,0,0,15"/>
<StackPanel Grid.Row="1">
</StackPanel>
</Grid>
</Border>
</Grid>
</ContentControl>
<!-- 底部按钮区域:设备信息 | 仓库信息 | 任务管理 -->
<Border Grid.Row="2" Background="White" BorderBrush="#E9ECF1" BorderThickness="0,1,0,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="MainPage" Style="{StaticResource NavButtonStyle}" Content="🌍 主页面" Click="BtnMainPage_Click"/>
<Button x:Name="BtnDeviceInfo" Style="{StaticResource NavButtonStyle}" Content="📟 设备信息" Click="BtnDeviceInfo_Click"/>
<Button x:Name="BtnWarehouseInfo" Style="{StaticResource NavButtonStyle}" Content="🏢 仓库信息" Click="BtnWarehouseInfo_Click"/>
<Button x:Name="BtnTaskManage" Style="{StaticResource NavButtonStyle}" Content="📊 任务管理" Click="BtnTaskManage_Click"/>
</StackPanel>
</Border>
</Grid>
</Window>