motorTest/Views/ControlPanel.xaml
2026-10-17 11:39:30 +08:00

192 lines
11 KiB
XML

<UserControl x:Class="Views.ControlPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Motion="clr-namespace:Views.Motion"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="1080" d:DesignWidth="600" mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="42" />
<RowDefinition Height="70*" />
<RowDefinition Height="30*" />
</Grid.RowDefinitions>
<Border Background="{Binding ShowStatu.StatusBackground}">
<Viewbox>
<TextBlock VerticalAlignment="Center" FontSize="25" FontWeight="Bold" Foreground="{Binding ShowStatu.StatusForeground}" Tag="{Binding ShowStatu.StatuInfo}" Text="{Binding ShowStatu.StatuInfo}" />
</Viewbox>
</Border>
<TabControl Grid.Row="1" Background="{x:Null}">
<TabItem Header="资讯">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="1.3*" />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Border Grid.Row="1" Grid.ColumnSpan="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Content="投入数量:" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Content="{Binding CurrentMachine.Quantitys}" FontSize="40" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" Content="产出良品:" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Content="{Binding CurrentMachine.Produce}" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Content="产出不良:" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" Content="{Binding CurrentMachine.ProduceBads}" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Center" Content="生产良率:" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="3" Height="{Binding ElementName=lb, Path=ActualHeight}" HorizontalAlignment="Center" Style="{DynamicResource Mylabel1}">
<TextBlock Grid.Row="3" Foreground="White" Text="{Binding CurrentMachine.RejectRatio, StringFormat='P'}" />
</Label>
</Grid>
</Border>
<GroupBox Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="2" Padding="0" Header="左">
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" ItemsSource="{Binding CurrentMachine.MeasureRangeValueLeft}">
<DataGrid.Columns>
<DataGridTextColumn Width="*" Binding="{Binding RanggeName}" Header="名称" IsReadOnly="True" />
<DataGridTextColumn Width="*" Binding="{Binding BaseValue}" Header="标准值" IsReadOnly="True" />
<DataGridTextColumn Width="*" Binding="{Binding MaxValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Header="最大值" IsReadOnly="True" />
<DataGridTextColumn Width="*" Binding="{Binding MinValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" Header="最小值" IsReadOnly="True" />
<DataGridTextColumn Width="*" Binding="{Binding ActualValue, StringFormat={}{0:F3}}" Header="测量值" IsReadOnly="True" />
<DataGridTextColumn Width="0.5*" Binding="{Binding ResultStr}" Header="结果" IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="Text" Value="OK">
<Setter Property="Background" Value="Lime" />
</Trigger>
<Trigger Property="Text" Value="NG">
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.ColumnSpan="2" Padding="0" Content="{Binding RobotPickerGrid}" Header="机器人吸嘴状态" />
<GroupBox Grid.Row="3" Grid.ColumnSpan="1" Padding="0" Content="{Binding LeftFlipGrid}" Header="翻转吸嘴状态" />
<GroupBox Grid.Row="3" Grid.Column ="1" Grid.ColumnSpan="1" Padding="0" Content="{Binding FlipGrid}" Header="翻转吸嘴状态" />
<GroupBox Grid.Row="4" Grid.ColumnSpan="2" Padding="0" Content="{Binding NGGrid}" Header="NG位" />
<GroupBox Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" Header="压机1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Content="当前时间" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="1" Content="{Binding CurrentMachine.MyQita.Press1.PressTime}" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="2" Content="目标时间" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="0" Grid.Column="3" Content="{Binding CurrentMachine.MyQita.Press1.KeepTime}" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Content="当前压力" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="1" Content="{Binding CurrentMachine.MyQita.Press1.Pressure}" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="2" Content="目标压力" Foreground="White" Style="{DynamicResource Mylabel1}" />
<Label Grid.Row="1" Grid.Column="3" Content="{Binding CurrentMachine.MyQita.Press1.PresssureTarage}" Foreground="White" Style="{DynamicResource Mylabel1}" />
</Grid>
</GroupBox>
</Grid>
</TabItem>
<TabItem DataContext="{Binding MCVM}" Header="轴状态">
<Motion:ShaftState />
</TabItem>
</TabControl>
<GroupBox Name="GBST" Grid.Row="2" Margin="0" Header="控制按钮">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Button Grid.Row="0" Margin="1"
Background="{Binding ElementName=GBST, Path=BorderBrush}"
Command="{Binding StartCommand}"
FontFamily="楷体" FontSize="50" FontWeight="Bold"
Style="{DynamicResource commBtn}">
<Viewbox>
<ContentControl Content="启动" />
</Viewbox>
</Button>
<Button Grid.Row="0" Grid.Column="1" Margin="1"
Background="{Binding ElementName=GBST, Path=BorderBrush}"
Command="{Binding StopCommand}"
FontFamily="楷体" FontSize="50" FontWeight="Bold"
Style="{DynamicResource commBtn}">
<Viewbox>
<ContentControl Content="暂停" />
</Viewbox>
</Button>
<Button Grid.Row="1" Margin="1"
Background="{Binding ElementName=GBST, Path=BorderBrush}"
Command="{Binding ResetSoftCommand}"
FontFamily="楷体" FontSize="50" FontWeight="Bold"
Style="{DynamicResource commBtn}">
<Viewbox>
<ContentControl Content="重置" />
</Viewbox>
</Button>
<Button Grid.Row="1" Grid.Column="1" Margin="1"
Background="{Binding ElementName=GBST, Path=BorderBrush}"
Command="{Binding CloseCommand}"
FontFamily="楷体" FontSize="50" FontWeight="Bold"
Style="{DynamicResource commBtn}">
<Viewbox>
<ContentControl Content="退出" />
</Viewbox>
</Button>
</Grid>
</GroupBox>
</Grid>
</UserControl>