From 1a64a9325d55d1706745f17307b75ef51d934b84 Mon Sep 17 00:00:00 2001 From: anerx <512464164@qq.com> Date: Mon, 17 Mar 2025 03:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=87=A0=E4=B8=AA=E6=A0=87?= =?UTF-8?q?=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Models/Plc/PackLineOption.cs | 20 ++- .../Seyounth.Hyosung.Data.csproj | 1 + Seyounth.Hyosung.Runtime/HyosungRuntime.cs | 6 +- Seyounth.Hyosung.Runtime/IHyosungRuntime.cs | 2 + Seyounth.Hyosung/ViewModels/HomeViewModel.cs | 4 + .../Views/Pages/HomeViewPage.xaml | 159 +++++++++++++++++- 6 files changed, 176 insertions(+), 16 deletions(-) diff --git a/Seyounth.Hyosung.Data/Models/Plc/PackLineOption.cs b/Seyounth.Hyosung.Data/Models/Plc/PackLineOption.cs index 243e641..13d0e74 100644 --- a/Seyounth.Hyosung.Data/Models/Plc/PackLineOption.cs +++ b/Seyounth.Hyosung.Data/Models/Plc/PackLineOption.cs @@ -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; } \ No newline at end of file diff --git a/Seyounth.Hyosung.Data/Seyounth.Hyosung.Data.csproj b/Seyounth.Hyosung.Data/Seyounth.Hyosung.Data.csproj index 19f45ee..0e05839 100644 --- a/Seyounth.Hyosung.Data/Seyounth.Hyosung.Data.csproj +++ b/Seyounth.Hyosung.Data/Seyounth.Hyosung.Data.csproj @@ -7,6 +7,7 @@ + diff --git a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs index c9d2c49..755a0c9 100644 --- a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs +++ b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs @@ -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); } /// diff --git a/Seyounth.Hyosung.Runtime/IHyosungRuntime.cs b/Seyounth.Hyosung.Runtime/IHyosungRuntime.cs index 70f65be..d5a8143 100644 --- a/Seyounth.Hyosung.Runtime/IHyosungRuntime.cs +++ b/Seyounth.Hyosung.Runtime/IHyosungRuntime.cs @@ -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; } diff --git a/Seyounth.Hyosung/ViewModels/HomeViewModel.cs b/Seyounth.Hyosung/ViewModels/HomeViewModel.cs index 5cd6c3e..2d59bd5 100644 --- a/Seyounth.Hyosung/ViewModels/HomeViewModel.cs +++ b/Seyounth.Hyosung/ViewModels/HomeViewModel.cs @@ -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; diff --git a/Seyounth.Hyosung/Views/Pages/HomeViewPage.xaml b/Seyounth.Hyosung/Views/Pages/HomeViewPage.xaml index 51a90f1..4f57b63 100644 --- a/Seyounth.Hyosung/Views/Pages/HomeViewPage.xaml +++ b/Seyounth.Hyosung/Views/Pages/HomeViewPage.xaml @@ -141,7 +141,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file