台架移动界面

This commit is contained in:
hsc
2026-07-03 13:42:07 +08:00
parent 60dc155ccf
commit cb13d3c8b5
9 changed files with 1020 additions and 4 deletions

View File

@@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceEditModule", "DeviceE
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZLGUSBCANFD", "ZLGUSBCANFD\ZLGUSBCANFD.csproj", "{542FE380-2344-4343-9AC6-F0C587C13B88}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchMovementModule", "BenchMovementModule\BenchMovementModule.csproj", "{31F84D0E-3634-4C70-A830-21AF412E3BBF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -113,6 +115,10 @@ Global
{542FE380-2344-4343-9AC6-F0C587C13B88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{542FE380-2344-4343-9AC6-F0C587C13B88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{542FE380-2344-4343-9AC6-F0C587C13B88}.Release|Any CPU.Build.0 = Release|Any CPU
{31F84D0E-3634-4C70-A830-21AF412E3BBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31F84D0E-3634-4C70-A830-21AF412E3BBF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31F84D0E-3634-4C70-A830-21AF412E3BBF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31F84D0E-3634-4C70-A830-21AF412E3BBF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -125,5 +131,6 @@ Global
{3456C3AC-E7FF-45F8-A68F-BEED9969812C} = {1E92D601-68FC-45F6-8251-BD0F39226E5B}
{850A5BE8-0BC1-4D6A-8351-DD812C9C4427} = {1E92D601-68FC-45F6-8251-BD0F39226E5B}
{170AD4C1-189D-4FBE-B10D-2A4304527834} = {1E92D601-68FC-45F6-8251-BD0F39226E5B}
{31F84D0E-3634-4C70-A830-21AF412E3BBF} = {1E92D601-68FC-45F6-8251-BD0F39226E5B}
EndGlobalSection
EndGlobal

View File

@@ -19,6 +19,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BenchMovementModule\BenchMovementModule.csproj" />
<ProjectReference Include="..\Command\Command.csproj" />
<ProjectReference Include="..\DeviceCommand\DeviceCommand.csproj" />
<ProjectReference Include="..\DeviceEditModule\DeviceEditModule.csproj" />

View File

@@ -762,8 +762,9 @@ namespace ADP.ViewModels
_regionManager.RequestNavigate(settingRegion, "SettingView", settingParameters);
IsLeftDrawerOpen = false;
break;
case "更新界面":
_regionManager.RequestNavigate("ShellViewManager", "UpdateInfoView");
case "台架移动界面":
if (_globalInfo.CurrentScope != "default") return;
_regionManager.RequestNavigate("ShellViewManager", "BenchMovementView");
break;
}
}

View File

@@ -61,11 +61,11 @@
Style="{StaticResource MaterialDesignFlatButton}"
Margin="8" />
<!--<Button Content="更新界面"
<Button Content="台架移动界面"
Command="{Binding NavigateCommand}"
CommandParameter="{Binding Content, RelativeSource={RelativeSource Self}}"
Style="{StaticResource MaterialDesignFlatButton}"
Margin="8" />-->
Margin="8" />
</StackPanel>
</materialDesign:DrawerHost.LeftDrawerContent>
<Grid>

View File

@@ -0,0 +1,19 @@
using System.Reflection;
using BenchMovementModule.Views;
namespace BenchMovementModule
{
public class BenchMovementModule : IModule
{
public void OnInitialized(IContainerProvider containerProvider)
{
IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();
regionManager.RegisterViewWithRegion("ShellViewManager", typeof(BenchMovementView));
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<BenchMovementView>("BenchMovementView");
}
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\UIShare\UIShare.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,413 @@
using System;
using System.Windows.Input;
using UIShare.ViewModelBase;
namespace BenchMovementModule.ViewModels
{
public class BenchMovementViewModel : NavigateViewModelBase, IRegionMemberLifetime, IDisposable
{
#region
public bool KeepAlive => true;
// --- 1. 台架位置区 ---
private double _posX;
public double PosX
{
get => _posX;
set => SetProperty(ref _posX, value);
}
private double _posY;
public double PosY
{
get => _posY;
set => SetProperty(ref _posY, value);
}
private double _posZ;
public double PosZ
{
get => _posZ;
set => SetProperty(ref _posZ, value);
}
// --- 2. 信号回读区 ---
private double _pos1X;
public double Pos1X
{
get => _pos1X;
set => SetProperty(ref _pos1X, value);
}
private int _pos1Quality;
public int Pos1Quality
{
get => _pos1Quality;
set => SetProperty(ref _pos1Quality, value);
}
private double _pos2X;
public double Pos2X
{
get => _pos2X;
set => SetProperty(ref _pos2X, value);
}
private int _pos2Quality;
public int Pos2Quality
{
get => _pos2Quality;
set => SetProperty(ref _pos2Quality, value);
}
private double _pos1Y;
public double Pos1Y
{
get => _pos1Y;
set => SetProperty(ref _pos1Y, value);
}
private double _pos2Y;
public double Pos2Y
{
get => _pos2Y;
set => SetProperty(ref _pos2Y, value);
}
// --- 3. 扫描参数区 ---
private double _scanStepX = 10;
public double ScanStepX
{
get => _scanStepX;
set => SetProperty(ref _scanStepX, value);
}
private double _scanStartX = -120;
public double ScanStartX
{
get => _scanStartX;
set => SetProperty(ref _scanStartX, value);
}
private double _scanEndX = 120;
public double ScanEndX
{
get => _scanEndX;
set => SetProperty(ref _scanEndX, value);
}
private double _scanStepY = 10;
public double ScanStepY
{
get => _scanStepY;
set => SetProperty(ref _scanStepY, value);
}
private double _scanStartY = -120;
public double ScanStartY
{
get => _scanStartY;
set => SetProperty(ref _scanStartY, value);
}
private double _scanEndY = 120;
public double ScanEndY
{
get => _scanEndY;
set => SetProperty(ref _scanEndY, value);
}
private double _scanStepZ = 1;
public double ScanStepZ
{
get => _scanStepZ;
set => SetProperty(ref _scanStepZ, value);
}
private double _scanStartZ = 0;
public double ScanStartZ
{
get => _scanStartZ;
set => SetProperty(ref _scanStartZ, value);
}
private double _scanEndZ = 0;
public double ScanEndZ
{
get => _scanEndZ;
set => SetProperty(ref _scanEndZ, value);
}
// --- 4. 寸动参数区 ---
private double _jogX;
public double JogX
{
get => _jogX;
set => SetProperty(ref _jogX, value);
}
private double _jogY;
public double JogY
{
get => _jogY;
set => SetProperty(ref _jogY, value);
}
private double _jogZ;
public double JogZ
{
get => _jogZ;
set => SetProperty(ref _jogZ, value);
}
// --- 5. 设置页网络及PLC参数 ---
private string _plcIp = "192.168.0.30";
public string PlcIp
{
get => _plcIp;
set => SetProperty(ref _plcIp, value);
}
private int _plcPort = 502;
public int PlcPort
{
get => _plcPort;
set => SetProperty(ref _plcPort, value);
}
// --- 6. 设置页:速度与零点设定 ---
private double _speedX;
public double SpeedX
{
get => _speedX;
set => SetProperty(ref _speedX, value);
}
private double _speedY;
public double SpeedY
{
get => _speedY;
set => SetProperty(ref _speedY, value);
}
private double _speedZ;
public double SpeedZ
{
get => _speedZ;
set => SetProperty(ref _speedZ, value);
}
private double _zeroX;
public double ZeroX
{
get => _zeroX;
set => SetProperty(ref _zeroX, value);
}
private double _zeroY;
public double ZeroY
{
get => _zeroY;
set => SetProperty(ref _zeroY, value);
}
private double _zeroZ;
public double ZeroZ
{
get => _zeroZ;
set => SetProperty(ref _zeroZ, value);
}
// --- 7. 设置页CAN设定信号映射 ---
private int _canChannel = 0;
public int CanChannel
{
get => _canChannel;
set => SetProperty(ref _canChannel, value);
}
private string _canMsgId = "0X0";
public string CanMsgId
{
get => _canMsgId;
set => SetProperty(ref _canMsgId, value);
}
private string _canMsgName = string.Empty;
public string CanMsgName
{
get => _canMsgName;
set => SetProperty(ref _canMsgName, value);
}
private string _sigPos1X = string.Empty;
public string SigPos1X
{
get => _sigPos1X;
set => SetProperty(ref _sigPos1X, value);
}
private string _sigPos2X = string.Empty;
public string SigPos2X
{
get => _sigPos2X;
set => SetProperty(ref _sigPos2X, value);
}
private string _sigPos1Y = string.Empty;
public string SigPos1Y
{
get => _sigPos1Y;
set => SetProperty(ref _sigPos1Y, value);
}
private string _sigPos2Y = string.Empty;
public string SigPos2Y
{
get => _sigPos2Y;
set => SetProperty(ref _sigPos2Y, value);
}
private string _sigPos1Quality = string.Empty;
public string SigPos1Quality
{
get => _sigPos1Quality;
set => SetProperty(ref _sigPos1Quality, value);
}
private string _sigPos2Quality = string.Empty;
public string SigPos2Quality
{
get => _sigPos2Quality;
set => SetProperty(ref _sigPos2Quality, value);
}
#endregion
#region
// 扫描控制面板命令
public ICommand StartScanCommand { get; }
public ICommand StopScanCommand { get; }
public ICommand GoHomeCommand { get; }
// 寸动执行单轴移动
public ICommand MoveXCommand { get; }
public ICommand MoveYCommand { get; }
public ICommand MoveZCommand { get; }
// 全局控制
public ICommand EmergencyStopCommand { get; }
// 参数设置应用命令
public ICommand ApplyNetworkCommand { get; }
public ICommand SetSpeedCommand { get; }
public ICommand SetZeroCommand { get; }
#endregion
#region
private readonly IContainerProvider _containerProvider;
private bool _isInitiated = false;
private string _testStatus = string.Empty;
#endregion
public BenchMovementViewModel(IContainerProvider containerProvider) : base(containerProvider)
{
_containerProvider = containerProvider;
// 初始化扫描控制命令绑定
StartScanCommand = new DelegateCommand(OnStartScan);
StopScanCommand = new DelegateCommand(OnStopScan);
GoHomeCommand = new DelegateCommand(OnGoHome);
// 初始化寸动命令绑定
MoveXCommand = new DelegateCommand(OnMoveX);
MoveYCommand = new DelegateCommand(OnMoveY);
MoveZCommand = new DelegateCommand(OnMoveZ);
// 急停与设置保存
EmergencyStopCommand = new DelegateCommand(OnEmergencyStop);
ApplyNetworkCommand = new DelegateCommand(OnApplyNetwork);
SetSpeedCommand = new DelegateCommand(OnSetSpeed);
SetZeroCommand = new DelegateCommand(OnSetZero);
}
#region
private void OnStartScan()
{
// TODO: 等协议到了处理开始扫描
}
private void OnStopScan()
{
// TODO: 等协议到了处理停止扫描
}
private void OnGoHome()
{
// TODO: 等协议到了处理台架回原点逻辑
}
private void OnMoveX()
{
// TODO: 执行单轴X向绝对位置寸动
}
private void OnMoveY()
{
// TODO: 执行单轴Y向绝对位置寸动
}
private void OnMoveZ()
{
// TODO: 执行单轴Z向绝对位置寸动
}
private void OnEmergencyStop()
{
// TODO: 全局急停高优先级报文/IO发送
}
private void OnApplyNetwork()
{
// TODO: 应用PLC的IP和端口网络连接配置
}
private void OnSetSpeed()
{
// TODO: 发送三轴移动速度设定参数
}
private void OnSetZero()
{
// TODO: 发送台架绝对位置零点校准设定
}
#endregion
#region
public override void OnNavigatedTo(NavigationContext navigationContext)
{
base.OnNavigatedTo(navigationContext);
if (!_isInitiated && navigationContext.Parameters.ContainsKey("Name"))
{
_testStatus = navigationContext.Parameters.GetValue<string>("Name");
// TODO: 若后续需要从全局环境 Scope 字典中加载参数配置,可以在此处对齐获取:
// var scope = _globalInfo.ScopeDic[_testStatus];
_isInitiated = true;
}
}
public void Dispose()
{
// 用于界面关闭或Region注销时的资源释放例如解除事件订阅、断开临时Socket通道、清空通信缓冲
}
#endregion
}
}

View File

@@ -0,0 +1,533 @@
<UserControl x:Class="BenchMovementModule.Views.BenchMovementView"
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:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:prism="http://prismlibrary.com/"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
prism:ViewModelLocator.AutoWireViewModel="True"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<Style TargetType="TextBlock" x:Key="HeaderStyle">
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="2,2,2,5"/>
</Style>
<Style TargetType="TextBlock" x:Key="LabelStyle">
<Setter Property="Foreground" Value="#555555"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5"/>
</Style>
<Style TargetType="TextBlock" x:Key="ValueStyle">
<Setter Property="Foreground" Value="#0056B3"/>
<Setter Property="FontSize" Value="26"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Background" Value="White"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="BorderBrush" Value="#CCCCCC"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="4,2"/>
<Setter Property="Height" Value="28"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<!-- 极具机械/按钮交互感的现代工业 Button 样式 -->
<Style TargetType="Button">
<Setter Property="Background" Value="#F5F5F5"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="BorderBrush" Value="#B8B8B8"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="12,5"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Height" Value="34"/>
<Setter Property="Margin" Value="0,0,0,8"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="btnBorder"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="3">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<!-- 鼠标悬停:变亮并加深边框 -->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#EAEAEA"/>
<Setter TargetName="btnBorder" Property="BorderBrush" Value="#4A90E2"/>
</Trigger>
<!-- 鼠标按下:明显的下凹和变暗交互感 -->
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#DCDCDC"/>
<Setter TargetName="btnBorder" Property="BorderBrush" Value="#2A6099"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 针对特殊控制按钮单独定制的样式 -->
<Style TargetType="Button" x:Key="StopButtonStyle" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="#FFF0F0"/>
<Setter Property="Foreground" Value="#C00000"/>
<Setter Property="BorderBrush" Value="#E0A0A0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="btnBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="3">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#FFE0E0"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#F0C0C0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="EmergencyButtonStyle" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Background" Value="#D9534F"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="#D43F3A"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="btnBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#C9302C"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="btnBorder" Property="Background" Value="#AC2925"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="GroupBox">
<Setter Property="BorderBrush" Value="#D0D0D0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="6"/>
<Setter Property="Padding" Value="10"/>
</Style>
</UserControl.Resources>
<!-- 浅灰、偏白色工业背景 -->
<Grid Background="#F0F2F5">
<TabControl Background="Transparent" BorderThickness="0">
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Background" Value="#E0E4E8"/>
<Setter Property="Foreground" Value="#333333"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="25,6"/>
<Setter Property="Margin" Value="2,0,2,0"/>
</Style>
</TabControl.Resources>
<!-- ======================= 1. 主页标签页 ======================= -->
<TabItem Header="标签">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- 左上:台架位置 & 信号回读 -->
<Grid Grid.Row="0" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1.5*"/>
</Grid.ColumnDefinitions>
<!-- 台架位置 -->
<GroupBox Grid.Column="0">
<GroupBox.Header>
<TextBlock Text="台架位置" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="X (mm)" Style="{StaticResource LabelStyle}"/>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding PosX}" Style="{StaticResource ValueStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Y (mm)" Style="{StaticResource LabelStyle}"/>
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding PosY}" Style="{StaticResource ValueStyle}"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Z (mm)" Style="{StaticResource LabelStyle}"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding PosZ}" Style="{StaticResource ValueStyle}"/>
</Grid>
</GroupBox>
<!-- 信号回读 -->
<GroupBox Grid.Column="1">
<GroupBox.Header>
<TextBlock Text="信号回读" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<UniformGrid Columns="2">
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS1_X(mm): " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos1X}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS1_Quality: " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos1Quality}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS2_X(mm): " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos2X}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS2_Quality: " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos2Quality}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS1_Y(mm): " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos1Y}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="POS2_Y(mm): " Style="{StaticResource LabelStyle}"/>
<TextBlock Text="{Binding Pos2Y}" Foreground="#0056B3" FontSize="18" FontWeight="Bold" VerticalAlignment="Center"/>
</StackPanel>
</UniformGrid>
</GroupBox>
</Grid>
<!-- 左中:扫描参数 -->
<GroupBox Grid.Row="1" Grid.Column="0">
<GroupBox.Header>
<TextBlock Text="扫描参数" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- X轴 -->
<TextBlock Grid.Row="0" Grid.Column="0" Text="X移动步长(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding ScanStepX}" Margin="5"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="X起始位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="0" Grid.Column="3" Text="{Binding ScanStartX}" Margin="5"/>
<TextBlock Grid.Row="0" Grid.Column="4" Text="X终止位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="0" Grid.Column="5" Text="{Binding ScanEndX}" Margin="5"/>
<!-- Y轴 -->
<TextBlock Grid.Row="1" Grid.Column="0" Text="Y移动步长(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding ScanStepY}" Margin="5"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="Y起始位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding ScanStartY}" Margin="5"/>
<TextBlock Grid.Row="1" Grid.Column="4" Text="Y终止位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="1" Grid.Column="5" Text="{Binding ScanEndY}" Margin="5"/>
<!-- Z轴 -->
<TextBlock Grid.Row="2" Grid.Column="0" Text="Z移动步长(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding ScanStepZ}" Margin="5"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="Z起始位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding ScanStartZ}" Margin="5"/>
<TextBlock Grid.Row="2" Grid.Column="4" Text="Z终止位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="5" Text="{Binding ScanEndZ}" Margin="5"/>
</Grid>
</GroupBox>
<!-- 左下:寸动参数与雷达位置图 -->
<Grid Grid.Row="2" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- 寸动参数 -->
<GroupBox Grid.Column="0">
<GroupBox.Header>
<TextBlock Text="寸动参数" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="X移动位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding JogX}" Margin="5"/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Y移动位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding JogY}" Margin="5"/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Z移动位置(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding JogZ}" Margin="5"/>
</Grid>
</GroupBox>
<!-- 坐标示意图 -->
<GroupBox Grid.Column="1">
<GroupBox.Header>
<TextBlock Text="台架现在位置" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<Grid Margin="5" Background="White">
<!-- 十字坐标轴 -->
<Line X1="0" Y1="50" X2="200" Y2="50" Stroke="#B0B0B0" StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="100"/>
<Line X1="100" Y1="0" X2="100" Y2="100" Stroke="#B0B0B0" StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="200" Height="100"/>
<!-- 轴向文本标签 -->
<TextBlock Text="X+" HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="#666666" Margin="0,2,0,0"/>
<TextBlock Text="X-" HorizontalAlignment="Center" VerticalAlignment="Bottom" Foreground="#666666" Margin="0,0,0,2"/>
<TextBlock Text="Y+" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="#666666" Margin="2,0,0,0"/>
<TextBlock Text="Y-" HorizontalAlignment="Right" VerticalAlignment="Center" Foreground="#666666" Margin="0,0,2,0"/>
<!-- 台架模拟中心点 -->
<Border Width="65" Height="35" Background="#E9ECEF" BorderBrush="#999999" BorderThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" CornerRadius="2">
<TextBlock Text="台架位置" Foreground="#333333" FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</Grid>
</GroupBox>
</Grid>
<!-- 右侧控制面板除去Spacing增加Margin防粘连 -->
<Grid Grid.Row="0" Grid.RowSpan="3" Grid.Column="1" Margin="6,6,0,6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 扫描路径操作 -->
<StackPanel Grid.Row="0">
<Button Content="▶ 开始扫描" Command="{Binding StartScanCommand}"/>
<Button Content="■ 停止扫描" Style="{StaticResource StopButtonStyle}" Command="{Binding StopScanCommand}"/>
<Button Content="↩ 回原点" Command="{Binding GoHomeCommand}"/>
<TextBlock Text="扫描路径" Style="{StaticResource LabelStyle}" Margin="0,10,0,4"/>
<ComboBox Height="30" Background="White" Foreground="#333333" SelectedIndex="0" Margin="0,0,0,8" materialDesign:HintAssist.Hint="">
<ComboBoxItem Content="配置文件1.xml"/>
</ComboBox>
</StackPanel>
<!-- 寸动单轴移动按钮组 -->
<Grid Grid.Row="1">
<StackPanel VerticalAlignment="Center">
<Button Content="↕ X 移动" Command="{Binding MoveXCommand}"/>
<Button Content="↔ Y 移动" Command="{Binding MoveYCommand}"/>
<Button Content="↕ Z 移动" Command="{Binding MoveZCommand}"/>
</StackPanel>
</Grid>
<!-- 急停 -->
<Button Grid.Row="2" Content="❌ 急 停" Style="{StaticResource EmergencyButtonStyle}" FontWeight="Bold" FontSize="18" Height="55" Margin="0" Command="{Binding EmergencyStopCommand}"/>
</Grid>
</Grid>
</TabItem>
<!-- ======================= 2. 设置标签页 ======================= -->
<TabItem Header="设置">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="10">
<!-- 台架接口配置 -->
<GroupBox>
<GroupBox.Header>
<TextBlock Text="台架接口" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<StackPanel Orientation="Horizontal" Margin="5">
<StackPanel Orientation="Horizontal" Margin="0,0,15,0">
<TextBlock Text="IP: " Style="{StaticResource LabelStyle}"/>
<TextBox Width="150" Text="{Binding PlcIp}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,0,15,0">
<TextBlock Text="端口: " Style="{StaticResource LabelStyle}"/>
<TextBox Width="80" Text="{Binding PlcPort}"/>
</StackPanel>
<Button Content="应 用" Width="90" Margin="0" Command="{Binding ApplyNetworkCommand}"/>
</StackPanel>
</GroupBox>
<!-- 移动速度与零点设定 -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- 移动速度设定 -->
<GroupBox Grid.Column="0">
<GroupBox.Header>
<TextBlock Text="移动速度设定" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<StackPanel Margin="5">
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="X移动速度(mm/s)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding SpeedX}"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Y移动速度(mm/s)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding SpeedY}"/>
</Grid>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Z移动速度(mm/s)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding SpeedZ}"/>
</Grid>
<Button Content="速度设定" Width="110" HorizontalAlignment="Left" Margin="0" Command="{Binding SetSpeedCommand}"/>
</StackPanel>
</GroupBox>
<!-- 零点设定 -->
<GroupBox Grid.Column="1">
<GroupBox.Header>
<TextBlock Text="零点设定" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<StackPanel Margin="5">
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="X零点(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding ZeroX}"/>
</Grid>
<Grid Margin="0,0,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Y零点(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding ZeroY}"/>
</Grid>
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Z零点(mm)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Column="1" Text="{Binding ZeroZ}"/>
</Grid>
<Button Content="零点设定" Width="110" HorizontalAlignment="Left" Margin="0" Command="{Binding SetZeroCommand}"/>
</StackPanel>
</GroupBox>
</Grid>
<!-- CAN设定 -->
<GroupBox>
<GroupBox.Header>
<TextBlock Text="CAN设定" Style="{StaticResource HeaderStyle}"/>
</GroupBox.Header>
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="280"/>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="140"/>
</Grid.ColumnDefinitions>
<!-- 通道与模式 -->
<TextBlock Grid.Row="0" Grid.Column="0" Text="应用程序CAN通道" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding CanChannel}" Margin="3"/>
<TextBlock Grid.Row="0" Grid.Column="2" Text="模式" Style="{StaticResource LabelStyle}" HorizontalAlignment="Center"/>
<ComboBox Grid.Row="0" Grid.Column="3" Height="28" Background="White" Foreground="#333333" SelectedIndex="0" Margin="3" materialDesign:HintAssist.Hint="">
<ComboBoxItem Content="正常模式"/>
</ComboBox>
<!-- 报文ID -->
<TextBlock Grid.Row="1" Grid.Column="0" Text="报文ID(16进制)" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding CanMsgId}" Margin="3"/>
<!-- 信号名称列表 -->
<TextBlock Grid.Row="2" Grid.Column="0" Text="报文名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding CanMsgName}" Margin="3"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="POS1_X信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos1X}" Margin="3"/>
<TextBlock Grid.Row="4" Grid.Column="0" Text="POS2_X信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos2X}" Margin="3"/>
<TextBlock Grid.Row="5" Grid.Column="0" Text="POS1_Y信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos1Y}" Margin="3"/>
<TextBlock Grid.Row="6" Grid.Column="0" Text="POS2_Y信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos2Y}" Margin="3"/>
<TextBlock Grid.Row="7" Grid.Column="0" Text="POS1_Quality信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos1Quality}" Margin="3"/>
<TextBlock Grid.Row="8" Grid.Column="0" Text="POS2_Quality信号名称" Style="{StaticResource LabelStyle}"/>
<TextBox Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SigPos2Quality}" Margin="3"/>
</Grid>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
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;
namespace BenchMovementModule.Views
{
/// <summary>
/// BenchMovementView.xaml 的交互逻辑
/// </summary>
public partial class BenchMovementView : UserControl
{
public BenchMovementView()
{
InitializeComponent();
}
}
}