LIN 调度表功能同步 25002

This commit is contained in:
2026-01-05 22:07:54 +08:00
parent cae76745e5
commit 427cdc5305
17 changed files with 2225 additions and 73 deletions

View File

@@ -0,0 +1,210 @@
<UserControl
x:Class="CapMachine.Wpf.Views.DialogLINSchConfigView"
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:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
xmlns:localEx="clr-namespace:CapMachine.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:vm="clr-namespace:CapMachine.Wpf.ViewModels"
Width="1000"
Height="800"
mc:Ignorable="d">
<UserControl.Resources>
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
<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" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<!--<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<Button
Margin="10,0"
Command="{Binding OpCmd}"
CommandParameter="Add"
FontWeight="Bold"
Foreground="#404040"
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
<StackPanel Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="#404040"
Text="&#xe8c0; " />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="新增" />
</StackPanel>
</Button>
-->
<!--<Button
Margin="10,0"
Command="{Binding CopyCmd}"
FontWeight="Bold"
Foreground="#404040"
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
<StackPanel Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="#404040"
Text="&#xe9c6;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="复制" />
</StackPanel>
</Button>-->
<!--
<Button
Margin="10,0"
Command="{Binding OpCmd}"
CommandParameter="Delete"
FontWeight="Bold"
Foreground="#404040"
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="#404040"
Text="&#xe9d9;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="删除" />
</StackPanel>
</Button>
</StackPanel>-->
<StackPanel
Margin="30,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Margin="10,0"
Command="{Binding OpCmd}"
CommandParameter="LoadSch"
FontWeight="Bold"
Foreground="Green"
Style="{StaticResource MaterialDesignFlatAccentBgButton}">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="Green"
Text="&#xe63b;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="下载" />
</StackPanel>
</Button>
<!--<TextBlock
Margin="10,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="22"
Text="&#xe9ff;" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Text="报文发送方式:"
TextAlignment="Center" />
<ComboBox
Width="120"
DisplayMemberPath="Text"
FontSize="20"
ItemsSource="{Binding SendOrderCbxItems}"
SelectedValue="{Binding CurSendOrder, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />-->
</StackPanel>
<Grid Grid.Row="1">
<Border
Margin="5"
Padding="6"
BorderBrush="#D0D0D0"
BorderThickness="1"
CornerRadius="4">
<TreeView ItemsSource="{Binding SchTabTree}">
<TreeView.ItemTemplate>
<!-- 父节点模板:不使用 DataType避免类型解析 -->
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<TextBlock Text=" " />
<TextBlock
FontSize="20"
FontWeight="Bold"
Text="{Binding SchTabName}" />
</StackPanel>
<!-- 子节点模板:文本显示 -->
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<StackPanel VerticalAlignment="Center" Orientation="Horizontal">
<CheckBox
Margin="0,0,6,0"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding CanEdit}" />
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="DimGray">
<Run Text="{Binding MsgName}" />
<Run Text=" (Index: " />
<Run Text="{Binding MsgNameIndex}" />
<Run Text=")" />
</TextBlock>
</StackPanel>
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Border>
</Grid>
<StackPanel
Grid.Row="2"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Margin="10,10"
Command="{Binding SaveCmd}"
Content="确定"
Foreground="White" />
<Button
Margin="10,0"
Command="{Binding CancelCmd}"
Content="取消"
Foreground="White" />
</StackPanel>
</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 CapMachine.Wpf.Views
{
/// <summary>
/// DialogLINSchConfigView.xaml 的交互逻辑
/// </summary>
public partial class DialogLINSchConfigView : UserControl
{
public DialogLINSchConfigView()
{
InitializeComponent();
}
}
}

View File

@@ -406,7 +406,14 @@
FontSize="18"
Text="&#xe9f8;" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="波特率" />
<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.BaudRate}" />
<ComboBox
Width="100"
DisplayMemberPath="Text"
FontSize="16"
ItemsSource="{Binding DataBaudRateCbxItems}"
SelectedValue="{Binding SelectedLINConfigExdDto.BaudRate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
<!--<TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding SelectedLINConfigExdDto.BaudRate}" />-->
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
@@ -573,6 +580,84 @@
</StackPanel>
<StackPanel
Grid.Row="1"
Grid.Column="1"
Margin="-20,0"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="20"
Text="&#xe977;" />
<TextBlock
Width="80"
Style="{StaticResource TextBlockStyle}"
Text="报文状态:" />
<Border
Margin="0,12"
BorderThickness="1"
CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="Gray" />
<Style.Triggers>
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsSendOk}" Value="true">
<Setter Property="Background" Value="LimeGreen" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="发送" />
</Border>
<Border
Margin="2,12"
BorderThickness="1"
CornerRadius="5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="Gray" />
<Style.Triggers>
<DataTrigger Binding="{Binding LinDriveService.ToomossLinDrive.IsReviceOk}" Value="true">
<Setter Property="Background" Value="LimeGreen" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<TextBlock
Margin="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="White"
Text="接收" />
</Border>
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="20"
Text="&#xe796;" />
<TextBlock
Width="90"
Style="{StaticResource TextBlockStyle}"
Text="启用调度表:" />
<ToggleButton
Width="40"
Margin="5,2"
Command="{Binding SchEnableCmd}"
CommandParameter="{Binding SelectedLINConfigExdDto.SchEnable}"
IsChecked="{Binding SelectedLINConfigExdDto.SchEnable}"
Style="{StaticResource MaterialDesignSwitchToggleButton}"
ToolTip="启用调度表" />
</StackPanel>
</Grid>
</Grid>
@@ -631,6 +716,24 @@
Margin="0,0,15,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Margin="5,0"
Command="{Binding WriteCmd}"
CommandParameter="WriteSch"
Foreground="White">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Text="&#xe796;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Text="调度表" />
</StackPanel>
</Button>
<Button
Margin="5,0"
Command="{Binding WriteCmd}"
@@ -710,13 +813,26 @@
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding DefautValue}">
<DataGridTextColumn.Header>
<TextBlock FontWeight="Bold" Text="默认值" />
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn Width="200" Header="规则名称">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox
DisplayMemberPath="Text"
ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.WriteRuleCbxItems}"
SelectedValue="{Binding LogicRuleId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="Key" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<prism:InvokeCommandAction Command="{Binding WriteGridSelectionChangedCmd}" CommandParameter="{Binding ElementName=LINWriteDatagrid, Path=SelectedItem}" />