增加几个标准

This commit is contained in:
anerx 2025-03-17 03:26:29 +08:00
parent 8e881058f7
commit 1a64a9325d
6 changed files with 176 additions and 16 deletions

View File

@ -1,18 +1,20 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace Seyounth.Hyosung.Data.Models.Plc;
public class PackLineOption
public partial class PackLineOption : ObservableObject
{
public int HeadCount { get; set; }
[ObservableProperty] private int headCount;
public bool HasBox { get; set; }
[ObservableProperty] private bool hasBox;
public bool IsTop { get; set; }
[ObservableProperty] private bool isTop;
public bool IsPack { get; set; }
[ObservableProperty] private bool isPack;
public bool IsFilm { get; set; }
[ObservableProperty] private bool isFilm;
public bool IsLam { get; set; }
[ObservableProperty] private bool isLam;
[ObservableProperty] private string trayCode;
}

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="McProtocol" Version="1.2.5" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />

View File

@ -24,6 +24,7 @@ public class HyosungRuntime(
IHyosungAgvService hyosungAgvService,
IHyosungWmsService hyosungWmsService) : IHyosungRuntime
{
public PackLineOption PackLineOption { get; private set; }
public StackStationModel Stack1 { get; private set; } = new();
public StackStationModel Stack2 { get; private set; } = new();
@ -193,7 +194,7 @@ public class HyosungRuntime(
{
var tray = await trayService.GetByCode(arg);
var variety = await varietyService.GetById(tray.VarietyId);
var option = new PackLineOption()
PackLineOption = new PackLineOption()
{
HeadCount = variety.StackHeadCount ?? 0,
HasBox = variety.HasBox,
@ -209,8 +210,9 @@ public class HyosungRuntime(
IsLam = variety.NeedFilmCoating is NeedType.Need or NeedType.NotNeed
? variety.NeedFilmCoating == NeedType.Need
: tray.IsEven && variety.NeedFilmCoating == NeedType.EvenNeed,
TrayCode = arg
};
await hyosungPlcService.WritePackLineOptionAsync(option);
await hyosungPlcService.WritePackLineOptionAsync(PackLineOption);
}
/// <summary>

View File

@ -1,11 +1,13 @@
using System.Collections.Concurrent;
using Seyounth.Hyosung.Data.Models;
using Seyounth.Hyosung.Data.Models.Plc;
using Seyounth.Hyosung.Runtime.Models;
namespace Seyounth.Hyosung.Runtime;
public interface IHyosungRuntime
{
PackLineOption PackLineOption { get; }
StackStationModel Stack1 { get; }
StackStationModel Stack2 { get; }

View File

@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using Seyounth.Hyosung.Data.Models;
using Seyounth.Hyosung.Data.Models.Plc;
using Seyounth.Hyosung.Data.Services;
using Seyounth.Hyosung.Runtime;
using Seyounth.Hyosung.Runtime.Models;
@ -19,10 +20,13 @@ public partial class HomeViewModel : ObservableObject
[ObservableProperty] private Variety _selectedVariety;
[ObservableProperty] private PackLineOption _packLineOption;
private readonly IHyosungRuntime _runtime;
public HomeViewModel(IVarietyService varietyService, IHyosungRuntime runtime)
{
PackLineOption = runtime.PackLineOption;
_runtime = runtime;
_stack1 = _runtime.Stack1;
_stack2 = _runtime.Stack2;

View File

@ -141,7 +141,7 @@
</materialDesign:Card>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<GroupBox
Width="450"
Width="500"
Margin="16"
FontSize="22"
materialDesign:ElevationAssist.Elevation="Dp6"
@ -163,6 +163,8 @@
Foreground="White" Grid.Row="0" Text="品类:" />
<ComboBox x:Name="VarietyComboBox" Grid.Column="1" Margin="10" Grid.Row="0"
Foreground="White"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Right"
SelectionChanged="VarietyComboBox_OnSelectionChanged"
ItemsSource="{Binding ViewModel.Varieties}"
SelectedItem="{Binding ViewModel.SelectedVariety, Mode=TwoWay}"
@ -170,26 +172,173 @@
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="0" Text="纱车类型:" />
<ComboBox x:Name="YarnCarTypeComboBox" Grid.Column="1" Margin="10" Grid.Row="1"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Right"
Foreground="White"
ItemsSource="{Binding ViewModel.YarnCarTypes}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="2" Grid.Column="0" Text="码垛层数:" />
<TextBox Grid.Column="1" Margin="10" Grid.Row="2" IsEnabled="False"
TextAlignment="Right"
Foreground="White"
Text="{Binding ViewModel.SelectedVariety.StackingLayers}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="3" Grid.Column="0" Text="总数:" />
<TextBox Grid.Column="1" Margin="10" Grid.Row="3" IsEnabled="False"
TextAlignment="Right"
Foreground="White"
Text="{Binding ViewModel.SelectedVariety.TotalCount}" />
<TextBlock x:Name="ControlNoTextBlock" Grid.Row="4" Foreground="White" Grid.Column="0" Text="控制号: " VerticalAlignment="Center" Margin="10"/>
<TextBlock x:Name="ControlNoTextBlock" Grid.Row="4" Foreground="White" Grid.Column="0" Text="控制号: "
VerticalAlignment="Center" Margin="10" />
<Button x:Name="ChangeVarietyButton"
materialDesign:ButtonProgressAssist.IsIndeterminate="True"
Click="ChangeVarietyButton_OnClick"
Margin="20" Grid.Column="1" Grid.Row="4" FontSize="20" Content="切换">
materialDesign:ButtonProgressAssist.IsIndeterminate="True"
Click="ChangeVarietyButton_OnClick"
Margin="20" Grid.Column="1" Grid.Row="4" FontSize="20" Content="切换">
</Button>
</Grid>
</GroupBox>
<GroupBox
Width="300"
Margin="16"
FontSize="22"
materialDesign:ElevationAssist.Elevation="Dp6"
Header="打包区执行标准"
Style="{StaticResource MaterialDesignCardGroupBox}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Text="托盘号:" />
<TextBox TextAlignment="Right" Margin="10" Foreground="White" Grid.Row="0" Grid.Column="1"
IsEnabled="False" Text="{Binding ViewModel.PackLineOption.TrayCode}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="0" Text="定位套:" />
<TextBox TextAlignment="Right" Margin="10" Foreground="White" Grid.Row="1" Grid.Column="1"
IsEnabled="False" Text="{Binding ViewModel.PackLineOption.HeadCount}" />
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Grid.Column="0" Text="顶盖:" />
<CheckBox Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center"
IsChecked="{Binding ViewModel.PackLineOption.IsTop}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Grid.Column="2" Text="护角:" />
<CheckBox Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center"
IsChecked="False" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="0" Text="套箱:" />
<CheckBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center"
IsChecked="{Binding ViewModel.PackLineOption.HasBox}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="2" Text="打带:" />
<CheckBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Center"
IsChecked="{Binding ViewModel.PackLineOption.IsPack}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="2" Grid.Column="0" Text="缠膜:" />
<CheckBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center"
IsChecked="{Binding ViewModel.PackLineOption.IsFilm}" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="2" Grid.Column="2" Text="覆膜:" />
<CheckBox Grid.Row="2" Grid.Column="3" HorizontalAlignment="Center"
IsChecked="{Binding ViewModel.PackLineOption.IsLam}" />
</Grid>
</Grid>
</GroupBox>
<GroupBox
Width="500"
Margin="16"
FontSize="22"
materialDesign:ElevationAssist.Elevation="Dp6"
Header="贴标区执行状态"
Style="{StaticResource MaterialDesignCardGroupBox}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Text="托盘号:" />
<TextBox TextAlignment="Right" Margin="10" Foreground="White" Grid.Row="0" Grid.Column="1"
IsEnabled="False" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="0" Text="定位套:" />
<TextBox TextAlignment="Right" Margin="10" Foreground="White" Grid.Row="1" Grid.Column="1"
IsEnabled="False" />
</Grid>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Grid.Column="0" Text="顶盖:" />
<CheckBox Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="0" Grid.Column="2" Text="护角:" />
<CheckBox Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="0" Text="套箱:" />
<CheckBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="1" Grid.Column="2" Text="打带:" />
<CheckBox Grid.Row="1" Grid.Column="3" HorizontalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="2" Grid.Column="0" Text="缠膜:" />
<CheckBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Margin="10"
Foreground="White" Grid.Row="2" Grid.Column="2" Text="覆膜:" />
<CheckBox Grid.Row="2" Grid.Column="3" HorizontalAlignment="Center" />
</Grid>
</Grid>
</GroupBox>
</StackPanel>
</Grid>
</Page>