From 48abf20ba91d766fb9ed519094d7eb67295b94be Mon Sep 17 00:00:00 2001 From: Roland Drabesch Date: Wed, 12 Mar 2025 10:23:28 +0100 Subject: [PATCH] Push --- .../Model/PickingModel.cs | 721 +++++++++--------- .../CordonelPreadjustmentUi.csproj | 4 +- .../Processes/Actions/CompletionProcess.cs | 4 +- .../Processes/Actions/OffsetTestProcess.cs | 2 +- .../Genesis/GenesisCore/configuration.json | 156 ++-- ...erRegisters.csproj.CoreCompileInputs.cache | 2 +- Common/LaaPackages | 2 +- .../OrderData/OrderProgrammingParameters.cs | 2 +- .../OrderData/OrderRadioParameter.cs | 2 +- .../ProductionOrderCore/Vako/DbAdapter.cs | 2 +- Common/ProductionUiCordonel/FinalTest.xaml.cs | 14 +- .../Actions/ProductionCheckShippingState.cs | 19 +- .../Actions/ProductionProcessConnect.cs | 2 +- .../Controllers/LUControler.cs | 212 +++++ .../Controllers/MarriageController.cs | 10 +- .../Controllers/PasswordController.cs | 1 + .../Controllers/ProccesStateController.cs | 2 +- .../MeterProcessState.csproj | 44 ++ ...ataAccess.Common.Configuration.Section.xsd | 138 ++++ ...ataAccess.Client.Configuration.Section.xsd | 221 ++++++ Common/Service/MeterProcessState/Web.config | 15 + .../Service/MeterProcessState/packages.config | 12 + .../Ui/DynamicStremingLogAnalyzer/Program.cs | 324 +++++--- .../GenesisToolBox/FrmTempMeter.Designer.cs | 607 +++++++++++++-- Common/Ui/GenesisToolBox/FrmTempMeter.cs | 155 ++++ Common/Ui/GenesisToolBox/FrmTempMeter.resx | 218 +----- .../frmLeagcyTestApp.Designer.cs | 96 +-- Common/Ui/LegacyGenesisControl/ctlBatch.cs | 19 +- 28 files changed, 2116 insertions(+), 890 deletions(-) create mode 100644 Common/Service/MeterProcessState/Controllers/LUControler.cs create mode 100644 Common/Service/MeterProcessState/Oracle.DataAccess.Common.Configuration.Section.xsd create mode 100644 Common/Service/MeterProcessState/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd diff --git a/Common/CordonelAssemblyLine/Model/PickingModel.cs b/Common/CordonelAssemblyLine/Model/PickingModel.cs index 742bb1b7..e7f32ca4 100644 --- a/Common/CordonelAssemblyLine/Model/PickingModel.cs +++ b/Common/CordonelAssemblyLine/Model/PickingModel.cs @@ -890,376 +890,391 @@ namespace CordonelAssemblyLine.Model var converter = new System.Windows.Media.BrushConverter(); while (!token.IsCancellationRequested && !_closeTask) { - switch (_state) + try { - case PickingStateMachine.Init: - SetState("Initialisierung"); - Slot = $"Inaktiv EP {_slotNr}"; - Scanner = $"Geschlossen {_scannerPort}"; - //CheckAllPorts? + switch (_state) + { + case PickingStateMachine.Init: + SetState("Initialisierung"); + Slot = $"Inaktiv EP {_slotNr}"; + Scanner = $"Geschlossen {_scannerPort}"; + //CheckAllPorts? - _state = PickingStateMachine.StartCom; - InitProgressBar(); - break; - - case PickingStateMachine.StartCom: - _orderDetails = null; - _orderOverview = null; - Scanner = $"Öfffne {_scannerPort}"; - //CheckAllPorts? - _barScanner = new BarScanner(_scannerPort, token); - _barScanner.Start(); - - _state = PickingStateMachine.WaitForScanning; - var c = (System.Windows.Media.Brush)converter.ConvertFromString("Aquamarine"); - c.Freeze(); - ResultColor = c; - - lblS01Text = "-"; - lblS02Text = "-"; - lblS03Text = "-"; - lblS04Text = "-"; - lblS05Text = "-"; - lblS06Text = "-"; - lblS07Text = "-"; - lblS08Text = "-"; - lblS09Text = "-"; - lblS10Text = "-"; - lblS11Text = "-"; - lblS01Color = _progressWaiting; - lblS02Color = _progressWaiting; - lblS03Color = _progressWaiting; - lblS04Color = _progressWaiting; - lblS05Color = _progressWaiting; - lblS06Color = _progressWaiting; - lblS07Color = _progressWaiting; - lblS08Color = _progressWaiting; - lblS09Color = _progressWaiting; - lblS10Color = _progressWaiting; - lblS11Color = _progressWaiting; - break; - - case PickingStateMachine.WaitForScanning: - Scanner = $"Offen {_scannerPort}"; - if (State != $"Warte auf Scannereingabe({_scannerPort})") - { - SetState($"Warte auf Scannereingabe({_scannerPort})"); - } - - if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) - { - if (_barScanner.Input == "%Cordonel_SAP_100%" || _barScanner.Input == "%Cordonel_SAP_101%") - { - _state = PickingStateMachine.JustSapProgress; - } - else - { - if (int.TryParse(_barScanner.Input, out _)) - { - _order = _barScanner.Input; - Scanner = $"Geschlossen {_scannerPort}"; - _barScanner = null; - - _state = PickingStateMachine.WaitForDetect; - lblS01Text = _order; - lblS01Color = _progressDone; - lblS02Color = _progressWaiting; - } - } - } - break; - - case PickingStateMachine.JustSapProgress: - using (var batch = new MeterBatch()) - { - using (var tryMeter = new GenesisMeter()) - { - try - { - SetState("Warte auf Pcb"); - Slot = $"Öffne EP {_slotNr}"; - tryMeter.SetupFromConfigFile(_slotNr); - batch.AddMeter(tryMeter); - tryMeter.Logout(); - Log("Try to get PcbID"); - _pcbId = tryMeter.GetPcbId(); - - var hasDetect = !string.IsNullOrEmpty(_pcbId); - - if (hasDetect) - { - SetState($"Pcb gefunden {_pcbId}"); - Log($"New PcbID detected {_pcbId}"); - //barScanner.Input = "%Cordonel_SAP_100%"; - _state = PickingStateMachine.WaitForBuildingMeterReady; - - } - else - { - Slot = $"Keine Konnektivität EP {_slotNr}"; - lblS02Text = Slot; - Log($"No Meter found"); - } - - } - catch (Exception e) - { - Log($"Error occur.{ Environment.NewLine} {e.Message}"); - } - } - } - break; - - case PickingStateMachine.WaitForDetect: - using (var batch = new MeterBatch()) - { - using (var tryMeter = new GenesisMeter()) - { - try - { - SetState("Warte auf Pcb"); - Slot = $"Öffne EP {_slotNr}"; - tryMeter.SetupFromConfigFile(_slotNr); - batch.AddMeter(tryMeter); - tryMeter.Logout(); - Log("Try to get PcbID"); - _pcbId = tryMeter.GetPcbId(); - - var hasDetect = !string.IsNullOrEmpty(_pcbId); - - if (hasDetect) - { - SetState($"Pcb gefunden {_pcbId}"); - Log($"New PcbID detected {_pcbId}"); - _state = PickingStateMachine.GetOrderDetails; - - lblS02Text = _pcbId; - lblS02Color = _progressDone; - lblS03Color = _progressWaiting; - } - else - { - Slot = $"Keine Konnektivität EP {_slotNr}"; - lblS02Text = Slot; - Log($"No Meter found"); - } - } - catch (Exception e) - { - Log($"Error occur.{ Environment.NewLine} {e.Message}"); - } - } - } - break; - - case PickingStateMachine.GetOrderDetails: - SetState($"Lade Auftragsdaten {_order}"); - var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}" + - $"GetOrderOverview?ProductionOrderNumber={_order}" + - $"&CheckPcbId={_pcbId}", out var retCode, 35000); - if (str.Contains("The request is invalid")) - { - Result = "Auftrag nicht gefunden"; - lblS03Text = Result; - lblS03Color = _progressError; - _state = PickingStateMachine.MeterError; + _state = PickingStateMachine.StartCom; + InitProgressBar(); break; - } - if (retCode == 417) - { - _state = PickingStateMachine.MeterError; - Result = "Keine Funkparameter"; - lblS03Text = Result; - UpdateLogText(Result); - lblS03Color = _progressError; - } - else - { - _orderOverview = JsonConvert.DeserializeObject(str); - _orderDetails = _orderOverview.PickingCompareItem; - if (_orderOverview.OrderOverViewCordonel.Count == _orderOverview.OrderOverViewCordonel.AssignedPicking) + case PickingStateMachine.StartCom: + _orderDetails = null; + _orderOverview = null; + Scanner = $"Öfffne {_scannerPort}"; + //CheckAllPorts? + _barScanner = new BarScanner(_scannerPort, token); + _barScanner.Start(); + + _state = PickingStateMachine.WaitForScanning; + var c = (System.Windows.Media.Brush)converter.ConvertFromString("Aquamarine"); + c.Freeze(); + ResultColor = c; + + lblS01Text = "-"; + lblS02Text = "-"; + lblS03Text = "-"; + lblS04Text = "-"; + lblS05Text = "-"; + lblS06Text = "-"; + lblS07Text = "-"; + lblS08Text = "-"; + lblS09Text = "-"; + lblS10Text = "-"; + lblS11Text = "-"; + lblS01Color = _progressWaiting; + lblS02Color = _progressWaiting; + lblS03Color = _progressWaiting; + lblS04Color = _progressWaiting; + lblS05Color = _progressWaiting; + lblS06Color = _progressWaiting; + lblS07Color = _progressWaiting; + lblS08Color = _progressWaiting; + lblS09Color = _progressWaiting; + lblS10Color = _progressWaiting; + lblS11Color = _progressWaiting; + break; + + case PickingStateMachine.WaitForScanning: + Scanner = $"Offen {_scannerPort}"; + if (State != $"Warte auf Scannereingabe({_scannerPort})") { - Result = "Auftrag schon komplett"; - lblS03Text = Result; - lblS03Color = _progressError; - UpdateLogText(Result); - _state = PickingStateMachine.MeterError; - + SetState($"Warte auf Scannereingabe({_scannerPort})"); } - else + + if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) { - SetState($"Auftragsdaten geladen {_order}"); - - var url = ServiceUrls.MeterProcessStateUrl(); - url += $"GetCordonelSkipProcessStates?OrderNumber={_order}&PcbId={_pcbId}"; - var retStr = LocalWebRequest.GetRequestWithError(url, out var tmp); - - _skipProcessSteps = new SkipProcess(); - if (tmp == 200) + if (_barScanner.Input == "%Cordonel_SAP_100%" || _barScanner.Input == "%Cordonel_SAP_101%") { - _skipProcessSteps = JsonConvert.DeserializeObject(retStr); - } - _state = PickingStateMachine.Compare; - - - lblS03Text = $"Nr {_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 } von {_orderOverview.OrderOverViewCordonel.Count}"; - lblS03Color = _progressDone; - lblS04Color = _progressCurrent; - - } - } - break; - - case PickingStateMachine.Compare: - //Compare - SetState($"Vergleiche Auftragsdaten {_order} mit Pcb Eigenschaften"); - - var minDate = DateTime.Now; - - lblS09Color = _progressCurrent; - - - ////Rule from J.Schulz, 9 months for customers with immediately usage here temporary decided on order volume - ////minDate = minDate.AddMonths(_orderOverview.OrderOverViewCordonel.Count < 5 ? -9 : -3); - - //// The production date has to be at least within the last 3 months from now backwards - //minDate = minDate.AddMonths(-3); - //SetState($"Register wurde am {_orderOverview.KitronProductionDate } hergestellt, für diesen Auftrag " + - // $"muss das Register nach dem {minDate} hergestellt worden sein"); - //lblS09Text = $"{_orderOverview.KitronProductionDate}"; - - ////TODO may be useful to introduce SkipRegisterOldness instead of SkipBatteyCheck will be used for oldness of register - //if (_skipProcessSteps == null || !_skipProcessSteps.SkipBatteyCheck) - //{ - // if (_orderOverview.KitronProductionDate <= minDate) - // { - // SetState($"Fehlgeschlagen Register ist zu alt! Bitte QS informieren. Kitron-Produktionsdatum: {_orderOverview.KitronProductionDate }"); - - // _state = PickingStateMachine.MeterError; - // lblS09Color = _progressError; - // var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FFFF00"); - // b.Freeze(); - // ResultColor = b; - // break; - // } - //} - //else - //{ - // SetState($"Produktionsdatum wird nicht überprüft Sonderfreigabe Nr.:{_skipProcessSteps.Id} von {_skipProcessSteps.Name}"); - //} - lblS09Color = _progressDone; - - if (Compare(_orderDetails.CheckAppsIdVersion, _orderDetails.FrequencyIndicator, _orderDetails.MeterSize, _orderDetails.PressurePresent)) - { - _state = PickingStateMachine.MeterDone; - } - else - { - _state = PickingStateMachine.MeterError; - var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000"); - b.Freeze(); - ResultColor = b; - } - break; - - - case PickingStateMachine.MeterError: - _orderDetails = null; - _orderOverview = null; - SetState($"Vergleich abgeschlossen:{State}"); - Result = "Vergleich fehlgeschlagen"; - Thread.Sleep(10000); - _state = PickingStateMachine.StartCom; - break; - - case PickingStateMachine.MeterDone: - SetState("Vergleich abgeschlossen, warte auf manuelle Montagerückmeldung"); - Result = $"Pcb {_pcbId} wurde dem Auftrag {_order} hinzugefügt"; - - Scanner = $"Öffne {_scannerPort}"; - _barScanner = new BarScanner(_scannerPort, token); - HistoryText = $"{HistoryText} {Environment.NewLine}{_order}({_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 }/{ _orderOverview.OrderOverViewCordonel.Count})"; - _barScanner.Start(); - _state = PickingStateMachine.WaitForBuildingMeterReady; - Thread.Sleep(10000); - //CheckAllPorts? - ProgressBar.First(n => n.Name == "Scan Build").State = Ui.ProductionControls.Enums.ImgStatus.InProgress; - break; - - case PickingStateMachine.WaitForBuildingMeterReady: - if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) - { - - if (_barScanner.Input == "%Cordonel_SAP_100%") - { - _barScanner = null; - ProgressBar.First(n => n.Name == "Scan Build").State = Ui.ProductionControls.Enums.ImgStatus.Success; - var url = ServiceUrls.MeterProcessStateUrl(); - url += $"setSapState?PcbID={_pcbId}&code=100&version=1"; - try - { - LocalWebRequest.PostRequestAsync(url); - - } - catch (Exception) - { - // ignored - } - - if (_orderDetails != null && _orderDetails.PressurePresent) - { - _barScanner = new BarScanner(_scannerPort, token); - - _barScanner.Start(); - SetState("Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen"); - _state = PickingStateMachine.WaitForBuildingPressureReady; - ProgressBar.First(n => n.Name == "Scan Build Pressure").State = Ui.ProductionControls.Enums.ImgStatus.InProgress; + _state = PickingStateMachine.JustSapProgress; } else { - SetState("Montage Rückmeldung erhalten, Auftrag Scannen"); - _state = PickingStateMachine.StartCom; - Thread.Sleep(5000); + if (int.TryParse(_barScanner.Input, out _)) + { + _order = _barScanner.Input; + Scanner = $"Geschlossen {_scannerPort}"; + _barScanner = null; + + _state = PickingStateMachine.WaitForDetect; + lblS01Text = _order; + lblS01Color = _progressDone; + lblS02Color = _progressWaiting; + } + } + } + break; + + case PickingStateMachine.JustSapProgress: + using (var batch = new MeterBatch()) + { + using (var tryMeter = new GenesisMeter()) + { + try + { + SetState("Warte auf Pcb"); + Slot = $"Öffne EP {_slotNr}"; + tryMeter.SetupFromConfigFile(_slotNr); + batch.AddMeter(tryMeter); + tryMeter.Logout(); + Log("Try to get PcbID"); + _pcbId = tryMeter.GetPcbId(); + + var hasDetect = !string.IsNullOrEmpty(_pcbId); + + if (hasDetect) + { + SetState($"Pcb gefunden {_pcbId}"); + Log($"New PcbID detected {_pcbId}"); + //barScanner.Input = "%Cordonel_SAP_100%"; + _state = PickingStateMachine.WaitForBuildingMeterReady; + + } + else + { + Slot = $"Keine Konnektivität EP {_slotNr}"; + lblS02Text = Slot; + Log($"No Meter found"); + } + + } + catch (Exception e) + { + Log($"Error occur.{ Environment.NewLine} {e.Message}"); + } + } + } + break; + + case PickingStateMachine.WaitForDetect: + using (var batch = new MeterBatch()) + { + using (var tryMeter = new GenesisMeter()) + { + try + { + SetState("Warte auf Pcb"); + Slot = $"Öffne EP {_slotNr}"; + tryMeter.SetupFromConfigFile(_slotNr); + batch.AddMeter(tryMeter); + tryMeter.Logout(); + Log("Try to get PcbID"); + _pcbId = tryMeter.GetPcbId(); + + var hasDetect = !string.IsNullOrEmpty(_pcbId); + + if (hasDetect) + { + SetState($"Pcb gefunden {_pcbId}"); + Log($"New PcbID detected {_pcbId}"); + _state = PickingStateMachine.GetOrderDetails; + + lblS02Text = _pcbId; + lblS02Color = _progressDone; + lblS03Color = _progressWaiting; + } + else + { + Slot = $"Keine Konnektivität EP {_slotNr}"; + lblS02Text = Slot; + Log($"No Meter found"); + } + } + catch (Exception e) + { + Log($"Error occur.{ Environment.NewLine} {e.Message}"); + } + } + } + break; + + case PickingStateMachine.GetOrderDetails: + SetState($"Lade Auftragsdaten {_order}"); + var str = LocalWebRequest.GetRequestWithError($"{ServiceUrls.GenesisFinalCheckServiceUrl()}" + + $"GetOrderOverview?ProductionOrderNumber={_order}" + + $"&CheckPcbId={_pcbId}", out var retCode, 50000); + Log($"GetOrderOverview {retCode}"); + if (str.Contains("The request is invalid")) + { + + + Result = "Auftrag nicht gefunden"; + lblS03Text = Result; + lblS03Color = _progressError; + _state = PickingStateMachine.MeterError; + break; + } + if (retCode == 417) + { + _state = PickingStateMachine.MeterError; + Result = "Keine Funkparameter"; + lblS03Text = Result; + UpdateLogText(Result); + lblS03Color = _progressError; + } + else + { + _orderOverview = JsonConvert.DeserializeObject(str); + _orderDetails = _orderOverview.PickingCompareItem; + + if (_orderOverview.OrderOverViewCordonel.Count == _orderOverview.OrderOverViewCordonel.AssignedPicking) + { + Result = "Auftrag schon komplett"; + lblS03Text = Result; + lblS03Color = _progressError; + UpdateLogText(Result); + _state = PickingStateMachine.MeterError; + + } + else + { + SetState($"Auftragsdaten geladen {_order}"); + + var url = ServiceUrls.MeterProcessStateUrl(); + url += $"GetCordonelSkipProcessStates?OrderNumber={_order}&PcbId={_pcbId}"; + var retStr = LocalWebRequest.GetRequestWithError(url, out var tmp, 10000); + + _skipProcessSteps = new SkipProcess(); + if (tmp == 200) + { + _skipProcessSteps = JsonConvert.DeserializeObject(retStr); + } + else + { + MessageBox.Show($"Auftragsdaten geladen {_order} Fehler ({tmp})"); + } + _state = PickingStateMachine.Compare; + + + lblS03Text = $"Nr {_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 } von {_orderOverview.OrderOverViewCordonel.Count}"; + lblS03Color = _progressDone; + lblS04Color = _progressCurrent; + + } + } + break; + + case PickingStateMachine.Compare: + //Compare + SetState($"Vergleiche Auftragsdaten {_order} mit Pcb Eigenschaften"); + + var minDate = DateTime.Now; + + lblS09Color = _progressCurrent; + + + ////Rule from J.Schulz, 9 months for customers with immediately usage here temporary decided on order volume + ////minDate = minDate.AddMonths(_orderOverview.OrderOverViewCordonel.Count < 5 ? -9 : -3); + + //// The production date has to be at least within the last 3 months from now backwards + //minDate = minDate.AddMonths(-3); + //SetState($"Register wurde am {_orderOverview.KitronProductionDate } hergestellt, für diesen Auftrag " + + // $"muss das Register nach dem {minDate} hergestellt worden sein"); + //lblS09Text = $"{_orderOverview.KitronProductionDate}"; + + ////TODO may be useful to introduce SkipRegisterOldness instead of SkipBatteyCheck will be used for oldness of register + //if (_skipProcessSteps == null || !_skipProcessSteps.SkipBatteyCheck) + //{ + // if (_orderOverview.KitronProductionDate <= minDate) + // { + // SetState($"Fehlgeschlagen Register ist zu alt! Bitte QS informieren. Kitron-Produktionsdatum: {_orderOverview.KitronProductionDate }"); + + // _state = PickingStateMachine.MeterError; + // lblS09Color = _progressError; + // var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FFFF00"); + // b.Freeze(); + // ResultColor = b; + // break; + // } + //} + //else + //{ + // SetState($"Produktionsdatum wird nicht überprüft Sonderfreigabe Nr.:{_skipProcessSteps.Id} von {_skipProcessSteps.Name}"); + //} + lblS09Color = _progressDone; + + if (Compare(_orderDetails.CheckAppsIdVersion, _orderDetails.FrequencyIndicator, _orderDetails.MeterSize, _orderDetails.PressurePresent)) + { + _state = PickingStateMachine.MeterDone; + } + else + { + _state = PickingStateMachine.MeterError; + var b = (System.Windows.Media.Brush)converter.ConvertFromString("#FF8000"); + b.Freeze(); + ResultColor = b; + } + break; + + + case PickingStateMachine.MeterError: + _orderDetails = null; + _orderOverview = null; + SetState($"Vergleich abgeschlossen:{State}"); + Result = "Vergleich fehlgeschlagen"; + Thread.Sleep(10000); + _state = PickingStateMachine.StartCom; + break; + + case PickingStateMachine.MeterDone: + SetState("Vergleich abgeschlossen, warte auf manuelle Montagerückmeldung"); + Result = $"Pcb {_pcbId} wurde dem Auftrag {_order} hinzugefügt"; + + Scanner = $"Öffne {_scannerPort}"; + _barScanner = new BarScanner(_scannerPort, token); + HistoryText = $"{HistoryText} {Environment.NewLine}{_order}({_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 }/{ _orderOverview.OrderOverViewCordonel.Count})"; + _barScanner.Start(); + _state = PickingStateMachine.WaitForBuildingMeterReady; + Thread.Sleep(10000); + //CheckAllPorts? + ProgressBar.First(n => n.Name == "Scan Build").State = Ui.ProductionControls.Enums.ImgStatus.InProgress; + break; + + case PickingStateMachine.WaitForBuildingMeterReady: + if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) + { + + if (_barScanner.Input == "%Cordonel_SAP_100%") + { + _barScanner = null; + ProgressBar.First(n => n.Name == "Scan Build").State = Ui.ProductionControls.Enums.ImgStatus.Success; + var url = ServiceUrls.MeterProcessStateUrl(); + url += $"setSapState?PcbID={_pcbId}&code=100&version=1"; + try + { + LocalWebRequest.PostRequestAsync(url); + + } + catch (Exception) + { + // ignored + } + + if (_orderDetails != null && _orderDetails.PressurePresent) + { + _barScanner = new BarScanner(_scannerPort, token); + + _barScanner.Start(); + SetState("Montage Rückmeldung erhalten, Montage des Drucksensors bestätigen"); + _state = PickingStateMachine.WaitForBuildingPressureReady; + ProgressBar.First(n => n.Name == "Scan Build Pressure").State = Ui.ProductionControls.Enums.ImgStatus.InProgress; + } + else + { + SetState("Montage Rückmeldung erhalten, Auftrag Scannen"); + _state = PickingStateMachine.StartCom; + Thread.Sleep(5000); + + var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14"); + b.Freeze(); + ResultColor = b; + } + } + } + break; + + case PickingStateMachine.WaitForBuildingPressureReady: + if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) + { + + if (_barScanner.Input == "%Cordonel_SAP_101%") + { + _barScanner = null; + var url = ServiceUrls.MeterProcessStateUrl(); + url += $"setSapState?PcbID={_pcbId}&code=101&version=1"; + try + { + LocalWebRequest.PostRequestAsync(url); + } + catch (Exception) + { + // ignored + } var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14"); b.Freeze(); ResultColor = b; + Thread.Sleep(5000); + SetState("Montage Rückmeldung erhalten, Auftrag Scannen"); + + _state = PickingStateMachine.StartCom; } } - } - break; - - case PickingStateMachine.WaitForBuildingPressureReady: - if (_barScanner != null && !string.IsNullOrEmpty(_barScanner.Input)) - { - - if (_barScanner.Input == "%Cordonel_SAP_101%") - { - _barScanner = null; - var url = ServiceUrls.MeterProcessStateUrl(); - url += $"setSapState?PcbID={_pcbId}&code=101&version=1"; - try - { - LocalWebRequest.PostRequestAsync(url); - } - catch (Exception) - { - // ignored - } - - var b = (System.Windows.Media.Brush)converter.ConvertFromString("#419C14"); - b.Freeze(); - ResultColor = b; - Thread.Sleep(5000); - SetState("Montage Rückmeldung erhalten, Auftrag Scannen"); - - _state = PickingStateMachine.StartCom; - } - } - break; + break; + } + Thread.Sleep(1000); } - Thread.Sleep(1000); + catch (Exception ex) + { + Log(ex.Message); + } + } } @@ -1268,7 +1283,7 @@ namespace CordonelAssemblyLine.Model // ReSharper disable once UnusedParameter.Local private void Log(String v) { - //throw new NotImplementedException(); + } } diff --git a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj index dd244f6b..d763e3ca 100644 --- a/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj +++ b/Common/CordonelPreadjustmentUi/CordonelPreadjustmentUi.csproj @@ -125,9 +125,7 @@ - - true - + ..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll diff --git a/Common/CordonelPreadjustmentUi/Processes/Actions/CompletionProcess.cs b/Common/CordonelPreadjustmentUi/Processes/Actions/CompletionProcess.cs index 758a793e..c0694119 100644 --- a/Common/CordonelPreadjustmentUi/Processes/Actions/CompletionProcess.cs +++ b/Common/CordonelPreadjustmentUi/Processes/Actions/CompletionProcess.cs @@ -172,9 +172,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions { pp.DebugMessage($"{ProcessName} procedure successful", meterctl.Slot, "APP", meterctl.Meter.PcbId); - if (pp.IsAutomaticMode) + if (!pp.IsAutomaticMode) { - //meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow); + meterctl.Meter.SetProcessState(Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts.DisplayCodes.ZeroFlow); } } diff --git a/Common/CordonelPreadjustmentUi/Processes/Actions/OffsetTestProcess.cs b/Common/CordonelPreadjustmentUi/Processes/Actions/OffsetTestProcess.cs index 8011a48e..fa1b2eaa 100644 --- a/Common/CordonelPreadjustmentUi/Processes/Actions/OffsetTestProcess.cs +++ b/Common/CordonelPreadjustmentUi/Processes/Actions/OffsetTestProcess.cs @@ -257,7 +257,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions RegValue = Register.Genesisflow.ZeroOffset3; break; default: - RegValue = Register.Genesisflow.ZeroOffset1; + System.Windows.Forms.MessageBox.Show($"Path number incorrect {Path}"); break; }; if (pp.Setting.NumberOfPaths != 1) diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/configuration.json b/Common/Hardware/WaterMeter/Genesis/GenesisCore/configuration.json index a7d7567c..d0d026f0 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/configuration.json +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/configuration.json @@ -14064,7 +14064,7 @@ "id": 16, "version": { "first": 100, - "last": 541 + "last": 545 }, "registers": { "TxInterval": { @@ -14085,7 +14085,7 @@ "description": "The SensusRF transmission interval in seconds for the BUPs", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 15, @@ -14114,7 +14114,7 @@ "description": "The Open Metering transmission interval in seconds", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 3600, @@ -14143,7 +14143,7 @@ "description": "The Listen After Talk interval as number 'n'. After every 'n' BUPs follows a BUP-LAT", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 3, @@ -14172,7 +14172,7 @@ "description": "The Wake Up interval in seconds 's'. Every 's' seconds will the meter sniff for a WakeUp tone. 's' == 0 means active sending and no sniffing", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 3, @@ -14201,7 +14201,7 @@ "description": "The internal MBus state (Open Metering). A bit oriented value. Do not write if you do not know details", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 7, @@ -14230,7 +14230,7 @@ "description": "A number that shows the radio frequency used. Normally 433 or 868", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 433, @@ -14259,7 +14259,7 @@ "description": "A radio frequency calibration parameter", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14288,7 +14288,7 @@ "description": "A parameter for controling the radio power", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14317,7 +14317,7 @@ "description": "The internal System State of the Radio", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -14346,7 +14346,7 @@ "description": "The radio address used by the meter", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14375,7 +14375,7 @@ "description": "The offset the between meter time and UTC for time correction", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14404,7 +14404,7 @@ "description": "The number of bytes sent during meter lifetime", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14433,7 +14433,7 @@ "description": "The number of bytes received during meter lifetime", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14462,7 +14462,7 @@ "description": "The number of resets the application SensusRfRadio has performed over lifetime", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14491,7 +14491,7 @@ "description": "An internal temporary state (enum) regarding the firmwware update", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14520,7 +14520,7 @@ "description": "The flow value of the leakage (low flow) detection", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 25, @@ -14549,7 +14549,7 @@ "description": "The time in minutes of the leakage (low flow) detection threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 360, @@ -14578,7 +14578,7 @@ "description": "The flow value of the broken pipe (high flow) detection", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 2500, @@ -14607,7 +14607,7 @@ "description": "The time in Minutes of the broken pipe (high flow) detection threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 180, @@ -14636,7 +14636,7 @@ "description": "The pressure value of the maximum (high) pressure alarm", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 160, @@ -14665,7 +14665,7 @@ "description": "The pressure value of the minimum (low) pressure alarm", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 3, @@ -14694,7 +14694,7 @@ "description": "The time in seconds of the maximum (high) pressure alarm threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 600, @@ -14723,7 +14723,7 @@ "description": "The time in seconds of the minimum (low) pressure alarm threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 600, @@ -14752,7 +14752,7 @@ "description": "The period in seconds with which the pressure is measured (fix 60 sec)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 60, @@ -14781,7 +14781,7 @@ "description": "An enum respresenting the unit of pressure (0= no pressure sensor, 1= MPas, 2= PSI, 3= Bar)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14810,7 +14810,7 @@ "description": "The gauge offset of the pressure sensor value in mBar", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -14839,7 +14839,7 @@ "description": "The temperature value of the maximum (high) temperature alarm", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 50, @@ -14868,7 +14868,7 @@ "description": "The temperature value of the minimum (low) temperature alarm", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 2, @@ -14897,7 +14897,7 @@ "description": "The time in Minutes of the maximum (high) temperature alarm threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 600, @@ -14926,7 +14926,7 @@ "description": "The time in Minutes of the minimum (low) temperature alarm threshold", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 600, @@ -14955,7 +14955,7 @@ "description": "The period in seconds with which the temperature is measured (only 60 is valid)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 60, @@ -14984,7 +14984,7 @@ "description": "An enum respresenting the unit of temperature (1= Celsius, 2= Fahrenheit)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -15013,7 +15013,7 @@ "description": "An enumerator defining the currently active PulseWidth (0 ... 8 for non testmode values and 9 ... 15 for testmode)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 4, @@ -15042,7 +15042,7 @@ "description": "A number representing the pulse weight multiplicator 1, 10, 100 or 1000", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -15071,7 +15071,7 @@ "description": "An enum (0 to 3) representing the pulse output mode (0= deactivated, ...)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -15100,7 +15100,7 @@ "description": "A parameter regarding the non existing current loop output", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "infrequentlyupdated" } @@ -15124,7 +15124,7 @@ "description": "A parameter regarding the non existing current loop output", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "infrequentlyupdated" } @@ -15148,7 +15148,7 @@ "description": "A byte value representing a mask of currently active (1) main alarms. These are the flow and genreral alarms", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 207, @@ -15177,7 +15177,7 @@ "description": "A byte value representing a mask of currently active (1) extended alarms. These are the temperature and pressure related alarms", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 60, @@ -15206,7 +15206,7 @@ "description": "A number of days (0 = off) after which alarms are cleared from the alarm byte values when they are no longer active", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 29, @@ -15235,7 +15235,7 @@ "description": "A value in minutes that defines the time the meter will stay in testmode after that mode was started", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15264,7 +15264,7 @@ "description": "The SensusRF encryption key (16 bytes) of the meter", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "static" } @@ -15288,7 +15288,7 @@ "description": "The SensusRF Authentification PINs (3 PINs of 4 byte each) of the meter", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "static" } @@ -15312,7 +15312,7 @@ "description": "The version of the complete Meter firmware package as represented by application FlexNetVersion", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15341,7 +15341,7 @@ "description": "An array of 9 bytes of freely programmable SensusRF customer Text", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "infrequentlyupdated" } @@ -15365,7 +15365,7 @@ "description": "An uint32_t value representing the meter's system DateTime when the radio had last time sent a telegram", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15394,7 +15394,7 @@ "description": "An uint32_t value representing the meter's system DateTime when the radio had detected first the low-battery status", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15423,7 +15423,7 @@ "description": "A copy of the LowBatDateTime time stamp", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15452,7 +15452,7 @@ "description": "A byte value representing the currently active volume unit used by radio", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 19, @@ -15481,7 +15481,7 @@ "description": "A byte value representing additional information regarding the unit derived from the volume unit when used for flow or alternate volume, 0x1x= liter per sec, 0xx1= kiloLiter", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15510,7 +15510,7 @@ "description": "A byte value normaly never changed regarding general behavior of the firmware related to Over The Air updates", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -15539,7 +15539,7 @@ "description": "A complex structure of 84 bytes related to the Tfx mode of the meter respectively the volume channel", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "dynamic" } @@ -15563,7 +15563,7 @@ "description": "A structure of 4 uint16_t values used for the customer DEWA", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "dynamic" } @@ -15587,7 +15587,7 @@ "description": "A 4 byte bit mask representing whether the individual data items are logged in the periodic logging (1) or not (0)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 201335811, @@ -15616,7 +15616,7 @@ "description": "A number in seconds representing the time period for storing data records into the periodic logging file (memory)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 60, @@ -15645,7 +15645,7 @@ "description": "A number derived automatically from the DataLogPeriod that determines averaging periods in mimutes for min and max calculations", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 5, @@ -15674,7 +15674,7 @@ "description": "A 4 byte bit mask representing whether the individual data items are logged in the fixed date logging (1) or not (0)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 201335811, @@ -15703,7 +15703,7 @@ "description": "The day of the month (0 = every day) on which at 00:00 the fixed date logging takes place", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 1, @@ -15732,7 +15732,7 @@ "description": "An uint32_t counter used originally for debugging during development. Meanwhile out of use", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15761,7 +15761,7 @@ "description": "An uint8_t value related to the power level used by the radio when an Irda module is present", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15790,7 +15790,7 @@ "description": "An uint16_t value used for adjusting the antenna impedance", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 4, @@ -15819,7 +15819,7 @@ "description": "An uint16_t value used for adjusting the antenna impedance if an Irda module is present", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 4, @@ -15848,7 +15848,7 @@ "description": "A parameter of type bool that signals the presence of an Irda module. The value is controlled by the meter", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15877,7 +15877,7 @@ "description": "Write 1 to store configuration values to non-volatile storage. Read back for status", "version": { "first": 100, - "last": 541 + "last": 545 }, "statictype": "dynamic" } @@ -15901,7 +15901,7 @@ "description": "The number of seconds since the radio left the production (Set to 0 at the end of the production proccess)", "version": { "first": 100, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -15930,7 +15930,7 @@ "description": "A value (counter) used only during development for release testing", "version": { "first": 412, - "last": 541 + "last": 545 }, "values": { "default": 4320000, @@ -15959,7 +15959,7 @@ "description": "A counter used to control the radio activity which must not exceed certain regulatory limits", "version": { "first": 412, - "last": 541 + "last": 545 }, "values": { "default": 1000, @@ -15988,7 +15988,7 @@ "description": "Storage item for HistoricalErrorLimitCounters Reverse(1, hi) and Leak(0, lo)", "version": { "first": 437, - "last": 541 + "last": 545 }, "values": { "default": 16711935, @@ -16017,7 +16017,7 @@ "description": "Storage item for HistoricalErrorLimitCounters Magnet(3, hi) and Air(2, lo)", "version": { "first": 437, - "last": 541 + "last": 545 }, "values": { "default": 16711935, @@ -16046,7 +16046,7 @@ "description": "Storage item for HistoricalErrorLimitCounters PressureMin(5, hi) and PressureMax(4, lo)", "version": { "first": 437, - "last": 541 + "last": 545 }, "values": { "default": 16711935, @@ -16075,7 +16075,7 @@ "description": "Storage item for HistoricalErrorLimitCounters TempMin(7, hi) and TempMax(6, lo)", "version": { "first": 437, - "last": 541 + "last": 545 }, "values": { "default": 16711935, @@ -16104,7 +16104,7 @@ "description": "int8_t value to add an offset to the measured pressure in 10mBar resolution (for value from -1270 to +1270 mBar for field calibration purposes). -128 is an invalid value", "version": { "first": 483, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -16133,7 +16133,7 @@ "description": "a 6 bytes big complex structure for the Tfx settings of the secondary channel 1 (temperature)", "version": { "first": 494, - "last": 541 + "last": 545 }, "statictype": "infrequentlyupdated" } @@ -16157,7 +16157,7 @@ "description": "a 6 bytes big complex structure for the Tfx settings of the secondary channel 2 (pressure)", "version": { "first": 494, - "last": 541 + "last": 545 }, "statictype": "infrequentlyupdated" } @@ -16181,7 +16181,7 @@ "description": "An unit32_t value used to support/control the MB_MODE3_OMSv4B transmission uinque MCR", "version": { "first": 499, - "last": 541 + "last": 545 }, "values": { "default": 0, @@ -16210,7 +16210,7 @@ "description": "Storage item for HistoricalErrorLimitCounters NoFlowAlarm(7, hi) and Metrology Failure(6, lo)", "version": { "first": 536, - "last": 541 + "last": 545 }, "values": { "default": 16711935, @@ -16239,7 +16239,7 @@ "description": "Storage item for HistoricalErrorLimitCounters Reboot Alarm(7, hi) and reserved(6, lo)", "version": { "first": 536, - "last": 541 + "last": 545 }, "values": { "default": 16711680, diff --git a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache index 8865d283..d110f5fc 100644 --- a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache +++ b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -89102b0142e574de38a9f47d370f3334e5e6c268 +c43c40a030005a8f189e6179faf40a6d42bfef5c diff --git a/Common/LaaPackages b/Common/LaaPackages index fc6d1c60..466fafaf 160000 --- a/Common/LaaPackages +++ b/Common/LaaPackages @@ -1 +1 @@ -Subproject commit fc6d1c60141d1dcce304443fe14f62a94e9dc123 +Subproject commit 466fafaf46e31503975195fc911d6182971fa10b diff --git a/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs b/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs index ac93a0ef..36ee04c5 100644 --- a/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs +++ b/Common/Logic/ProductionOrderCore/OrderData/OrderProgrammingParameters.cs @@ -29,7 +29,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData sb.AppendLine($" SELECT distinct[MapPcbIdToSerialNumber_SerialNumber], mapOrder.CordonelPressureTest_FertigungsAuftragsNr "); sb.AppendLine($" FROM Auftrag.dbo.Cordonel_PressureTest mapOrder "); - sb.AppendLine($" left outer join [Auftrag].[dbo].[MapPcbIdToSerialNumber] map on mapOrder.CordonelPressureTest_PcbId = map.MapPcbIdToSerialNumber_PcbId "); + sb.AppendLine($" left outer join [Auftrag].[dbo].[MapPcbIdToSerialNumber] map on mapOrder.CordonelPressureTest_PcbId = map.MapPcbIdToSerialNumber_PcbId and map.MapPcbIdToSerialNumber_Deleted = 0 "); sb.AppendLine($" left outer join Auftrag.dbo.AuftragPositionSerienNr mapSrn on map.[MapPcbIdToSerialNumber_SerialNumber] = mapSrn.SerienNr and mapSrn.Pruefgangnr = 0 "); sb.AppendLine($" left outer join Auftrag.dbo.AlleAuftragPositionen auftraginfo on auftraginfo.AuftragNr = mapSrn.AuftragNr and auftraginfo.PositionNr = mapSrn.PositionNr "); diff --git a/Common/Logic/ProductionOrderCore/OrderData/OrderRadioParameter.cs b/Common/Logic/ProductionOrderCore/OrderData/OrderRadioParameter.cs index 5c518353..99a76507 100644 --- a/Common/Logic/ProductionOrderCore/OrderData/OrderRadioParameter.cs +++ b/Common/Logic/ProductionOrderCore/OrderData/OrderRadioParameter.cs @@ -208,7 +208,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.OrderData sb.AppendLine($" FROM [Auftrag].[dbo].[MapPcbIdToSerialNumber] pcb "); sb.AppendLine($" left outer join tmpRadioConfig radio on radio.pcbID = pcb.MapPcbIdToSerialNumber_PcbId"); sb.AppendLine($" inner join Genesis_Meter meter on meter.Seriennummer = pcb.MapPcbIdToSerialNumber_SerialNumber"); - sb.AppendLine($" where [MapPcbIdToSerialNumber_PcbId] = '{pcbId}'"); + sb.AppendLine($" where [MapPcbIdToSerialNumber_PcbId] = '{pcbId}' and MapPcbIdToSerialNumber_Deleted = 0 "); var mapData = dataAccess.ExecuteQuery(sb.ToString()); if (mapData.Rows.Count != 1) diff --git a/Common/Logic/ProductionOrderCore/Vako/DbAdapter.cs b/Common/Logic/ProductionOrderCore/Vako/DbAdapter.cs index 531012eb..cb772233 100644 --- a/Common/Logic/ProductionOrderCore/Vako/DbAdapter.cs +++ b/Common/Logic/ProductionOrderCore/Vako/DbAdapter.cs @@ -39,7 +39,7 @@ namespace Xylem.Common.Logic.ProductionOrderCore.Vako VakoIdent = (Int32)mapData.Rows[0]["Identnr"], Type = mapData.Rows[0]["Typ"].ToString(), Dn = (Int32)mapData.Rows[0]["Nennweite"], - Length = (Int32)mapData.Rows[0]["Baulaenge"], + Length = mapData.Rows[0]["Baulaenge"].GetType() == typeof(System.DBNull) ? 0: (Int32)mapData.Rows[0]["Baulaenge"], }; } diff --git a/Common/ProductionUiCordonel/FinalTest.xaml.cs b/Common/ProductionUiCordonel/FinalTest.xaml.cs index ba711ebd..33413dd1 100644 --- a/Common/ProductionUiCordonel/FinalTest.xaml.cs +++ b/Common/ProductionUiCordonel/FinalTest.xaml.cs @@ -428,7 +428,7 @@ namespace ProductionUiCordonel pc.Processes.Add(new ProductionCheckShippingState()); //[x] [x] [x] - pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x] + //pc.Processes.Add(new ProductionProcessPasswordFile()); //[x] [x] [x] //pc.Processes.Add(new ProductionProcessFinalParametrizationFix()); //[x] [x] [] @@ -436,13 +436,13 @@ namespace ProductionUiCordonel pc.Processes.Add(new ProductionProcessShippingMode(true, true)); //[] [] [] - //var radioCheck = new ProductionProcessRadioCheck(); + var radioCheck = new ProductionProcessRadioCheck(); - //orderBarcode.isDone += delegate (object sender, EventArgs e) - //{ - // radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber; - //}; - //pc.Processes.Add(radioCheck); //[] [] [] + orderBarcode.isDone += delegate (object sender, EventArgs e) + { + radioCheck.Ordernumber = ((ProductionProcessCheckOrderNumber)sender).Ordernumber; + }; + pc.Processes.Add(radioCheck); //[] [] [] //pc.Processes.Add(new ProductionProcessSpecialConfig()); //[x] [x] [] diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs index cccd7fd8..d1a0a65f 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionCheckShippingState.cs @@ -51,7 +51,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { if (msgbox) { - + UserControl.MessageBox(msg); } UserControl.lblText.Content = msg; @@ -109,8 +109,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions if (!HyState.HasValue || !HyState.Value) { - setTxt("Zähler nicht erfolgreich geprüft",true,true); - + setTxt("Zähler nicht erfolgreich geprüft", true, true); + currentProcessState = ProductionProcessState.Error; } @@ -125,7 +125,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions var genesisStatus = new GenesisStatus(); // this calculates all life time values - if (!GenesisStatusHandler.BuildLifeTimeInformation(Meter, genesisStatus)) + if (!GenesisStatusHandler.BuildLifeTimeInformation(Meter, genesisStatus)) { setTxt("Batterie nicht lesbar", true, true); @@ -163,7 +163,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions { currentProcessState = ProductionProcessState.Error; setTxt("EMEA Limit überschritten Limit 8% vs {genesisStatus.DrainedBatteryLoadPercent}", true, true); - + Meter.WriteLog("Batterie über 10% entladen"); } @@ -200,16 +200,19 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions } else { - currentProcessState = ProductionProcessState.Error; - + if (res[1] != "3239216" && res[1] != "3239217") + { + currentProcessState = ProductionProcessState.Error; + } setTxt($"FW not correct Meter has {meterFWApp.Version} and should have {uint.Parse(res[9])}", true, true); } } - if (currentProcessState != ProductionProcessState.Error) + + if (currentProcessState != ProductionProcessState.Error) { currentProcessState = ProductionProcessState.Done; return; diff --git a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs index 7a90a713..ff485a52 100644 --- a/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs +++ b/Common/ProductionUiCordonel/ProductionProcesses/Actions/ProductionProcessConnect.cs @@ -114,7 +114,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions return JsonConvert.DeserializeObject>(csdRet); } - catch (Exception) + catch (Exception ec) { return new List { diff --git a/Common/Service/MeterProcessState/Controllers/LUControler.cs b/Common/Service/MeterProcessState/Controllers/LUControler.cs new file mode 100644 index 00000000..6267bc64 --- /dev/null +++ b/Common/Service/MeterProcessState/Controllers/LUControler.cs @@ -0,0 +1,212 @@ +using Oracle.ManagedDataAccess.Client; +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using Xylem.Common.Logic.ServiceCore; + + +namespace Xylem.Common.Service.MeterProcessState.Controllers +{ + [RoutePrefix("api/LuController")] + public class LuController : ApiController + { + public static class GlobalConfig + { + public static Lazy connectionString = new Lazy(() + => + System.Configuration.ConfigurationManager.ConnectionStrings["default"].ConnectionString + ); + + + + + } + + + + [Route("GetNZDaten")] + public async Task GetNZDaten(string Seriennumer = "") + { + try + { + + using (var dataAccess = new SqlDataAccess(GlobalConfig.connectionString.Value)) + { + + StringBuilder query = new StringBuilder(); + query.AppendLine("SELECT TOP 1 * from Verbundzaehler where (Q1_SOLL is NULL) and (SerienNrNebenzaehler > 0 or KundeneigeneSerNrNbZ <> '') and (Herkunft is null or Herkunft <> 'M') and AnlageDatum > getdate() - 7 order by Datum desc "); + + var retDic = new List>(); + var dt = dataAccess.ExecuteQuery(query.ToString()); + foreach (var item in dt.Select()) + { + string strSQLOra; + int lngSerial; + string strSerial; + + double Q1; + double Q2; + double F1; + double F2; + + lngSerial = (int)item["SerienNrNebenzaehler"]; + strSerial = item["KundeneigeneSerNrNbZ"].ToString().Trim(); + + if (strSerial == "" && lngSerial > 0) + { + strSQLOra = "SELECT * FROM PRIMA_RO.DT01_LAATZEN WHERE ZAEHLERNUMMER ='" + lngSerial.ToString("00000000") + "'"; + } + else + { + if (strSerial != "") + { + //kundeneigenen NZ SerienNr ist bekannt + strSQLOra = "SELECT * FROM PRIMA_RO.DT01_LAATZEN WHERE ZAEHLERNUMMER='" + strSerial.Replace(" ", "") + "' or ZAEHLERNUMMER='" + strSerial + "'"; + } + else + { + return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return "ERROR 1#"; })); + // ' weder kundeneigenen SerienNr noch numerische NZ SerienNr bekannt + + } + } + + // create connection + OracleConnection con = new OracleConnection(); + + // create connection string using builder + OracleConnectionStringBuilder ocsb = new OracleConnectionStringBuilder(); + ocsb.Password = "senspi2012"; + ocsb.UserID = "prima_ro"; + ocsb.DataSource = "//SLUORADB:1521/DT01"; + + // connect + con.ConnectionString = ocsb.ConnectionString; + con.Open(); + + + OracleCommand command = con.CreateCommand(); + + command.CommandText = strSQLOra; + + OracleDataReader reader = command.ExecuteReader(); + while (reader.Read()) + { + Q1 = ((double)reader["Q1_SOLL"]) / 1000; + Q2 = ((double)reader["Q2_SOLL"]) / 1000; + F1 = (double)reader["FEHLER_Q1"]; + F2 = (double)reader["FEHLER_Q2"]; + + + } + + + + + } + + return Request.CreateResponse(HttpStatusCode.OK, await Task.Run(() => { return "store"; })); + + } + + + } + catch (Exception ex) + { + return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ToString() + "
" + ex.InnerException.ToString()); + } + } + + + + //connect + + + + + + //If Not rs.EOF Then + + + + + // If lngSerial = 0 Then + // StatusBar1.SimpleText = "LU: " & lngCount & "/" & ProgressBar1.Max & " " & strSerial & " " & Q1 & "=" & F1 & ", " & Q2 & " =" & F2 & " " & rsSQL("AnlageDatum") + // Else + // StatusBar1.SimpleText = "LU: " & lngCount & "/" & ProgressBar1.Max & " " & Format(lngSerial, "00000000") & " " & Q1 & "=" & F1 & ", " & Q2 & " =" & F2 & " " & rsSQL("AnlageDatum") + // End If + + + // 'Debug.Print Format(lngSerial, "00000000") & " " & Q1 & "=" & F1 & ", " & Q2 & " =" & F2 + // DoEvents + + // If Not rsSQL Is Nothing Then + + + // ' Reihenfolge wieder zurückgesetzt Q1 < Q2 2018-04-19 + // If Q1 Tauschen + // rsSQL("Q1_SOLL") = Q2 + // rsSQL("FEHLER_Q1") = F2 + + + // rsSQL("Q2_SOLL") = Q1 + // rsSQL("FEHLER_Q2") = F1 + // End If + + + // Debug.Print rs("ZAEHLERNUMMER") + + // If Val(rsSQL("SerienNrNebenzaehlerLU") &"") = 0 And lngSerial > 0 Then + // rsSQL("SerienNrNebenzaehlerLU") = lngSerial + // End If + + + // rsSQL("Herkunft") = "L" + // rsSQL("ErgaenzungDatum") = Now + + + // rsSQL.Update + // Debug.Print lngCount &"/" & ProgressBar1.Max & " OK " & lngSerial & " / " & strSerial + // End If + //Else + + + + // StatusBar1.SimpleText = lngCount & "/" & ProgressBar1.Max & " unbekannte SNr: " & lngSerial & " / " & strSerial + // Debug.Print StatusBar1.SimpleText & " " & Now + // 'Debug.Print lngCount & "/" & ProgressBar1.Max & " unbekannt " & Format(lngSerial, "00000000") & " / " & strSerial + // DoEvents + + + // 'rsSQL("Q1_SOLL") = 0 + // 'rsSQL("Herkunft") = "u" + // 'rsSQL("Info") = "unbekannt in LU" + // 'rsSQL.Update + + + //End If + //Exit Sub + //Errorhandler: + // Dim errnum As Long + // Dim errdesc As String + // errnum = Err.Number + // errdesc = Err.Description + // PrintStatus "Fehler " & errnum & " in Ergaenze(): " & errdesc & " SQL=" & strSQL + //End Sub + + + } +} \ No newline at end of file diff --git a/Common/Service/MeterProcessState/Controllers/MarriageController.cs b/Common/Service/MeterProcessState/Controllers/MarriageController.cs index 92caf781..05ed9267 100644 --- a/Common/Service/MeterProcessState/Controllers/MarriageController.cs +++ b/Common/Service/MeterProcessState/Controllers/MarriageController.cs @@ -488,10 +488,12 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers sb.AppendLine($" where CordonelPressureTest_PcbId = @PcbId and CordonelPressureTest_FertigungsAuftragsNr = @PcbIsPartOfOrder "); sb.AppendLine($" and CordonelPressureTest_Valid = 1 and CordonelPressureTest_IsDeleted = 0 "); sb.AppendLine($" "); - sb.AppendLine($" select top 1 @LastPressureTest = [Pruefgang] from [Druckpruefung] "); - sb.AppendLine($" where [FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder "); - sb.AppendLine($" and [Dicht] = 1 "); - sb.AppendLine($" order by [Pruefgang] desc "); + sb.AppendLine($" select top 1 @LastPressureTest = case when(IstStichprobe = 0 or(IstStichprobe = 1 and IstDicht = 1)) then 1 else null end "); + sb.AppendLine($" from Stichproben left outer join [Druckpruefung] on[FabNr] = PcbId "); + sb.AppendLine($" where[FabNr] = @PcbId and [FertigungsauftragNr] = @PcbIsPartOfOrder "); + sb.AppendLine($" order by [id] desc "); + + diff --git a/Common/Service/MeterProcessState/Controllers/PasswordController.cs b/Common/Service/MeterProcessState/Controllers/PasswordController.cs index 4aaf905a..8e6ef809 100644 --- a/Common/Service/MeterProcessState/Controllers/PasswordController.cs +++ b/Common/Service/MeterProcessState/Controllers/PasswordController.cs @@ -681,6 +681,7 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers [Route("GetRadioKey")] public async Task GetRadioKey(String PcbId) { + throw new Exception("Use finalcheck get encyprion key"); try { diff --git a/Common/Service/MeterProcessState/Controllers/ProccesStateController.cs b/Common/Service/MeterProcessState/Controllers/ProccesStateController.cs index 2b083ac0..d146e056 100644 --- a/Common/Service/MeterProcessState/Controllers/ProccesStateController.cs +++ b/Common/Service/MeterProcessState/Controllers/ProccesStateController.cs @@ -128,7 +128,7 @@ namespace Service.MeterProcessState.Controllers var dt = dataacces.ExecuteQuery(query.ToString()); - return true; + return "1"; // return ((int)dt.Rows[0]["PressuretestNeeded"]).ToString(); diff --git a/Common/Service/MeterProcessState/MeterProcessState.csproj b/Common/Service/MeterProcessState/MeterProcessState.csproj index 6adf772a..b5bf3fbf 100644 --- a/Common/Service/MeterProcessState/MeterProcessState.csproj +++ b/Common/Service/MeterProcessState/MeterProcessState.csproj @@ -50,6 +50,9 @@ 7
+ + ..\..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + ..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\lib\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll @@ -60,17 +63,51 @@ ..\..\packages\NLog.5.2.2\lib\net46\NLog.dll + + ..\..\packages\Oracle.ManagedDataAccess.23.7.0\lib\net472\Oracle.ManagedDataAccess.dll + ..\..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll + + ..\..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + ..\..\packages\System.Data.SqlClient.4.8.5\lib\net461\System.Data.SqlClient.dll + + ..\..\packages\System.Diagnostics.DiagnosticSource.6.0.1\lib\net461\System.Diagnostics.DiagnosticSource.dll + + + ..\..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll + + + ..\..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll + + + ..\..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll + + + ..\..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + @@ -228,6 +265,7 @@ + @@ -328,6 +366,12 @@ Always + + Designer + + + Designer + diff --git a/Common/Service/MeterProcessState/Oracle.DataAccess.Common.Configuration.Section.xsd b/Common/Service/MeterProcessState/Oracle.DataAccess.Common.Configuration.Section.xsd new file mode 100644 index 00000000..eee2d5cf --- /dev/null +++ b/Common/Service/MeterProcessState/Oracle.DataAccess.Common.Configuration.Section.xsd @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Common/Service/MeterProcessState/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd b/Common/Service/MeterProcessState/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd new file mode 100644 index 00000000..70935a1f --- /dev/null +++ b/Common/Service/MeterProcessState/Oracle.ManagedDataAccess.Client.Configuration.Section.xsd @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Common/Service/MeterProcessState/Web.config b/Common/Service/MeterProcessState/Web.config index 7fec0145..6109def6 100644 --- a/Common/Service/MeterProcessState/Web.config +++ b/Common/Service/MeterProcessState/Web.config @@ -7,6 +7,7 @@
+
@@ -88,6 +89,14 @@ + + + + + + + + @@ -102,4 +111,10 @@ + + + + + + \ No newline at end of file diff --git a/Common/Service/MeterProcessState/packages.config b/Common/Service/MeterProcessState/packages.config index c00b8287..f0f911aa 100644 --- a/Common/Service/MeterProcessState/packages.config +++ b/Common/Service/MeterProcessState/packages.config @@ -19,6 +19,7 @@ + @@ -35,11 +36,22 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Common/Ui/DynamicStremingLogAnalyzer/Program.cs b/Common/Ui/DynamicStremingLogAnalyzer/Program.cs index a3905b19..7e7fbcde 100644 --- a/Common/Ui/DynamicStremingLogAnalyzer/Program.cs +++ b/Common/Ui/DynamicStremingLogAnalyzer/Program.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; +using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords; using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.StreamingProtocol; namespace DynamicStremingLogAnalyzer @@ -28,14 +30,100 @@ namespace DynamicStremingLogAnalyzer public Dictionary> LedFiles; public Dictionary> LogFiles; - public List TestRuns = new List(); + public List OffsetRuns = new List(); + + // public List AmpRuns = new List(); + public List CompRuns = new List(); + + //public List TestRuns = new List(); //public List PathOffsets { get; set; } //public bool MeterValid { get; set; } = true; } - public class TestRun + + + public class AmpRun + { + public DateTime? Start; + public DateTime? End; + + public int? FirstHitPercent1; + public int? FirstHitPercent2; + public int? FirstHitPercent3; + + public List Chnl1 = new List(); + public List Chnl2 = new List(); + public List Chnl3 = new List(); + + public int TotalLineCount { get; internal set; } + + public void Calc() + { + + } + + } + public enum Stage + { + Login, + FirstFlush, + Preparation, + Amp, + SecondFlush, + Temp, + Offset, + } + public class CompRun + { + public DateTime? Start;// Login sequence Login sequence successful + public DateTime? Flush;//First Flush procedure started + public DateTime? Preparation;//Preparation procedure started + public DateTime? StartAmp;//Amplitude Test procedure started + public DateTime? FlushSecond;//Amplitude Test sequence successful at all + public DateTime? StartTemp;//Temperature Calibration procedure started + public DateTime? StartOffset;//Temperature Calibration sequence successful at all + public DateTime? End; //Offset Test sequence Offset Test sequence successful at all ; + + + + + public List Chnl1 = new List(); + public List Chnl2 = new List(); + public List Chnl3 = new List(); + + public int TotalLineCount { get; internal set; } + + public List> MatchData() + { + var ret = new List>(); + var matchList = new List(); + matchList.AddRange(Chnl1); + matchList.AddRange(Chnl2); + matchList.AddRange(Chnl3); + foreach (var item in matchList) + { + var matchtime = item.DecodedTime; + var currentStage = Stage.Login; + if (matchtime >= Start && matchtime < Flush) { currentStage = Stage.Login; } + if (matchtime >= Flush && matchtime < Preparation) { currentStage = Stage.FirstFlush; } + if (matchtime >= Preparation && matchtime < StartAmp) { currentStage = Stage.Preparation; } + if (matchtime >= StartAmp && matchtime < FlushSecond) { currentStage = Stage.Amp; } + if (matchtime >= FlushSecond && matchtime < StartTemp) { currentStage = Stage.SecondFlush; } + if (matchtime >= StartTemp && matchtime < StartOffset) { currentStage = Stage.Temp; } + if (matchtime >= StartOffset && matchtime < End) { currentStage = Stage.Offset; } + + + + ret.Add(new Tuple(matchtime, currentStage, item)); + } + return ret; + } + + } + + public class OffsetRun { public DateTime? Start; public DateTime? End; @@ -44,6 +132,10 @@ namespace DynamicStremingLogAnalyzer public int? Offset2; public int? Offset3; + public List Chnl1 = new List(); + public List Chnl2 = new List(); + public List Chnl3 = new List(); + public List DeltaTimeOfFlightS1 = new List(); public List DeltaTimeOfFlightS2 = new List(); public List DeltaTimeOfFlightS3 = new List(); @@ -76,7 +168,7 @@ namespace DynamicStremingLogAnalyzer DateTimeOffset timestamp; var meters = new List(); - foreach (var item in Directory.GetFiles("\\\\sla12buma\\cordonelds$\\LAA-D-70MYB62\\2023-06-05\\Pruef2000\\", "*_PreAdjustment.log", SearchOption.AllDirectories)) + foreach (var item in Directory.GetFiles("\\\\sla12file\\Auftrag\\p2016nez\\GenesisLog2\\2025-02-17\\Pruef2000\\", "*_PreAdjustment.log", SearchOption.AllDirectories)) { @@ -103,102 +195,76 @@ namespace DynamicStremingLogAnalyzer } } + + + foreach (var meter in meters) { foreach (var logfile in meter.LogFiles) { - var r = new TestRun(); + var c = new CompRun(); foreach (var logline in logfile.Value) { - - if (logline.Contains("APP Offset Test procedure started ")) + //Start logging at Meter 1 (244230137) + if (logline.Contains("Login sequence Login sequence successful")) { - if (r.End.HasValue) + if (c.End.HasValue) { - meter.TestRuns.Add(r); + meter.CompRuns.Add(c); } - - r = new TestRun(); - + c = new CompRun(); DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); - r.Start = tmp; - + c.Start = tmp; } - - if (r.Start.HasValue) + if (c.Start.HasValue && logline.Contains("First Flush procedure started")) { - if (logline.Contains("cRecords.Count=")) - { - var starPos = logline.LastIndexOf("cRecords.Count=") + "cRecords.Count=".Length; - var endPos = logline.Length; - if (int.TryParse(logline.Substring(starPos, endPos- starPos -1), out var tmp)) - { - r.TotalLineCount = tmp; - } - - } - if (logline.Contains("to 'Zero flow offset Path 1'-register at Meter")) - { - var starPos = logline.LastIndexOf(" CC Writing ") + " CC Writing ".Length; - var endPos = logline.IndexOf("to 'Zero flow offset Path 1'-register at Meter"); - var lineOffset = logline.Substring(starPos, endPos - starPos).Trim(); - if (int.TryParse(lineOffset, out int tmpOffset1)) - { - r.Offset1 = tmpOffset1; - } - else - { - r.Offset1 = 99; - } - - - - } - - if (logline.Contains("to 'Zero flow offset Path 2'-register at Meter")) - { - var starPos = logline.LastIndexOf(" CC Writing ") + " CC Writing ".Length; - var endPos = logline.IndexOf("to 'Zero flow offset Path 2'-register at Meter"); - var lineOffset = logline.Substring(starPos, endPos - starPos).Trim(); - if (int.TryParse(lineOffset, out int tmpOffset2)) - { - r.Offset2 = tmpOffset2; - } - else - { - r.Offset2 = 99; - } - - } - - if (logline.Contains("to 'Zero flow offset Path 3'-register at Meter")) - { - var starPos = logline.LastIndexOf(" CC Writing ") + " CC Writing ".Length; - var endPos = logline.IndexOf("to 'Zero flow offset Path 3'-register at Meter"); - var lineOffset = logline.Substring(starPos, endPos - starPos).Trim(); - if (int.TryParse(lineOffset, out int tmpOffset3)) - { - r.Offset3 = tmpOffset3; - } - else - { - r.Offset3 = 99; - } - } - if (logline.Contains("Offset Test sequence Offset Test sequence successful at all")) - { - - DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); - r.End = tmp; - - } + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.Flush = tmp; } + if (c.Flush.HasValue && logline.Contains("Preparation procedure started")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.Preparation = tmp; + + } + if (c.Preparation.HasValue && logline.Contains("Amplitude Test procedure started")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.StartAmp = tmp; + + } + if (c.StartAmp.HasValue && logline.Contains("Amplitude Test sequence successful at all")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.FlushSecond = tmp; + + } + + if (c.FlushSecond.HasValue && logline.Contains("Temperature Calibration procedure started")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.StartTemp = tmp; + + } + if (c.StartTemp.HasValue && logline.Contains("Temperature Calibration sequence successful at all")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.StartOffset = tmp; + + } + if (c.StartOffset.HasValue && logline.Contains("Offset Test sequence Offset Test sequence successful at all")) + { + DateTime.TryParse(logline.Substring(0, "2023-06-05 17:50:38.3184".Length), out DateTime tmp); + c.End = tmp; + } + + } - if (r.End.HasValue) + if (c.End.HasValue) { - meter.TestRuns.Add(r); + meter.CompRuns.Add(c); } @@ -216,24 +282,25 @@ namespace DynamicStremingLogAnalyzer if (DateTimeOffset.TryParse(line.Split('|')[0], out timestamp)) { - if (meter.TestRuns.Any(run => run.Start <= timestamp && run.End >= timestamp)) + if (meter.CompRuns.Any(run => run.Start <= timestamp && run.End >= timestamp)) { - var currentRun = meter.TestRuns.First(run => run.Start <= timestamp && run.End >= timestamp); + var currentRun = meter.CompRuns.First(run => run.Start <= timestamp && run.End >= timestamp); if (StreamingDecode.DecodeMsg(line.Split('|')[1].Trim())) { - var c = StreamingDecode.DataCalib; - if (c.IsValid) + var c = ((CalibrationRecord)StreamingDecode.DataCalib?.Clone()); + if (StreamingDecode.DataCalib != null && c.IsValid) { + c.DecodedTime = timestamp; switch (c.Channel) { case 1: - currentRun.DeltaTimeOfFlightS1.Add(c.DeltaTimeOfFlightS); + currentRun.Chnl1.Add(c); break; case 2: - currentRun.DeltaTimeOfFlightS2.Add(c.DeltaTimeOfFlightS); + currentRun.Chnl2.Add(c); break; case 3: - currentRun.DeltaTimeOfFlightS3.Add(c.DeltaTimeOfFlightS); + currentRun.Chnl3.Add(c); break; @@ -255,21 +322,84 @@ namespace DynamicStremingLogAnalyzer } } - + string sep = ";"; + var sb = new StringBuilder(); foreach (var meter in meters) { - foreach (var testrun in meter.TestRuns) + foreach (var testrun in meter.CompRuns) { - testrun.Calc(); - Console.WriteLine($"{meter.SerialNumber} ; 1; {testrun.Offset1}; {testrun.CalcOffset1}; {testrun.TotalLineCount / 3}; {testrun.DeltaTimeOfFlightS1.Count} "); - Console.WriteLine($"{meter.SerialNumber} ; 2; {testrun.Offset2}; {testrun.CalcOffset2}; {testrun.TotalLineCount / 3}; {testrun.DeltaTimeOfFlightS2.Count} "); - Console.WriteLine($"{meter.SerialNumber} ; 3; {testrun.Offset3}; {testrun.CalcOffset3}; {testrun.TotalLineCount / 3}; {testrun.DeltaTimeOfFlightS3.Count} "); + var results = testrun.MatchData(); + sb.AppendLine(meter.SerialNumber); + + sb.Append("Time").Append(sep); + sb.Append("Stage").Append(sep); + sb.Append("Channel").Append(sep); + sb.Append("Validation").Append(sep); + sb.Append("TotalTimeOfFlightS").Append(sep); + sb.Append("DeltaTimeOfFlightS").Append(sep); + sb.Append("VolumeScaleRawPerMl").Append(sep); + sb.Append("VolumeFactorRawToQm").Append(sep); + sb.Append("DeltaVolumeRaw").Append(sep); + sb.Append("DeltaVolumeQm").Append(sep); + sb.Append("AccuVolumeRaw").Append(sep); + sb.Append("VolumeCm").Append(sep); + sb.Append("OverflowVolumeCm").Append(sep); + sb.Append("SampleIntervalS").Append(sep); + sb.Append("AmplitudeUpV").Append(sep); + sb.Append("AmplitudeDownV").Append(sep); + sb.Append("PulseWidthRatioUp").Append(sep); + sb.Append("PulseWidthRatioDown").Append(sep); + sb.Append("TemperatureRaw").Append(sep); + sb.Append("TemperaturePowFactor").Append(sep); + sb.Append("TemperatureDegC").Append(sep); + sb.Append("TimeS").Append(sep); + sb.Append("OverflowTimeS").Append(sep); + sb.Append("Crc").Append(sep); + sb.Append("IsValid").Append(sep); + + + foreach (var logI in results) + { + var h = logI.Item3; + sb.Append(logI.Item1).Append(sep); + sb.Append(logI.Item2).Append(sep); + sb.Append(h.Channel).Append(sep); + sb.Append(h.Validation).Append(sep); + sb.Append(h.TotalTimeOfFlightS).Append(sep); + sb.Append(h.DeltaTimeOfFlightS).Append(sep); + sb.Append(h.VolumeScaleRawPerMl).Append(sep); + sb.Append(h.VolumeFactorRawToQm).Append(sep); + sb.Append(h.DeltaVolumeRaw).Append(sep); + sb.Append(h.DeltaVolumeQm).Append(sep); + sb.Append(h.AccuVolumeRaw).Append(sep); + sb.Append(h.VolumeCm).Append(sep); + sb.Append(h.OverflowVolumeCm).Append(sep); + sb.Append(h.SampleIntervalS).Append(sep); + sb.Append(h.AmplitudeUpV).Append(sep); + sb.Append(h.AmplitudeDownV).Append(sep); + sb.Append(h.PulseWidthRatioUp).Append(sep); + sb.Append(h.PulseWidthRatioDown).Append(sep); + sb.Append(h.TemperatureRaw).Append(sep); + sb.Append(h.TemperaturePowFactor).Append(sep); + sb.Append(h.TemperatureDegC).Append(sep); + sb.Append(h.TimeS).Append(sep); + sb.Append(h.OverflowTimeS).Append(sep); + sb.Append(h.Crc).Append(sep); + sb.Append(h.IsValid).Append(sep); + sb.AppendLine(""); + } + + + + + } - + File.AppendAllLines($"{meter.SerialNumber}_offset.CSV", new[] { sb.ToString() }); + sb = new StringBuilder(); } - + Console.ReadLine(); diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs b/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs index 802ca8a1..13bd588e 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.Designer.cs @@ -70,14 +70,52 @@ namespace Xylem.Common.Ui.GenesisToolBox this.label2 = new System.Windows.Forms.Label(); this.GMHPort = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.label10 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.txtInterpolTofs = new System.Windows.Forms.TextBox(); + this.txtInterPolPcbId = new System.Windows.Forms.TextBox(); + this.button2 = new System.Windows.Forms.Button(); + this.ReCalibration = new System.Windows.Forms.TabPage(); + this.lblFlowDisplay = new System.Windows.Forms.Label(); + this.lblFlowChnl1 = new System.Windows.Forms.Label(); + this.lblFlowChnl2 = new System.Windows.Forms.Label(); + this.lblFlowChnl3 = new System.Windows.Forms.Label(); + this.label23 = new System.Windows.Forms.Label(); + this.label22 = new System.Windows.Forms.Label(); + this.btnStopM = new System.Windows.Forms.Button(); + this.btnRefeshM = new System.Windows.Forms.Button(); + this.btnStartM = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.label19 = new System.Windows.Forms.Label(); + this.label20 = new System.Windows.Forms.Label(); + this.label21 = new System.Windows.Forms.Label(); + this.nudCal3 = new System.Windows.Forms.NumericUpDown(); + this.nudCal2 = new System.Windows.Forms.NumericUpDown(); + this.nudCal1 = new System.Windows.Forms.NumericUpDown(); + this.label13 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.nudZeroOffset3 = new System.Windows.Forms.NumericUpDown(); + this.nudZeroOffset2 = new System.Windows.Forms.NumericUpDown(); + this.nudZeroOffset1 = new System.Windows.Forms.NumericUpDown(); + this.brnRead = new System.Windows.Forms.Button(); + this.label18 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.btnWirte = new System.Windows.Forms.Button(); + this.nudSampleRate = new System.Windows.Forms.NumericUpDown(); + this.lblTof3 = new System.Windows.Forms.Label(); + this.lblTof1 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.lblTof2 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.BtnWritetemp = new System.Windows.Forms.Button(); + this.nudTemp = new System.Windows.Forms.NumericUpDown(); this.timer3 = new System.Windows.Forms.Timer(this.components); this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); - this.tabPage4 = new System.Windows.Forms.TabPage(); - this.button2 = new System.Windows.Forms.Button(); - this.txtInterPolPcbId = new System.Windows.Forms.TextBox(); - this.txtInterpolTofs = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); + this.label24 = new System.Windows.Forms.Label(); + this.label25 = new System.Windows.Forms.Label(); this.multiflancshCalibration.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -86,6 +124,15 @@ namespace Xylem.Common.Ui.GenesisToolBox this.AutomaticCalibrationTab.SuspendLayout(); this.automaticControlsPanel.SuspendLayout(); this.tabPage4.SuspendLayout(); + this.ReCalibration.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudSampleRate)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudTemp)).BeginInit(); this.SuspendLayout(); // // timer1 @@ -104,6 +151,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.multiflancshCalibration.Controls.Add(this.tabPage3); this.multiflancshCalibration.Controls.Add(this.AutomaticCalibrationTab); this.multiflancshCalibration.Controls.Add(this.tabPage4); + this.multiflancshCalibration.Controls.Add(this.ReCalibration); this.multiflancshCalibration.Dock = System.Windows.Forms.DockStyle.Fill; this.multiflancshCalibration.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.multiflancshCalibration.Location = new System.Drawing.Point(0, 24); @@ -111,7 +159,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.multiflancshCalibration.Name = "multiflancshCalibration"; this.multiflancshCalibration.Padding = new System.Drawing.Point(0, 0); this.multiflancshCalibration.SelectedIndex = 0; - this.multiflancshCalibration.Size = new System.Drawing.Size(1225, 676); + this.multiflancshCalibration.Size = new System.Drawing.Size(1155, 663); this.multiflancshCalibration.TabIndex = 55; this.multiflancshCalibration.Tag = ""; // @@ -122,7 +170,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.tabPage1.Location = new System.Drawing.Point(4, 25); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1217, 647); + this.tabPage1.Size = new System.Drawing.Size(1147, 634); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Current entrys in LUT"; this.tabPage1.UseVisualStyleBackColor = true; @@ -154,7 +202,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.tabPage2.Location = new System.Drawing.Point(4, 25); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1217, 647); + this.tabPage2.Size = new System.Drawing.Size(1147, 634); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Manual check temp"; this.tabPage2.UseVisualStyleBackColor = true; @@ -217,7 +265,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.tabPage3.Location = new System.Drawing.Point(4, 25); this.tabPage3.Name = "tabPage3"; this.tabPage3.Padding = new System.Windows.Forms.Padding(3); - this.tabPage3.Size = new System.Drawing.Size(1217, 647); + this.tabPage3.Size = new System.Drawing.Size(1147, 634); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Manual add LUT"; this.tabPage3.UseVisualStyleBackColor = true; @@ -356,7 +404,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.AutomaticCalibrationTab.Location = new System.Drawing.Point(4, 25); this.AutomaticCalibrationTab.Margin = new System.Windows.Forms.Padding(0); this.AutomaticCalibrationTab.Name = "AutomaticCalibrationTab"; - this.AutomaticCalibrationTab.Size = new System.Drawing.Size(1217, 647); + this.AutomaticCalibrationTab.Size = new System.Drawing.Size(1147, 634); this.AutomaticCalibrationTab.TabIndex = 3; this.AutomaticCalibrationTab.Text = "Automatic Calibration"; // @@ -367,7 +415,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.automaticContentBox.Font = new System.Drawing.Font("Consolas", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.automaticContentBox.Location = new System.Drawing.Point(331, 0); this.automaticContentBox.Name = "automaticContentBox"; - this.automaticContentBox.Size = new System.Drawing.Size(886, 647); + this.automaticContentBox.Size = new System.Drawing.Size(816, 634); this.automaticContentBox.TabIndex = 2; this.automaticContentBox.Text = ""; // @@ -377,7 +425,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.autometicControlsSplitter.Cursor = System.Windows.Forms.Cursors.VSplit; this.autometicControlsSplitter.Location = new System.Drawing.Point(328, 0); this.autometicControlsSplitter.Name = "autometicControlsSplitter"; - this.autometicControlsSplitter.Size = new System.Drawing.Size(3, 647); + this.autometicControlsSplitter.Size = new System.Drawing.Size(3, 634); this.autometicControlsSplitter.TabIndex = 1; this.autometicControlsSplitter.TabStop = false; // @@ -399,7 +447,7 @@ namespace Xylem.Common.Ui.GenesisToolBox this.automaticControlsPanel.Location = new System.Drawing.Point(0, 0); this.automaticControlsPanel.Name = "automaticControlsPanel"; this.automaticControlsPanel.Padding = new System.Windows.Forms.Padding(5); - this.automaticControlsPanel.Size = new System.Drawing.Size(328, 647); + this.automaticControlsPanel.Size = new System.Drawing.Size(328, 634); this.automaticControlsPanel.TabIndex = 0; // // button1 @@ -549,20 +597,6 @@ namespace Xylem.Common.Ui.GenesisToolBox this.label1.Text = "Messgerät (COM port)"; this.label1.TextAlign = System.Drawing.ContentAlignment.BottomLeft; // - // timer3 - // - this.timer3.Interval = 10000; - this.timer3.Tick += new System.EventHandler(this.timer3_Tick); - // - // mainMenuStrip - // - this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control; - this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); - this.mainMenuStrip.Name = "mainMenuStrip"; - this.mainMenuStrip.Size = new System.Drawing.Size(1225, 24); - this.mainMenuStrip.TabIndex = 57; - this.mainMenuStrip.Text = "menuStrip1"; - // // tabPage4 // this.tabPage4.Controls.Add(this.label10); @@ -573,11 +607,44 @@ namespace Xylem.Common.Ui.GenesisToolBox this.tabPage4.Location = new System.Drawing.Point(4, 25); this.tabPage4.Name = "tabPage4"; this.tabPage4.Padding = new System.Windows.Forms.Padding(3); - this.tabPage4.Size = new System.Drawing.Size(1217, 647); + this.tabPage4.Size = new System.Drawing.Size(1147, 634); this.tabPage4.TabIndex = 4; this.tabPage4.Text = "Interpolation"; this.tabPage4.UseVisualStyleBackColor = true; // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(27, 131); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(35, 16); + this.label10.TabIndex = 43; + this.label10.Text = "Tofs"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(27, 91); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(45, 16); + this.label8.TabIndex = 42; + this.label8.Text = "PcbID"; + // + // txtInterpolTofs + // + this.txtInterpolTofs.Location = new System.Drawing.Point(78, 128); + this.txtInterpolTofs.Multiline = true; + this.txtInterpolTofs.Name = "txtInterpolTofs"; + this.txtInterpolTofs.Size = new System.Drawing.Size(196, 271); + this.txtInterpolTofs.TabIndex = 41; + // + // txtInterPolPcbId + // + this.txtInterPolPcbId.Location = new System.Drawing.Point(78, 91); + this.txtInterPolPcbId.Name = "txtInterPolPcbId"; + this.txtInterPolPcbId.Size = new System.Drawing.Size(196, 22); + this.txtInterPolPcbId.TabIndex = 40; + // // button2 // this.button2.Location = new System.Drawing.Point(78, 24); @@ -588,44 +655,426 @@ namespace Xylem.Common.Ui.GenesisToolBox this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // - // txtInterPolPcbId + // ReCalibration // - this.txtInterPolPcbId.Location = new System.Drawing.Point(78, 91); - this.txtInterPolPcbId.Name = "txtInterPolPcbId"; - this.txtInterPolPcbId.Size = new System.Drawing.Size(196, 22); - this.txtInterPolPcbId.TabIndex = 40; + this.ReCalibration.Controls.Add(this.label25); + this.ReCalibration.Controls.Add(this.label24); + this.ReCalibration.Controls.Add(this.lblFlowDisplay); + this.ReCalibration.Controls.Add(this.lblFlowChnl1); + this.ReCalibration.Controls.Add(this.lblFlowChnl2); + this.ReCalibration.Controls.Add(this.lblFlowChnl3); + this.ReCalibration.Controls.Add(this.label23); + this.ReCalibration.Controls.Add(this.label22); + this.ReCalibration.Controls.Add(this.btnStopM); + this.ReCalibration.Controls.Add(this.btnRefeshM); + this.ReCalibration.Controls.Add(this.btnStartM); + this.ReCalibration.Controls.Add(this.button3); + this.ReCalibration.Controls.Add(this.label19); + this.ReCalibration.Controls.Add(this.label20); + this.ReCalibration.Controls.Add(this.label21); + this.ReCalibration.Controls.Add(this.nudCal3); + this.ReCalibration.Controls.Add(this.nudCal2); + this.ReCalibration.Controls.Add(this.nudCal1); + this.ReCalibration.Controls.Add(this.label13); + this.ReCalibration.Controls.Add(this.label15); + this.ReCalibration.Controls.Add(this.label16); + this.ReCalibration.Controls.Add(this.nudZeroOffset3); + this.ReCalibration.Controls.Add(this.nudZeroOffset2); + this.ReCalibration.Controls.Add(this.nudZeroOffset1); + this.ReCalibration.Controls.Add(this.brnRead); + this.ReCalibration.Controls.Add(this.label18); + this.ReCalibration.Controls.Add(this.label17); + this.ReCalibration.Controls.Add(this.btnWirte); + this.ReCalibration.Controls.Add(this.nudSampleRate); + this.ReCalibration.Controls.Add(this.lblTof3); + this.ReCalibration.Controls.Add(this.lblTof1); + this.ReCalibration.Controls.Add(this.label14); + this.ReCalibration.Controls.Add(this.lblTof2); + this.ReCalibration.Controls.Add(this.label12); + this.ReCalibration.Controls.Add(this.label11); + this.ReCalibration.Controls.Add(this.BtnWritetemp); + this.ReCalibration.Controls.Add(this.nudTemp); + this.ReCalibration.Location = new System.Drawing.Point(4, 25); + this.ReCalibration.Margin = new System.Windows.Forms.Padding(2); + this.ReCalibration.Name = "ReCalibration"; + this.ReCalibration.Padding = new System.Windows.Forms.Padding(2); + this.ReCalibration.Size = new System.Drawing.Size(1147, 634); + this.ReCalibration.TabIndex = 5; + this.ReCalibration.Text = "tabPage5"; + this.ReCalibration.UseVisualStyleBackColor = true; + this.ReCalibration.Click += new System.EventHandler(this.ReCalibration_Click); // - // txtInterpolTofs + // lblFlowDisplay // - this.txtInterpolTofs.Location = new System.Drawing.Point(78, 128); - this.txtInterpolTofs.Multiline = true; - this.txtInterpolTofs.Name = "txtInterpolTofs"; - this.txtInterpolTofs.Size = new System.Drawing.Size(196, 271); - this.txtInterpolTofs.TabIndex = 41; + this.lblFlowDisplay.AutoSize = true; + this.lblFlowDisplay.Location = new System.Drawing.Point(639, 190); + this.lblFlowDisplay.Name = "lblFlowDisplay"; + this.lblFlowDisplay.Size = new System.Drawing.Size(15, 16); + this.lblFlowDisplay.TabIndex = 34; + this.lblFlowDisplay.Text = "0"; // - // label8 + // lblFlowChnl1 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(27, 91); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(45, 16); - this.label8.TabIndex = 42; - this.label8.Text = "PcbID"; + this.lblFlowChnl1.AutoSize = true; + this.lblFlowChnl1.Location = new System.Drawing.Point(639, 216); + this.lblFlowChnl1.Name = "lblFlowChnl1"; + this.lblFlowChnl1.Size = new System.Drawing.Size(15, 16); + this.lblFlowChnl1.TabIndex = 33; + this.lblFlowChnl1.Text = "0"; // - // label10 + // lblFlowChnl2 // - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(27, 131); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(35, 16); - this.label10.TabIndex = 43; - this.label10.Text = "Tofs"; + this.lblFlowChnl2.AutoSize = true; + this.lblFlowChnl2.Location = new System.Drawing.Point(639, 240); + this.lblFlowChnl2.Name = "lblFlowChnl2"; + this.lblFlowChnl2.Size = new System.Drawing.Size(15, 16); + this.lblFlowChnl2.TabIndex = 32; + this.lblFlowChnl2.Text = "0"; + // + // lblFlowChnl3 + // + this.lblFlowChnl3.AutoSize = true; + this.lblFlowChnl3.Location = new System.Drawing.Point(639, 266); + this.lblFlowChnl3.Name = "lblFlowChnl3"; + this.lblFlowChnl3.Size = new System.Drawing.Size(15, 16); + this.lblFlowChnl3.TabIndex = 31; + this.lblFlowChnl3.Text = "0"; + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(524, 216); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(75, 16); + this.label23.TabIndex = 30; + this.label23.Text = "Flow Chnl 1"; + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(524, 190); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(85, 16); + this.label22.TabIndex = 29; + this.label22.Text = "Flow Display"; + // + // btnStopM + // + this.btnStopM.Location = new System.Drawing.Point(583, 124); + this.btnStopM.Name = "btnStopM"; + this.btnStopM.Size = new System.Drawing.Size(75, 23); + this.btnStopM.TabIndex = 28; + this.btnStopM.Text = "Stop"; + this.btnStopM.UseVisualStyleBackColor = true; + this.btnStopM.Click += new System.EventHandler(this.btnStopM_Click); + // + // btnRefeshM + // + this.btnRefeshM.Location = new System.Drawing.Point(583, 91); + this.btnRefeshM.Name = "btnRefeshM"; + this.btnRefeshM.Size = new System.Drawing.Size(75, 23); + this.btnRefeshM.TabIndex = 27; + this.btnRefeshM.Text = "Refresh"; + this.btnRefeshM.UseVisualStyleBackColor = true; + this.btnRefeshM.Click += new System.EventHandler(this.btnRefeshM_Click); + // + // btnStartM + // + this.btnStartM.Location = new System.Drawing.Point(583, 62); + this.btnStartM.Name = "btnStartM"; + this.btnStartM.Size = new System.Drawing.Size(75, 23); + this.btnStartM.TabIndex = 26; + this.btnStartM.Text = "Start"; + this.btnStartM.UseVisualStyleBackColor = true; + this.btnStartM.Click += new System.EventHandler(this.btnStartM_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(299, 410); + this.button3.Margin = new System.Windows.Forms.Padding(2); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(56, 19); + this.button3.TabIndex = 25; + this.button3.Text = "Write"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(337, 329); + this.label19.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(43, 16); + this.label19.TabIndex = 24; + this.label19.Text = "CAL 2"; + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(337, 359); + this.label20.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(43, 16); + this.label20.TabIndex = 23; + this.label20.Text = "CAL 3"; + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(337, 291); + this.label21.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(43, 16); + this.label21.TabIndex = 22; + this.label21.Text = "CAL 1"; + // + // nudCal3 + // + this.nudCal3.Location = new System.Drawing.Point(411, 359); + this.nudCal3.Margin = new System.Windows.Forms.Padding(2); + this.nudCal3.Name = "nudCal3"; + this.nudCal3.Size = new System.Drawing.Size(90, 22); + this.nudCal3.TabIndex = 21; + // + // nudCal2 + // + this.nudCal2.Location = new System.Drawing.Point(411, 324); + this.nudCal2.Margin = new System.Windows.Forms.Padding(2); + this.nudCal2.Name = "nudCal2"; + this.nudCal2.Size = new System.Drawing.Size(90, 22); + this.nudCal2.TabIndex = 20; + // + // nudCal1 + // + this.nudCal1.Location = new System.Drawing.Point(411, 286); + this.nudCal1.Margin = new System.Windows.Forms.Padding(2); + this.nudCal1.Name = "nudCal1"; + this.nudCal1.Size = new System.Drawing.Size(90, 22); + this.nudCal1.TabIndex = 19; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(128, 332); + this.label13.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(69, 16); + this.label13.TabIndex = 18; + this.label13.Text = "Zero Tof 2"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(128, 362); + this.label15.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(69, 16); + this.label15.TabIndex = 17; + this.label15.Text = "Zero Tof 3"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(128, 294); + this.label16.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(69, 16); + this.label16.TabIndex = 16; + this.label16.Text = "Zero Tof 1"; + // + // nudZeroOffset3 + // + this.nudZeroOffset3.Location = new System.Drawing.Point(202, 362); + this.nudZeroOffset3.Margin = new System.Windows.Forms.Padding(2); + this.nudZeroOffset3.Name = "nudZeroOffset3"; + this.nudZeroOffset3.Size = new System.Drawing.Size(90, 22); + this.nudZeroOffset3.TabIndex = 15; + // + // nudZeroOffset2 + // + this.nudZeroOffset2.Location = new System.Drawing.Point(202, 327); + this.nudZeroOffset2.Margin = new System.Windows.Forms.Padding(2); + this.nudZeroOffset2.Name = "nudZeroOffset2"; + this.nudZeroOffset2.Size = new System.Drawing.Size(90, 22); + this.nudZeroOffset2.TabIndex = 14; + // + // nudZeroOffset1 + // + this.nudZeroOffset1.Location = new System.Drawing.Point(202, 289); + this.nudZeroOffset1.Margin = new System.Windows.Forms.Padding(2); + this.nudZeroOffset1.Name = "nudZeroOffset1"; + this.nudZeroOffset1.Size = new System.Drawing.Size(90, 22); + this.nudZeroOffset1.TabIndex = 13; + // + // brnRead + // + this.brnRead.Location = new System.Drawing.Point(184, 163); + this.brnRead.Margin = new System.Windows.Forms.Padding(2); + this.brnRead.Name = "brnRead"; + this.brnRead.Size = new System.Drawing.Size(56, 19); + this.brnRead.TabIndex = 12; + this.brnRead.Text = "Read"; + this.brnRead.UseVisualStyleBackColor = true; + this.brnRead.Click += new System.EventHandler(this.brnRead_Click); + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(45, 127); + this.label18.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(68, 16); + this.label18.TabIndex = 11; + this.label18.Text = "Ref Temp"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(37, 89); + this.label17.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(87, 16); + this.label17.TabIndex = 10; + this.label17.Text = "Sample Rate"; + // + // btnWirte + // + this.btnWirte.Location = new System.Drawing.Point(284, 84); + this.btnWirte.Margin = new System.Windows.Forms.Padding(2); + this.btnWirte.Name = "btnWirte"; + this.btnWirte.Size = new System.Drawing.Size(56, 19); + this.btnWirte.TabIndex = 9; + this.btnWirte.Text = "Write"; + this.btnWirte.UseVisualStyleBackColor = true; + this.btnWirte.Click += new System.EventHandler(this.btnWirte_Click); + // + // nudSampleRate + // + this.nudSampleRate.Location = new System.Drawing.Point(184, 84); + this.nudSampleRate.Margin = new System.Windows.Forms.Padding(2); + this.nudSampleRate.Name = "nudSampleRate"; + this.nudSampleRate.Size = new System.Drawing.Size(90, 22); + this.nudSampleRate.TabIndex = 8; + // + // lblTof3 + // + this.lblTof3.AutoSize = true; + this.lblTof3.Location = new System.Drawing.Point(199, 256); + this.lblTof3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblTof3.Name = "lblTof3"; + this.lblTof3.Size = new System.Drawing.Size(52, 16); + this.lblTof3.TabIndex = 7; + this.lblTof3.Text = "label16"; + // + // lblTof1 + // + this.lblTof1.AutoSize = true; + this.lblTof1.Location = new System.Drawing.Point(199, 206); + this.lblTof1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblTof1.Name = "lblTof1"; + this.lblTof1.Size = new System.Drawing.Size(52, 16); + this.lblTof1.TabIndex = 6; + this.lblTof1.Text = "label15"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(128, 232); + this.label14.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(38, 16); + this.label14.TabIndex = 5; + this.label14.Text = "Tof 2"; + // + // lblTof2 + // + this.lblTof2.AutoSize = true; + this.lblTof2.Location = new System.Drawing.Point(199, 232); + this.lblTof2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblTof2.Name = "lblTof2"; + this.lblTof2.Size = new System.Drawing.Size(52, 16); + this.lblTof2.TabIndex = 4; + this.lblTof2.Text = "label13"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(128, 256); + this.label12.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(38, 16); + this.label12.TabIndex = 3; + this.label12.Text = "Tof 3"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(128, 206); + this.label11.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(38, 16); + this.label11.TabIndex = 2; + this.label11.Text = "Tof 1"; + // + // BtnWritetemp + // + this.BtnWritetemp.Location = new System.Drawing.Point(284, 126); + this.BtnWritetemp.Margin = new System.Windows.Forms.Padding(2); + this.BtnWritetemp.Name = "BtnWritetemp"; + this.BtnWritetemp.Size = new System.Drawing.Size(56, 19); + this.BtnWritetemp.TabIndex = 1; + this.BtnWritetemp.Text = "WriteTemp"; + this.BtnWritetemp.UseVisualStyleBackColor = true; + this.BtnWritetemp.Click += new System.EventHandler(this.BtnWritetemp_Click); + // + // nudTemp + // + this.nudTemp.DecimalPlaces = 2; + this.nudTemp.Location = new System.Drawing.Point(184, 126); + this.nudTemp.Margin = new System.Windows.Forms.Padding(2); + this.nudTemp.Name = "nudTemp"; + this.nudTemp.Size = new System.Drawing.Size(90, 22); + this.nudTemp.TabIndex = 0; + // + // timer3 + // + this.timer3.Interval = 10000; + this.timer3.Tick += new System.EventHandler(this.timer3_Tick); + // + // mainMenuStrip + // + this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control; + this.mainMenuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); + this.mainMenuStrip.Name = "mainMenuStrip"; + this.mainMenuStrip.Size = new System.Drawing.Size(1155, 24); + this.mainMenuStrip.TabIndex = 57; + this.mainMenuStrip.Text = "menuStrip1"; + // + // label24 + // + this.label24.AutoSize = true; + this.label24.Location = new System.Drawing.Point(524, 240); + this.label24.Name = "label24"; + this.label24.Size = new System.Drawing.Size(75, 16); + this.label24.TabIndex = 35; + this.label24.Text = "Flow Chnl 2"; + // + // label25 + // + this.label25.AutoSize = true; + this.label25.Location = new System.Drawing.Point(524, 266); + this.label25.Name = "label25"; + this.label25.Size = new System.Drawing.Size(75, 16); + this.label25.TabIndex = 36; + this.label25.Text = "Flow Chnl 3"; // // FrmTempMeter // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1225, 700); + this.ClientSize = new System.Drawing.Size(1155, 687); this.Controls.Add(this.multiflancshCalibration); this.Controls.Add(this.mainMenuStrip); this.MainMenuStrip = this.mainMenuStrip; @@ -644,6 +1093,16 @@ namespace Xylem.Common.Ui.GenesisToolBox this.automaticControlsPanel.PerformLayout(); this.tabPage4.ResumeLayout(false); this.tabPage4.PerformLayout(); + this.ReCalibration.ResumeLayout(false); + this.ReCalibration.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudCal1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudZeroOffset1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudSampleRate)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nudTemp)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -697,5 +1156,43 @@ namespace Xylem.Common.Ui.GenesisToolBox private System.Windows.Forms.TextBox txtInterpolTofs; private System.Windows.Forms.TextBox txtInterPolPcbId; private System.Windows.Forms.Button button2; + private System.Windows.Forms.TabPage ReCalibration; + private System.Windows.Forms.Button brnRead; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Button btnWirte; + private System.Windows.Forms.NumericUpDown nudSampleRate; + private System.Windows.Forms.Label lblTof3; + private System.Windows.Forms.Label lblTof1; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label lblTof2; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Button BtnWritetemp; + private System.Windows.Forms.NumericUpDown nudTemp; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.NumericUpDown nudZeroOffset3; + private System.Windows.Forms.NumericUpDown nudZeroOffset2; + private System.Windows.Forms.NumericUpDown nudZeroOffset1; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.NumericUpDown nudCal3; + private System.Windows.Forms.NumericUpDown nudCal2; + private System.Windows.Forms.NumericUpDown nudCal1; + private System.Windows.Forms.Label lblFlowDisplay; + private System.Windows.Forms.Label lblFlowChnl1; + private System.Windows.Forms.Label lblFlowChnl2; + private System.Windows.Forms.Label lblFlowChnl3; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.Button btnStopM; + private System.Windows.Forms.Button btnRefeshM; + private System.Windows.Forms.Button btnStartM; + private System.Windows.Forms.Label label25; + private System.Windows.Forms.Label label24; } } \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.cs b/Common/Ui/GenesisToolBox/FrmTempMeter.cs index 9c2f56f2..5783eda4 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.cs +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.cs @@ -20,6 +20,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages; using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.MeasurementRecords; + using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore; using Xylem.Common.Hardware.WaterMeter.Genesis.Registers; using Xylem.Common.Hardware.WaterMeter.WaterMeterCore; using Xylem.Common.Logic.SoftwareAccessHelper; @@ -60,6 +61,14 @@ new RefTempRange() { Min = 28,Max = 30 }, new RefTempRange() { Min = 33,Max = 36 }, }; + + nudCal1.Maximum = Int32.MaxValue; + nudCal2.Maximum = Int32.MaxValue; + nudCal3.Maximum = Int32.MaxValue; + nudZeroOffset1.Minimum = Int32.MinValue; + nudZeroOffset2.Minimum = Int32.MinValue; + nudZeroOffset3.Minimum = Int32.MinValue; + } private void BtnConnect_Click(Object sender, EventArgs e) @@ -1092,6 +1101,152 @@ + } + + private void btnWirte_Click(Object sender, EventArgs e) + { + + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + gen.WriteRegister("GENESISFLOW_SampleRate", (int)nudSampleRate.Value); + } + } + + } + + private void BtnWritetemp_Click(Object sender, EventArgs e) + { + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + UInt32 TempToRegister = (UInt32)(nudTemp.Value * 4096); + gen.WriteRegister(Register.Genesisflow.ToFTempCalibrate, TempToRegister); + gen.Logout(); + } + } + + } + + private void brnRead_Click(Object sender, EventArgs e) + { + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + gen.ReLogin(); + lblTof1.Text = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ToFTempOffset1), 0).ToString(); + lblTof2.Text = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ToFTempOffset2), 0).ToString(); + lblTof3.Text = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ToFTempOffset3), 0).ToString(); + + nudZeroOffset1.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ZeroOffset1), 0); + nudZeroOffset2.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ZeroOffset2), 0); + nudZeroOffset3.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.ZeroOffset3), 0); + + + nudCal1.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.CalFactor1), 0); + nudCal2.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.CalFactor2), 0); + nudCal3.Value = BitConverter.ToInt32(gen.ReadRegister(Register.Genesisflow.CalFactor3), 0); + } + } + } + + private void button3_Click(Object sender, EventArgs e) + { + + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + gen.ReLogin(); + + gen.WriteRegister(Register.Genesisflow.ZeroOffset1, nudZeroOffset1.Value); + gen.WriteRegister(Register.Genesisflow.ZeroOffset2, nudZeroOffset2.Value); + gen.WriteRegister(Register.Genesisflow.ZeroOffset3, nudZeroOffset3.Value); + + var r = gen.WriteRegister(Register.Genesisflow.CalFactor1, (UInt16)nudCal1.Value, true,true); + gen.WriteRegister(Register.Genesisflow.CalFactor2, (UInt16)nudCal2.Value, true, true); + gen.WriteRegister(Register.Genesisflow.CalFactor3, (UInt16)nudCal3.Value, true, true); + + gen.WriteRegister(Register.Genesisflow.StoreCalibration, 1); + + gen.Logout(); + } + } + + } + + private void ReCalibration_Click(Object sender, EventArgs e) + { + + } + + private void btnStartM_Click(Object sender, EventArgs e) + { + + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + gen.StartMeasurement(); + } + } + } + + private void btnRefeshM_Click(Object sender, EventArgs e) + { + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + try + { + var r = gen.GetAllMeasurementResults(null, null, true); + foreach (var item in r) + { + + switch (item.Channel) + { + case 0 : + lblFlowDisplay.Text = item.DutFlowRateCmPh.ToString(); + break; + + case 1: + lblFlowChnl1.Text = item.DutFlowRateCmPh.ToString(); + break; + case 2: + lblFlowChnl2.Text = item.DutFlowRateCmPh.ToString(); + break; + + case 3: + lblFlowChnl3.Text = item.DutFlowRateCmPh.ToString(); + break; + } + + } + } + catch (Exception) + { + + throw; + } + + + } + } + } + + private void btnStopM_Click(Object sender, EventArgs e) + { + foreach (var meter in this.meterBatch.ListOfMeters) + { + if (meter is GenesisMeter gen) + { + gen.GetAllMeasurementResults(null, null, true); + } + } } } } diff --git a/Common/Ui/GenesisToolBox/FrmTempMeter.resx b/Common/Ui/GenesisToolBox/FrmTempMeter.resx index e23135dd..30008d16 100644 --- a/Common/Ui/GenesisToolBox/FrmTempMeter.resx +++ b/Common/Ui/GenesisToolBox/FrmTempMeter.resx @@ -123,229 +123,13 @@ 104, 17 - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - 191, 17 278, 17 - - True - - - True - - 42 + 25 \ No newline at end of file diff --git a/Common/Ui/GenesisToolBox/frmLeagcyTestApp.Designer.cs b/Common/Ui/GenesisToolBox/frmLeagcyTestApp.Designer.cs index e4bffa25..5e9e39d3 100644 --- a/Common/Ui/GenesisToolBox/frmLeagcyTestApp.Designer.cs +++ b/Common/Ui/GenesisToolBox/frmLeagcyTestApp.Designer.cs @@ -56,11 +56,9 @@ this.groupBox1.Controls.Add(this.rbMeasurement); this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.cblSlots); - this.groupBox1.Location = new System.Drawing.Point(16, 15); - this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox1.Location = new System.Drawing.Point(12, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox1.Size = new System.Drawing.Size(317, 129); + this.groupBox1.Size = new System.Drawing.Size(238, 105); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; this.groupBox1.Text = "Connection"; @@ -69,10 +67,9 @@ // cbRequest // this.cbRequest.AutoSize = true; - this.cbRequest.Location = new System.Drawing.Point(8, 101); - this.cbRequest.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbRequest.Location = new System.Drawing.Point(6, 82); this.cbRequest.Name = "cbRequest"; - this.cbRequest.Size = new System.Drawing.Size(83, 21); + this.cbRequest.Size = new System.Drawing.Size(66, 17); this.cbRequest.TabIndex = 11; this.cbRequest.Text = "Request"; this.cbRequest.UseVisualStyleBackColor = true; @@ -80,10 +77,9 @@ // rbFlowCalibration // this.rbFlowCalibration.AutoSize = true; - this.rbFlowCalibration.Location = new System.Drawing.Point(133, 78); - this.rbFlowCalibration.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.rbFlowCalibration.Location = new System.Drawing.Point(100, 63); this.rbFlowCalibration.Name = "rbFlowCalibration"; - this.rbFlowCalibration.Size = new System.Drawing.Size(128, 21); + this.rbFlowCalibration.Size = new System.Drawing.Size(99, 17); this.rbFlowCalibration.TabIndex = 10; this.rbFlowCalibration.Text = "Flow Calibration"; this.rbFlowCalibration.UseVisualStyleBackColor = true; @@ -92,10 +88,9 @@ // this.rbMeasurement.AutoSize = true; this.rbMeasurement.Checked = true; - this.rbMeasurement.Location = new System.Drawing.Point(12, 78); - this.rbMeasurement.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.rbMeasurement.Location = new System.Drawing.Point(9, 63); this.rbMeasurement.Name = "rbMeasurement"; - this.rbMeasurement.Size = new System.Drawing.Size(115, 21); + this.rbMeasurement.Size = new System.Drawing.Size(89, 17); this.rbMeasurement.TabIndex = 9; this.rbMeasurement.TabStop = true; this.rbMeasurement.Text = "Measurement"; @@ -104,20 +99,18 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 28); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(6, 23); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(49, 17); + this.label1.Size = new System.Drawing.Size(36, 13); this.label1.TabIndex = 6; this.label1.Text = "Slot(s)"; // // cblSlots // this.cblSlots.FormattingEnabled = true; - this.cblSlots.Location = new System.Drawing.Point(64, 23); - this.cblSlots.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cblSlots.Location = new System.Drawing.Point(48, 19); this.cblSlots.Name = "cblSlots"; - this.cblSlots.Size = new System.Drawing.Size(151, 38); + this.cblSlots.Size = new System.Drawing.Size(114, 19); this.cblSlots.TabIndex = 4; this.cblSlots.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.cblSlots_ItemCheck); this.cblSlots.SelectedIndexChanged += new System.EventHandler(this.cblSlots_SelectedIndexChanged); @@ -131,31 +124,27 @@ this.groupBox2.Controls.Add(this.btnMeasurementStop); this.groupBox2.Controls.Add(this.btnMeasurementPreparation); this.groupBox2.Controls.Add(this.btnMeasurementStart); - this.groupBox2.Location = new System.Drawing.Point(376, 15); - this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupBox2.Location = new System.Drawing.Point(282, 12); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupBox2.Size = new System.Drawing.Size(875, 129); + this.groupBox2.Size = new System.Drawing.Size(656, 105); this.groupBox2.TabIndex = 10; this.groupBox2.TabStop = false; this.groupBox2.Text = "Control"; // // btnGetResults // - this.btnGetResults.Location = new System.Drawing.Point(617, 16); - this.btnGetResults.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnGetResults.Location = new System.Drawing.Point(463, 13); this.btnGetResults.Name = "btnGetResults"; - this.btnGetResults.Size = new System.Drawing.Size(111, 98); + this.btnGetResults.Size = new System.Drawing.Size(83, 80); this.btnGetResults.TabIndex = 12; this.btnGetResults.Text = "Store Calibration"; this.btnGetResults.UseVisualStyleBackColor = true; // // btnStoreCal // - this.btnStoreCal.Location = new System.Drawing.Point(752, 16); - this.btnStoreCal.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnStoreCal.Location = new System.Drawing.Point(564, 13); this.btnStoreCal.Name = "btnStoreCal"; - this.btnStoreCal.Size = new System.Drawing.Size(111, 98); + this.btnStoreCal.Size = new System.Drawing.Size(83, 80); this.btnStoreCal.TabIndex = 11; this.btnStoreCal.Text = "Store Calibration"; this.btnStoreCal.UseVisualStyleBackColor = true; @@ -163,18 +152,16 @@ // // textBox1 // - this.textBox1.Location = new System.Drawing.Point(379, 44); - this.textBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBox1.Location = new System.Drawing.Point(284, 36); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(128, 22); + this.textBox1.Size = new System.Drawing.Size(97, 20); this.textBox1.TabIndex = 10; // // btnUpdate // - this.btnUpdate.Location = new System.Drawing.Point(251, 23); - this.btnUpdate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnUpdate.Location = new System.Drawing.Point(188, 19); this.btnUpdate.Name = "btnUpdate"; - this.btnUpdate.Size = new System.Drawing.Size(103, 98); + this.btnUpdate.Size = new System.Drawing.Size(77, 80); this.btnUpdate.TabIndex = 9; this.btnUpdate.Text = "SetBatchInfos"; this.btnUpdate.UseVisualStyleBackColor = true; @@ -182,10 +169,9 @@ // // btnMeasurementStop // - this.btnMeasurementStop.Location = new System.Drawing.Point(523, 16); - this.btnMeasurementStop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMeasurementStop.Location = new System.Drawing.Point(392, 13); this.btnMeasurementStop.Name = "btnMeasurementStop"; - this.btnMeasurementStop.Size = new System.Drawing.Size(87, 98); + this.btnMeasurementStop.Size = new System.Drawing.Size(65, 80); this.btnMeasurementStop.TabIndex = 8; this.btnMeasurementStop.Text = "Stop"; this.btnMeasurementStop.UseVisualStyleBackColor = true; @@ -193,10 +179,9 @@ // // btnMeasurementPreparation // - this.btnMeasurementPreparation.Location = new System.Drawing.Point(28, 23); - this.btnMeasurementPreparation.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMeasurementPreparation.Location = new System.Drawing.Point(21, 19); this.btnMeasurementPreparation.Name = "btnMeasurementPreparation"; - this.btnMeasurementPreparation.Size = new System.Drawing.Size(104, 98); + this.btnMeasurementPreparation.Size = new System.Drawing.Size(78, 80); this.btnMeasurementPreparation.TabIndex = 6; this.btnMeasurementPreparation.Text = "Preparation"; this.btnMeasurementPreparation.UseVisualStyleBackColor = true; @@ -204,10 +189,9 @@ // // btnMeasurementStart // - this.btnMeasurementStart.Location = new System.Drawing.Point(140, 23); - this.btnMeasurementStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMeasurementStart.Location = new System.Drawing.Point(105, 19); this.btnMeasurementStart.Name = "btnMeasurementStart"; - this.btnMeasurementStart.Size = new System.Drawing.Size(103, 98); + this.btnMeasurementStart.Size = new System.Drawing.Size(77, 80); this.btnMeasurementStart.TabIndex = 7; this.btnMeasurementStart.Text = "Start"; this.btnMeasurementStart.UseVisualStyleBackColor = true; @@ -215,10 +199,9 @@ // // btnCheckAll // - this.btnCheckAll.Location = new System.Drawing.Point(1556, 151); - this.btnCheckAll.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnCheckAll.Location = new System.Drawing.Point(1167, 123); this.btnCheckAll.Name = "btnCheckAll"; - this.btnCheckAll.Size = new System.Drawing.Size(120, 82); + this.btnCheckAll.Size = new System.Drawing.Size(90, 67); this.btnCheckAll.TabIndex = 14; this.btnCheckAll.Text = "CheckBatch"; this.btnCheckAll.UseVisualStyleBackColor = true; @@ -228,32 +211,31 @@ // this.ctlBatch.AutoSize = true; this.ctlBatch.BackColor = System.Drawing.SystemColors.Control; - this.ctlBatch.Location = new System.Drawing.Point(16, 180); - this.ctlBatch.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); - this.ctlBatch.MinimumSize = new System.Drawing.Size(880, 542); + this.ctlBatch.Location = new System.Drawing.Point(12, 146); + this.ctlBatch.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.ctlBatch.MinimumSize = new System.Drawing.Size(660, 440); this.ctlBatch.Name = "ctlBatch"; - this.ctlBatch.Size = new System.Drawing.Size(1409, 570); + this.ctlBatch.Size = new System.Drawing.Size(1057, 463); this.ctlBatch.TabIndex = 15; // // preAdjWr1 // - this.preAdjWr1.Location = new System.Drawing.Point(969, 220); - this.preAdjWr1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5); + this.preAdjWr1.Location = new System.Drawing.Point(727, 179); + this.preAdjWr1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.preAdjWr1.Name = "preAdjWr1"; - this.preAdjWr1.Size = new System.Drawing.Size(1301, 810); + this.preAdjWr1.Size = new System.Drawing.Size(976, 658); this.preAdjWr1.TabIndex = 16; // // FrmLegacyTestApp // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1837, 858); + this.ClientSize = new System.Drawing.Size(1378, 697); this.Controls.Add(this.preAdjWr1); this.Controls.Add(this.ctlBatch); this.Controls.Add(this.btnCheckAll); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "FrmLegacyTestApp"; this.Text = "FrmLegacyTestApp"; this.Load += new System.EventHandler(this.TestForm_Load); diff --git a/Common/Ui/LegacyGenesisControl/ctlBatch.cs b/Common/Ui/LegacyGenesisControl/ctlBatch.cs index 7c1d17b4..47c15888 100644 --- a/Common/Ui/LegacyGenesisControl/ctlBatch.cs +++ b/Common/Ui/LegacyGenesisControl/ctlBatch.cs @@ -1590,13 +1590,26 @@ namespace XylemCommonUiLegacyGenCtl { t = MeasurementDirection.TakeOnlyForward; } + if (testset.meterType == MeterTypes.eRegister) { t = MeasurementDirection.TakeBoth; } if (testset.meterType == MeterTypes.MagFlux) { - t = MeasurementDirection.TakeBoth; + if (testset.FlowTestingOnlyRevers) + { + t = MeasurementDirection.TakeOnlyBackward; + }else if (testset.FlowAdjustment) + { + t = MeasurementDirection.TakeBoth; + } + else + { + t = MeasurementDirection.TakeOnlyForward; + } + + } } else @@ -2452,6 +2465,10 @@ namespace XylemCommonUiLegacyGenCtl public dynamic GetTestSetupContainer() { + if (TestSetupContainer == null) + { + return new TestSetupContainer(); + } return TestSetupContainer; }