From a753f1c7a7c44b5737ac54f2c8689351406b4d0b Mon Sep 17 00:00:00 2001 From: bliestlech-tc Date: Mon, 9 Mar 2026 12:19:09 +0100 Subject: [PATCH] Changes in Description Add new Paramcontrol with Range Validation move Values from general to Etcher-Robot step Table Add File Extension to Save/Open File Dialog --- .../Common/ParamControlIntRange.xaml | 25 ++++++ .../Common/ParamControlIntRange.xaml.cs | 31 +++++++ .../Common/ParamControlIntRangeVM.cs | 80 +++++++++++++++++++ uniper_hmi/UniperHMI/InfineonHMI.csproj | 3 + uniper_hmi/UniperHMI/Model/ReceipeDto.cs | 10 +-- .../Pages/ViewModels/ReceipePageVM.cs | 62 +++++++------- .../UniperHMI/Pages/Views/ReceipePage.xaml | 35 ++++++-- 7 files changed, 199 insertions(+), 47 deletions(-) create mode 100644 uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml create mode 100644 uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs create mode 100644 uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs diff --git a/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml b/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml new file mode 100644 index 0000000..773bb14 --- /dev/null +++ b/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + diff --git a/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs b/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs new file mode 100644 index 0000000..b236b5b --- /dev/null +++ b/uniper_hmi/UniperHMI/Common/ParamControlIntRange.xaml.cs @@ -0,0 +1,31 @@ +using System.Text.RegularExpressions; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Common; + +/// +/// Interaktionslogik für AnalogValue.xaml +/// +public partial class ParamControlIntRange : UserControl +{ + public bool IsReadonly { get; set; } + + public ParamControlIntRange() + { + InitializeComponent(); + // Unloaded += OnUnloaded; + } + + private void OnUnloaded(object? sender, EventArgs e) + { + var disposable = DataContext as IDisposable; + disposable?.Dispose(); + } + + private void NumberValidation(object sender, TextCompositionEventArgs e) + { + Regex regex = new("^[-+]?[0-9]*,?[0-9]+$"); + e.Handled = regex.IsMatch(e.Text); + } +} \ No newline at end of file diff --git a/uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs b/uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs new file mode 100644 index 0000000..6773398 --- /dev/null +++ b/uniper_hmi/UniperHMI/Common/ParamControlIntRangeVM.cs @@ -0,0 +1,80 @@ +using CommunityToolkit.Mvvm.ComponentModel; +using InfineonHMI.Common; +using System.ComponentModel.DataAnnotations; +using TwinCAT.TypeSystem; + +namespace Common; + +public sealed class InRangeAttribute(string propMin, string propMax) : ValidationAttribute +{ + public string PropMin { get; } = propMin; + public string PropMax { get; } = propMax; + + protected override ValidationResult? IsValid(object? value, ValidationContext validationContext) + { + object instance = validationContext.ObjectInstance; + int minValue = (int)(instance.GetType().GetProperty(PropMin)?.GetValue(instance) ?? 1); + int maxValue = (int)(instance.GetType().GetProperty(PropMax)?.GetValue(instance) ?? 1); + int tempValue = (int)(value ?? 1); + + if (tempValue <= maxValue && tempValue >= minValue) + return ValidationResult.Success; + + return new($"Value has to be greater than {minValue} and smaller then {maxValue}"); + } +} + +public sealed partial class ParamControlIntRangeVm : ObservableValidator, IDisposable, IChangeTrackingEx +{ + private int initValue; + + [ObservableProperty] + private int iMin; + + [ObservableProperty] + private int iMax; + + [ObservableProperty] private string sName; + + + private int value; + + [InRangeAttribute(nameof(IMin), nameof(IMax))] + public int Value + { + get => this.value; + set + { + SetProperty(ref this.value, value, true); + if (value >= IMin && value <= IMax) + { + + } + } + } + + + public ParamControlIntRangeVm() + { + SName = "No Name:"; + Value = 0; + initValue = Value; + } + + public void Dispose() + { + } + + public void AcceptChanges() + { + initValue = Value; + } + + public bool IsChanged => initValue != Value; + public void DiscardChanges() + { + Value = initValue; + } +} + + diff --git a/uniper_hmi/UniperHMI/InfineonHMI.csproj b/uniper_hmi/UniperHMI/InfineonHMI.csproj index e4a2f2a..4e8a3e7 100644 --- a/uniper_hmi/UniperHMI/InfineonHMI.csproj +++ b/uniper_hmi/UniperHMI/InfineonHMI.csproj @@ -49,6 +49,9 @@ Code + + Code + Code diff --git a/uniper_hmi/UniperHMI/Model/ReceipeDto.cs b/uniper_hmi/UniperHMI/Model/ReceipeDto.cs index 562b3bf..0d194b4 100644 --- a/uniper_hmi/UniperHMI/Model/ReceipeDto.cs +++ b/uniper_hmi/UniperHMI/Model/ReceipeDto.cs @@ -161,18 +161,13 @@ public class ReceipeEtcher /// public UInt16 NumberRobotPos { get; set; } - public float Rpm { get; set; } /// /// Roboter position and setting data /// public List RobotStepData { get; set; } - /// - /// Radial position of water jet under the blank in mm - /// - public float RadialPosLowerWaterJet { get; set; } - + public ReceipeEtcher() { RobotStepData = new List(); @@ -186,6 +181,9 @@ public class EtcherRobotStepData public float PosY { get; set; } public float PosZ { get; set; } public float AngleAlpha { get; set; } + public float AngleGamma { get; set; } + public float RadialposUnderwater { get; set; } + public float ChuckRpm { get; set; } public float MoveSpeed { get; set; } public float Delay { get; set; } public UInt16 Medium { get; set; } diff --git a/uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs b/uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs index ec8b1b3..ed6e1e0 100644 --- a/uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs +++ b/uniper_hmi/UniperHMI/Pages/ViewModels/ReceipePageVM.cs @@ -48,8 +48,6 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable TargetTemperatureCoolplateVm.IsChanged || PermissibleBeamParamDeviationsVm.IsChanged || TimeIntervallBeamCheckVm.IsChanged || - RadialPosLowerWaterJetVm.IsChanged || - ChuckRpmVm.IsChanged || HvmaxTestCurrentVm.IsChanged || Hvn2PrePurgeTimeVm.IsChanged || HvnumRetriesVm.IsChanged || @@ -123,7 +121,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable private ParamControlFloatVm hvtestFrequencyVm = new(); [ObservableProperty] - private ParamControlIntVm hvpolarityVm = new(); + private ParamControlIntRangeVm hvpolarityVm = new(); [ObservableProperty] private ParamControlFloatVm hvtestPressureN2Vm = new(); @@ -145,16 +143,10 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable [ObservableProperty] private ParamControlIntVm numberRobotPositionsVm = new(); - - [ObservableProperty] - private ParamControlFloatVm chuckRpmVm = new(); - + [ObservableProperty] private ObservableCollection etcherRobotSteps; - [ObservableProperty] - private ParamControlFloatVm radialPosLowerWaterJetVm = new(); - [ObservableProperty] private ParamControlIntVm flowNodeCountVm = new(); @@ -404,6 +396,9 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable PosZ = 0.0f, MoveSpeed = 0.0f, AngleAlpha = 0.0f, + AngleGamma = 0.0f, + ChuckRpm = 0.0f, + RadialposUnderwater = 0.0f, WaterFromAbove = false, WaterFromBelow = false, Medium = 0, @@ -430,6 +425,9 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable PosZ = etchStep.PosZ, MoveSpeed = etchStep.MoveSpeed, AngleAlpha = etchStep.AngleAlpha, + AngleGamma = etchStep.AngleGamma, + ChuckRpm = etchStep.ChuckRpm, + RadialposUnderwater = etchStep.RadialposUnderwater, WaterFromAbove = etchStep.WaterFromAbove, WaterFromBelow = etchStep.WaterFromBelow, Medium = etchStep.Medium, @@ -515,9 +513,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable PermissibleBeamParamDeviationsVm.AcceptChanges(); TimeIntervallBeamCheckVm.AcceptChanges(); - RadialPosLowerWaterJetVm.AcceptChanges(); - ChuckRpmVm.AcceptChanges(); - + HvmaxTestCurrentVm.AcceptChanges(); Hvn2PrePurgeTimeVm.AcceptChanges(); HvnumRetriesVm.AcceptChanges(); @@ -530,6 +526,9 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable HvtestVoltageVm.AcceptChanges(); HvtestPressureN2Vm.AcceptChanges(); FlowReceipe.AcceptChanges(); + trayPositionsCollectionChanged = false; + etcherRobotStepsCollectionChanged = false; + flowreceipeCollectionChanged = false; } [RelayCommand] @@ -547,10 +546,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable PermissibleBeamParamDeviationsVm.DiscardChanges(); TimeIntervallBeamCheckVm.DiscardChanges(); - RadialPosLowerWaterJetVm.DiscardChanges(); - ChuckRpmVm.DiscardChanges(); - - + HvmaxTestCurrentVm.DiscardChanges(); Hvn2PrePurgeTimeVm.DiscardChanges(); HvnumRetriesVm.DiscardChanges(); @@ -584,6 +580,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable public void ReadReceipeFile() { var dlg = new OpenFileDialog(); + dlg.Filter = "XML-Dateien (*.xml)|*.xml|Alle Dateien (*.*)|*.*"; if (dlg.ShowDialog() != true) return; @@ -599,6 +596,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable public void WriteReceipeFile() { var dlg = new SaveFileDialog(); + dlg.Filter = "XML-Dateien (*.xml)|*.xml|Alle Dateien (*.*)|*.*"; if (dlg.ShowDialog() != true) return; @@ -656,9 +654,7 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable PermissibleBeamParamDeviationsVm.PropertyChanged += NewData; TimeIntervallBeamCheckVm.PropertyChanged += NewData; - RadialPosLowerWaterJetVm.PropertyChanged += NewData; - ChuckRpmVm.PropertyChanged += NewData; - + HvmaxTestCurrentVm.PropertyChanged += NewData; Hvn2PrePurgeTimeVm.PropertyChanged += NewData; HvnumRetriesVm.PropertyChanged += NewData; @@ -724,12 +720,12 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable RestingTimeCoolplateVm.SName = "Verweilzeit Kühlplatte: "; TargetTemperatureCoolplateVm.SName = "Zieltemperatur Kühlplatte"; - RadialPosLowerWaterJetVm.SName = "Radial Position Unterwasserstrahl: "; - ChuckRpmVm.SName = "Drehzahl: "; HvmaxTestCurrentVm.SName = "HV: Max. Teststrom: "; Hvn2PrePurgeTimeVm.SName = "HV: Vorreinigungszeit: "; HvnumRetriesVm.SName = "HV: Anzahl Wiederholversuche: "; HvpolarityVm.SName = "HV: Polarität (1=Pos, 2=Neg): "; + HvpolarityVm.IMin = 1; + HvpolarityVm.IMax = 2; HvrampTimeVm.SName = "HV: Rampenzeit: "; HvtestFrequencyVm.SName = "HV: Testfrequenz: "; HvTestOkCurrentVm.SName = "HV: Teststrom Teil OK"; @@ -789,8 +785,6 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable receipe.ReceipeObject.ReceipeCoolplate.TargetTemperature = TargetTemperatureCoolplateVm.Value; receipe.ReceipeObject.ReceipeEtcher.NumberRobotPos = (ushort)NumberRobotPositionsVm.Value; - receipe.ReceipeObject.ReceipeEtcher.RadialPosLowerWaterJet = RadialPosLowerWaterJetVm.Value; - receipe.ReceipeObject.ReceipeEtcher.Rpm = ChuckRpmVm.Value; receipe.ReceipeObject.ReceipeEtcher.RobotStepData = new List(EtcherRobotSteps); receipe.ReceipeObject.ReceipeHvTester.MaximumTestCurrent = HvmaxTestCurrentVm.Value; @@ -845,8 +839,6 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable TargetTemperatureCoolplateVm.Value = receipe.ReceipeObject.ReceipeCoolplate.TargetTemperature; NumberRobotPositionsVm.Value = receipe.ReceipeObject.ReceipeEtcher.NumberRobotPos; - RadialPosLowerWaterJetVm.Value = receipe.ReceipeObject.ReceipeEtcher.RadialPosLowerWaterJet; - ChuckRpmVm.Value = receipe.ReceipeObject.ReceipeEtcher.Rpm; EtcherRobotSteps = new(receipe.ReceipeObject.ReceipeEtcher.RobotStepData); HvmaxTestCurrentVm.Value = receipe.ReceipeObject.ReceipeHvTester.MaximumTestCurrent; @@ -910,6 +902,12 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable EtcherRobotSteps[i].PosZ); _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleAlpha", EtcherRobotSteps[i].AngleAlpha); + _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleGamma", + EtcherRobotSteps[i].AngleGamma); + _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rRadialPosLowerWaterJet", + EtcherRobotSteps[i].RadialposUnderwater); + _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rRPM", + EtcherRobotSteps[i].ChuckRpm); _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rMoveSpeed", EtcherRobotSteps[i].MoveSpeed); _adsManager.WriteValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rDelay", @@ -954,14 +952,11 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable _adsManager.WriteValue("GVL_SCADA.stMachine.rTimeIntervalBeamCheck", TimeIntervallBeamCheckVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rRestingTime", RestingTimeHotplateVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHotplate.rTemp", TargetTemperatureHotplateVm.Value); - _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rRestingTime", - RestingTimeCoolplateVm.Value); + _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rRestingTime", RestingTimeCoolplateVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rTemp", TargetTemperatureCoolplateVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.uiNumRobotPos", NumberRobotPositionsVm.Value); - _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rRadialPosLowerWaterJet", - RadialPosLowerWaterJetVm.Value); - _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rChuckRPM", ChuckRpmVm.Value); + _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestVoltage", HvtestVoltageVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rMaxTestCurrent", HvmaxTestCurrentVm.Value); _adsManager.WriteValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rRampTime", HvrampTimeVm.Value); @@ -1009,6 +1004,9 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable EtcherRobotSteps.Last().PosY = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosY")); EtcherRobotSteps.Last().PosZ = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rPosZ")); EtcherRobotSteps.Last().AngleAlpha = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleAlpha")); + EtcherRobotSteps.Last().AngleGamma = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rAngleGamma")); + EtcherRobotSteps.Last().RadialposUnderwater = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rRadialPosLowerWaterJet")); + EtcherRobotSteps.Last().ChuckRpm = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rRPM")); EtcherRobotSteps.Last().MoveSpeed = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rMoveSpeed")); EtcherRobotSteps.Last().Delay = GetFloat(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].rDelay")); EtcherRobotSteps.Last().Medium =GetUShort(_adsManager.ReadValue("GVL_SCADA.stRecipeEtcher.stRobotStepData[" + i + "].uiMedium")); @@ -1046,8 +1044,6 @@ public sealed partial class ReceipePageVM : ObservableValidator, IDisposable RestingTimeCoolplateVm.Value=GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rRestingTime")); TargetTemperatureCoolplateVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeCoolplate.rTemp" )); NumberRobotPositionsVm.Value = GetInt(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.uiNumRobotPos")); - RadialPosLowerWaterJetVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rRadialPosLowerWaterJet")); - ChuckRpmVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeEtcher.rChuckRPM")); HvtestVoltageVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rTestVoltage")); HvmaxTestCurrentVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rMaxTestCurrent")); HvrampTimeVm.Value = GetFloat(_adsManager.ReadValue("GVL_SCADA.stMachine.stMasterRecipeHVTest.rRampTime")); diff --git a/uniper_hmi/UniperHMI/Pages/Views/ReceipePage.xaml b/uniper_hmi/UniperHMI/Pages/Views/ReceipePage.xaml index 47b1aae..4008df9 100644 --- a/uniper_hmi/UniperHMI/Pages/Views/ReceipePage.xaml +++ b/uniper_hmi/UniperHMI/Pages/Views/ReceipePage.xaml @@ -121,14 +121,12 @@ - - - + - + @@ -284,6 +282,13 @@ SelectedItem="{Binding SelectedEtchRobotStep, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" CanUserAddRows="False" FontSize="30"> + + + + + - + + + + + + - + - - + + + + + + +