From 3dea2d19a1d779200710208f7aefbc82ed478e5b Mon Sep 17 00:00:00 2001 From: Roland Drabesch Date: Thu, 26 Jan 2023 11:12:09 +0100 Subject: [PATCH] Add register watch on pui --- .../Genesis/GenesisCore/GenesisMeter.cs | 11 ++- Common/ProductionUiCordonel/FinalTest.xaml.cs | 12 ++- .../Actions/ProductionProcessPasswordFile.cs | 1 + .../Actions/ProductionProcessRegisterWatch.cs | 78 +++++++++++++++++++ .../ProductionUiCordonel.csproj | 1 + 5 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRegisterWatch.cs diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs index affc74e9..ce057f06 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs @@ -933,7 +933,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore StartKeepSession(); return responseRecord; } - + /// + /// Clear password to force new password reading + /// + /// + /// - Initial. + /// + public void ClearPassword() + { + _password = string.Empty; + } /// /// Acquires the password from WEB-API. /// diff --git a/Common/ProductionUiCordonel/FinalTest.xaml.cs b/Common/ProductionUiCordonel/FinalTest.xaml.cs index b2f93347..9b668961 100644 --- a/Common/ProductionUiCordonel/FinalTest.xaml.cs +++ b/Common/ProductionUiCordonel/FinalTest.xaml.cs @@ -422,14 +422,20 @@ namespace ProductionUiCordonel pc.Processes.Add(serialBarcode); //[x] [x] [x] //pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x] + + pc.Processes.Add(new ProductionCheckShippingState()); //[x] [x] [x] + + pc.Processes.Add(new ProductionProcessRegisterWatch()); pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x] + pc.Processes.Add(new ProductionProcessRegisterWatch()); //pc.Processes.Add(new ProductionProcessFinalParametrizationFix()); //[x] [x] [] pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] [] + pc.Processes.Add(new ProductionProcessRegisterWatch()); //if (RadioAddress != 0) //{ @@ -440,15 +446,19 @@ namespace ProductionUiCordonel radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber; }; pc.Processes.Add(radioCheck); //[] [] [] - //} + //} + pc.Processes.Add(new ProductionProcessRegisterWatch()); //pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] [] pc.Processes.Add(new ProductionProcessShippingMode(true, RadioAddress != 0)); //[] [] [] + pc.Processes.Add(new ProductionProcessRegisterWatch()); pc.Processes.Add(new ProductionProcessFinalParametrizationVakoCsd(connectProcess, RadioAddress != 0)); //[x] [x] [] + pc.Processes.Add(new ProductionProcessRegisterWatch()); pc.Processes.Add(new ProductionProcessShippingMode(false, RadioAddress != 0)); //[] [] [] + pc.Processes.Add(new ProductionProcessRegisterWatch()); pc.Processes.Add(new ProductionProcessFullReadOut()); //[x] [x] [x] pc.Processes.Add(new ProductionProcessLogOff()); //[] [] [] diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs index 811c0e3a..d0a975f3 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessPasswordFile.cs @@ -103,6 +103,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions //test the production database password if (ret) { + Meter.ClearPassword(); ret = Meter.Login(); } updateImage(UserControl.CheckNewPassword, ret); diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRegisterWatch.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRegisterWatch.cs new file mode 100644 index 00000000..27d28eab --- /dev/null +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessRegisterWatch.cs @@ -0,0 +1,78 @@ +using ProductionUiCordonel.ProductionProcesses.Enum; +using ProductionUiCordonel.UserControls.FinalTest; +using System; +using System.Linq; +using System.Windows.Controls; +using System.Windows.Threading; +using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; + +namespace ProductionUiCordonel.ProductionProcesses.Actions +{ + public class ProductionProcessRegisterWatch : BaseProductionProcess + { + private UcFullReadOut UserControl; + public ProductionProcessRegisterWatch() + { + name = "Sicherung des Zählerzustandes"; + currentProcessState = ProductionProcessState.Waiting; + } + + public override void InitUserControl() + { + UserControl = new UcFullReadOut(); + } + + public override UserControl GetControl() + { + if (UserControl == null) + { + throw new Exception($"UserControl {GetType()} not Ready"); + } + return UserControl; + } + + public override void ProcessDone() + { + //clear + } + + public override void StartProcess() + { + + UserControl.lblHl.Dispatcher.Invoke(DispatcherPriority.Send, + new Action(() => { UserControl.lblHl.Content = "Read out Registers"; } + )); + + + var total = Meter.GetRegistersDic().Keys.Where(n => n.RegisterName == "TemperatureMeasurePeriod" || n.RegisterName == "PressureMeasurePeriod" || n.RegisterName == "METROLOGYASST_PressureRate").ToList(); + var done = 0; + foreach (var dic in total) + { + var ret = Meter.ReadRegister(dic.GetIdent()); + + if (dic.AppName == "SENSUSRADIO") + { + Meter.WriteLog($"Register Watch: {dic.RegisterName} = { RegisterConverter.ConvertTo(ret)}"); + } + else + { + Meter.WriteLog($"Register Watch: {dic.RegisterName} = { RegisterConverter.ConvertTo(ret)}"); + } + + + } + + + + done += 1; + + + //Meter.StoreCurrentRegisterDic(); + //Meter.Configuration.UseRegisterWatchService = oldConfigEntry; + + currentProcessState = ProductionProcessState.Done; + } + + } + +} diff --git a/Common/ProductionUiCordonel/ProductionUiCordonel.csproj b/Common/ProductionUiCordonel/ProductionUiCordonel.csproj index e466f08d..70335ecc 100644 --- a/Common/ProductionUiCordonel/ProductionUiCordonel.csproj +++ b/Common/ProductionUiCordonel/ProductionUiCordonel.csproj @@ -163,6 +163,7 @@ +