ProductionUiCordonel: -ReSharper

This commit is contained in:
Thomas Wiedebusch
2023-01-23 13:18:54 +01:00
parent a1df7a2fec
commit 0230ea7554
49 changed files with 305 additions and 548 deletions
@@ -28,7 +28,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -42,12 +42,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void doStartProcessLoop()
{
var reTrysLeft = 1;
while (reTrysLeft >= 0)
var retriesRemaining = 1;
while (retriesRemaining >= 0)
{
try
{
base.Progress = 0;
Progress = 0;
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
var url = $"{ServiceUrls.MeterInfoForTestBench()}{Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url);
@@ -56,12 +56,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var CalibrationRun = res[4];
var LastTestBechState = 0;
Boolean? HyState = null;
Boolean? HyState;
Boolean? preState = null;
if (!string.IsNullOrEmpty(res[5]))
{
var tmp = 0;
int.TryParse(res[5], out tmp);
int.TryParse(res[5], out var tmp);
LastTestBechState = tmp;
}
@@ -93,7 +92,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
));
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
if (!preState.HasValue || !preState.Value)
{
@@ -103,10 +102,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.lblText.Content = $"Zähler nicht erfolgreich vorbehandelt";
}
));
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
base.Progress = 50;
Progress = 50;
var nowSeconds = Meter.ReadRegister("POWERMON_TotalUsedSeconds");
var nowCharge = Meter.ReadRegister("POWERMON_TotalUsedCharge", 8);
@@ -129,8 +128,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//// Time Span in h in mAhr In % with one battery is 100%
////(((total used change difference / (Time span / 3600) ) / 3600000) / 19000)*100
var loadAtH = ((((Double)nowChargeV / ((Double)nowSecondsV / 3600)) / 3600000) / (19000 * 2)) * 100;
var totalUsed = (((Double)nowChargeV / 1000000 / 3.6) / ((19000 * 2))) * 100;
// ReSharper disable once UnusedVariable used for debug purposes
var loadAtH = nowChargeV / ((Double)nowSecondsV / 3600) / 3600000 / (19000 * 2) * 100;
var totalUsed = (Double)nowChargeV / 1000000 / 3.6 / (19000 * 2) * 100;
//lastFrame
Meter.WriteLog($"totalUsed at EOL {totalUsed}");
@@ -138,7 +138,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (totalUsed > 10)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
UserControl.lblText.Content = $"Batterie über 15% entladen";
Meter.WriteLog($"Batterie über 15% entladen");
}
@@ -148,20 +148,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
currentProcessState = ProductionProcessState.Done;
return;
}
reTrysLeft = reTrysLeft - 1;
retriesRemaining = retriesRemaining - 1;
currentProcessState = ProductionProcessState.Error;
}
catch (Exception ex)
{
Meter.WriteLog($"{ex}");
base.currentProcessState = ProductionProcessState.Error;
reTrysLeft = reTrysLeft - 1;
currentProcessState = ProductionProcessState.Error;
retriesRemaining = retriesRemaining - 1;
}
}
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
public override void StartProcess()
@@ -1,14 +1,8 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Logic.ProductionOrderCore.Vako;
@@ -25,7 +19,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Error,
Acknowledge
}
public Boolean DialogIsDone { get; private set; }
public Boolean DialogIsDone { get; }
public Int32 OrderNumber { get; set; }
public ProductionProcessCheckAttachment(Int32 orderNumber)
{
@@ -43,7 +37,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -56,18 +50,18 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(null, EventArgs.Empty);
}
private void StepError()
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
isDone?.Invoke(null, EventArgs.Empty);
}
public override async void StartProcess()
public override void StartProcess()
{
try
{
@@ -1,14 +1,7 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System.IO;
using System.Net;
using Newtonsoft.Json;
@@ -28,13 +21,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public Boolean DialogIsDone { get; private set; }
public Boolean DialogIsDone { get; }
public Int32 SerialNumber { get; private set; }
public Int32 Ordernumber { get; private set; }
private Int32? OldOrderNumber { get; set; }
private Boolean Error = false;
private Int32? OldOrderNumber { get; }
public ProductionProcessCheckOrderNumber(Int32? oldOrderNumber = null)
{
@@ -53,7 +45,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -66,7 +58,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(this, EventArgs.Empty);
}
@@ -101,7 +93,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//StepDone();
}
public override async void StartProcess()
public override void StartProcess()
{
//get order number
@@ -132,7 +124,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
try
{
var http = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = null;
HttpWebResponse response;
try
{
response = (HttpWebResponse)http.GetResponse();
@@ -145,15 +137,16 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (response != null && response.StatusCode == HttpStatusCode.OK)
{
var responseStream = response.GetResponseStream();
using (var sr = new StreamReader(responseStream))
{
var responseJson = sr.ReadToEnd();
var a = JsonConvert.DeserializeObject<String[]>(responseJson);
SerialNumber = Convert.ToInt32(a[0]);
Ordernumber = Convert.ToInt32(a[1]);
if (responseStream != null)
using (var sr = new StreamReader(responseStream))
{
var responseJson = sr.ReadToEnd();
var a = JsonConvert.DeserializeObject<String[]>(responseJson);
SerialNumber = Convert.ToInt32(a[0]);
Ordernumber = Convert.ToInt32(a[1]);
Meter.SerialNumber = SerialNumber.ToString();
}
Meter.SerialNumber = SerialNumber.ToString();
}
}
else
{
@@ -1,18 +1,7 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -28,12 +17,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public Boolean DialogIsDone { get; private set; }
public Boolean DialogIsDone { get; }
public String PcbSerialNumber { get; private set; }
public String AltRadio { get; private set; }
public String AltRadio { get; }
private Boolean Error = false;
public ProductionProcessCheckSerialNumber(String pcbSerialNumber, String altRadio = null)
{
@@ -52,7 +40,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -65,14 +53,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
isDone?.Invoke(this, EventArgs.Empty);
}
private void StepMismatch(String msg)
{
base.currentProcessState = ProductionProcessState.Error;
base.NewStatus(msg);
currentProcessState = ProductionProcessState.Error;
NewStatus(msg);
isDone?.Invoke(this, EventArgs.Empty);
@@ -114,7 +102,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//StepDone();
}
public override async void StartProcess()
public override void StartProcess()
{
PcbSerialNumber = Meter.SerialNumber;
UserControl.SetDesc($"Bitte den Deckel des Zählers Scannern{Environment.NewLine} Die Seriennummer muss abgeglichen werden.");
@@ -13,11 +13,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessConnect : BaseProductionProcess
{
public Task<IList<ProgrammingParameters>> asyncprogrammingParametersTask;
public Task<IList<ProgrammingParameters>> asyncProgrammingParametersTask;
private UcPlain UserControl;
private GenesisMeter Meter;
public ProductionProcessConnect()
public ProductionProcessConnect(GenesisMeter meter)
{
Meter = meter;
name = "Connect";
currentProcessState = ProductionProcessState.Waiting;
}
@@ -33,7 +33,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -46,48 +46,47 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public override void StartProcess()
{
base.NewStatus($"Prüfe Verbindung");
base.Progress = 0;
if (!base.Meter.IsLoggedOn)
NewStatus($"Prüfe Verbindung");
Progress = 0;
if (!Meter.IsLoggedOn)
{
base.NewStatus($"Login wird gestartet");
base.Meter.Login();
NewStatus($"Login wird gestartet");
Meter.Login();
}
//Check access in
base.Progress = 50;
base.NewStatus($"Zugang wird überprüft");
Progress = 50;
NewStatus($"Zugang wird überprüft");
//var res = base.Meter.ReadRegister(Register.Genesisflow.LedMode);
//if (res != null && res.Length > 0)
//{
base.Progress = 100;
base.NewStatus($"Zugang verifiziert");
Progress = 100;
NewStatus($"Zugang verifiziert");
currentProcessState = ProductionProcessState.Done;
asyncprogrammingParametersTask = new Task<IList<ProgrammingParameters>>(() =>
asyncProgrammingParametersTask = new Task<IList<ProgrammingParameters>>(() =>
{
try
{
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={base.Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={base.Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url, 80000);
return Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
}
catch (Exception ex)
catch (Exception )
{
return new List<ProgrammingParameters>() { };
return new List<ProgrammingParameters>
{
Capacity = 0
};
}
});
asyncprogrammingParametersTask.Start();
asyncProgrammingParametersTask.Start();
return;
//}
currentProcessState = ProductionProcessState.Error;
// throw new Exception($"Not able to login");
}
}
}
@@ -1,14 +1,8 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -24,8 +18,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Print,
Abort
}
public Boolean DialogIsDone { get; private set; }
private Boolean Error = false;
public Boolean DialogIsDone { get; }
private Boolean Error;
public ProductionProcessDone(Boolean error = false)
{
Error = error;
@@ -42,7 +36,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -55,7 +49,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
var retry = false;
var abort = false;
var print = false;
@@ -74,8 +68,6 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
case DialogResult.Abort:
abort = true;
break;
default:
break;
}
}
isDone?.Invoke(null, new Tuple<Boolean, Boolean,Boolean>(retry, abort, print));
@@ -132,7 +124,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.SetDialogOptions(OptionList);
}
public override async void StartProcess()
public override void StartProcess()
{
if (Error)
{
@@ -36,7 +36,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -88,18 +88,18 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
try
{
while (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.Running)
while (connectProcess.asyncProgrammingParametersTask.Status == TaskStatus.Running)
{
Thread.Sleep(500);
}
if (connectProcess.asyncprogrammingParametersTask.Status == TaskStatus.RanToCompletion
&& connectProcess.asyncprogrammingParametersTask.Result != null
&& connectProcess.asyncprogrammingParametersTask.Result.Any())
if (connectProcess.asyncProgrammingParametersTask.Status == TaskStatus.RanToCompletion
&& connectProcess.asyncProgrammingParametersTask.Result != null
&& connectProcess.asyncProgrammingParametersTask.Result.Any())
{
var myJsonResponse = connectProcess.asyncprogrammingParametersTask.Result;
var myJsonResponse = connectProcess.asyncProgrammingParametersTask.Result;
base.Progress = 15;
Progress = 15;
//fix
// CUSTOMER_LeakFlowThreshold
@@ -204,17 +204,17 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
cTask.RunSynchronously();
if (cTask.Result.Item2)
{
base.NewStatus($"Schreiben des Parameter {cTask.Result.Item1} war erfolgreich");
NewStatus($"Schreiben des Parameter {cTask.Result.Item1} war erfolgreich");
}
else
{
if (cTask.Result.Item1.ToLower().Contains("Metersize".ToLower()) || cTask.Result.Item1.ToLower().Contains("NFC_EraseRMA".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_ExcessFlowVolumeThreshold".ToLower()) || cTask.Result.Item1.ToLower().Contains("CUSTOMER_LeakFlowThreshold".ToLower()) || cTask.Result.Item1.ToLower() == "SENSUSRADIO_MetroRadioLifeTimeCounter".ToLower())
{
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
}
else
{
base.NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
NewStatus($"Warnung!Schreiben des Parameter {cTask.Result.Item1} war nicht erfolgreich");
ret = false;
break;
@@ -231,7 +231,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
base.Progress = 15 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 85, 0));
Progress = 15 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 85, 0));
done = done + 1;
}
@@ -250,9 +250,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
else
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
reTrysLeft = -1;
base.NewStatus($"Warnung!Fehler beim laden des Parametersatzes");
NewStatus($"Warnung!Fehler beim laden des Parametersatzes");
}
@@ -260,8 +260,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
catch (Exception ex)
{
base.currentProcessState = ProductionProcessState.Error;
base.NewStatus($"Warnung!Fehler bei behandeln {ex.Message}");
currentProcessState = ProductionProcessState.Error;
NewStatus($"Warnung!Fehler bei behandeln {ex.Message}");
reTrysLeft = reTrysLeft - 1;
}
@@ -8,18 +8,17 @@ using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Controls;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessFinalParameterizationFix : BaseProductionProcess
public class ProductionProcessFinalParametrizationFix : BaseProductionProcess
{
private UcPlain UserControl;
public ProductionProcessFinalParameterizationFix()
public ProductionProcessFinalParametrizationFix()
{
name = "Final Parameterization";
name = "Final Parametrization";
currentProcessState = ProductionProcessState.Waiting;
}
public override void InitUserControl()
@@ -31,7 +30,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -77,21 +76,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public override void StartProcess()
{
Progress = 0;
base.Progress = 0;
var useRadio = true;
var radioParams = new RadioConfigurationParams();
if (useRadio)
RadioConfigurationParams radioParams;
{
var url = ServiceUrls.GenesisFinalCheckServiceUrl();
url = "http://localhost:56011/api/FinalCheck/";
url = url + $"GetRadioConfiguration?PcbId={Meter.PcbId}&withPressure=false";
var url = "http://localhost:56011/api/FinalCheck/";
url += $"GetRadioConfiguration?PcbId={Meter.PcbId}&withPressure=false";
var http = (HttpWebRequest)WebRequest.Create(url);
http.Method = "GET";
@@ -108,7 +98,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
radioParams = JsonConvert.DeserializeObject<RadioConfigurationParams>(responseJson);
}
}
base.Progress = 20;
Progress = 20;
@@ -169,11 +159,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
(new Byte[] { 0x00, 0x00, 0x00, 0xFD }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_DisplayUnits",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
if (useRadio)
{
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
}
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ForwardArrow",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_HardErrorLimit",
(new Byte[] { 0x00, 0x00, 0x00, 0x04 }).Reverse().ToArray(), true, true));
@@ -189,7 +176,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_PipeFillingDelay",
(new Byte[] { 0x00, 0x00, 0x00, 0x1E }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_ResetAccumulators",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("GENESISFLOW_SampleRate",
(new Byte[] { 0x00, 0x00, 0x00, 0x02 }).Reverse().ToArray(), true, true));
@@ -226,26 +213,18 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
(new Byte[] { 0x00, 0x00, 0x27, 0x10 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("METROLOGYASST_TemperatureUnits",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_BatterySelection",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false));
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("POWERMON_WarnFromClamp",
(new Byte[] { 0x25, 0x89, 0x06, 0x00 }).Reverse().ToArray(), true, true));
//// just read later //overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_FrequencyIndicator}).Reverse(), true, true);
//Original
//0x11, 0x12, 0x13, 0x14, 0x21, 0x22, 0x23, 0x24, 0x31, 0x32, 0x33, 0x34, 0x41, 0x42, 0x43, 0x44
//Write to register
//0x14, 0x13, 0x12, 0x11, 0x24, 0x23, 0x22, 0x21, 0x34, 0x33, 0x32, 0x31, 0x44, 0x43, 0x42, 0x41
//good one
//E6-C8-88-00-DE-B8-68-C0-D6-A8-48-80-CE-98-28-40
//0E-05-04-04-00-14-30-68-D0-14-0E-80-40-63-93-73-22
@@ -253,85 +232,74 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//&bad one
//0E-05-04-05-00-00-88-C8-E6-C0-68-B8-DE-80-48-A8-D6-40-28-98-CE
//0E-05-04-04-00-22-73-93-63-40-80-0E-14-D0-68-30-14
if (useRadio)
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray()));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
//var funkadresse = new List<byte>();
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
// true, true));
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
// (new Byte[]
// {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// }).ToArray(), true, true));
var funkadresse = new List<Byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
}
else
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_WakeupInterval",
(new Byte[] { 0x00, 0x00, 0x00, 0x03 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_MbusState",
(new Byte[] { 0x00, 0x00, 0x00, 0x07 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_UtcTimeOffset",
(new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_HistoricalAlarmsDays",
(new Byte[] { 0x00, 0x00, 0x00, 0x1D }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_AverageFlowPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x05 }).Reverse().ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_DataLogPeriod",
(new Byte[] { 0x00, 0x00, 0x00, 0x3C }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateDayOfMonth",
(new Byte[] { 0x00, 0x00, 0x00, 0x01 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_FixedDateReadingContents",
(new Byte[] { 0x0C, 0x00, 0x24, 0x03 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_PeriodicLogLifeTimeCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, false));
overAllResult.Add(_currentGenesis_WriteRegister("PERIODICLOG_ResetCounter",
(new Byte[] { 0x00, 0x00, 0x00, 0x0 }).Reverse().ToArray(), true, true));
//var funkadresse = new List<byte>();
//funkadresse.AddRange((new Byte[] { 0xE6, 0xC8, 0x88, 0x00 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xDE, 0xB8, 0x68, 0xC0 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xD6, 0xA8, 0x48, 0x80 }).ToArray());
//funkadresse.AddRange((new Byte[] { 0xCE, 0x98, 0x28, 0x40 }).ToArray());
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(),
// true, true));
//overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey",
// (new Byte[]
// {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
// }).ToArray(), true, true));
var funkadresse = new List<Byte>();
funkadresse.AddRange((new Byte[] { 0x0E, 0x9F, 0xAC, 0xC6 }).ToArray());
funkadresse.AddRange((new Byte[] { 0xA0, 0xE1, 0xEF, 0x1C }).ToArray());
funkadresse.AddRange((new Byte[] { 0x3B, 0x27, 0xA4, 0x9B }).ToArray());
funkadresse.AddRange((new Byte[] { 0xAC, 0x21, 0x65, 0x35 }).ToArray());
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_EncryptionKey", funkadresse.ToArray(), true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_RadioAddress", radioParams.RadioAddress, true, true));
if (radioParams.PowerLevel > 0 && radioParams.PowerLevelOption > 0 && radioParams.ImpedanceCodeNew > 0 && radioParams.ImpedanceCodeOption > 0)
{
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevel", radioParams.PowerLevel, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_PowerLevelOption", radioParams.PowerLevelOption, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeNew", radioParams.ImpedanceCodeNew, true, true));
overAllResult.Add(_currentGenesis_WriteRegister("SENSUSRADIO_ImpedanceCodeOption", radioParams.ImpedanceCodeOption, true, true));
}
else
{
base.currentProcessState = ProductionProcessState.Error;
return;
}
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
currentProcessState = ProductionProcessState.Error;
return;
}
//_currentGenesis_WriteRegister("SENSUSRADIO_CustomerText",
// (new Byte[] { 0x00, 0x00, 0x00, 0x00 }).Reverse().ToArray(), true, false);
var ts = DateTimeOffset.UtcNow - new DateTimeOffset(2000, 1, 1, 0, 0, 0, new TimeSpan(0));
overAllResult.Add(wirteRegisterInBetweenCheck("SYSTEM_CalendarSeconds", Convert.ToInt32(ts.TotalSeconds)));
@@ -355,24 +323,24 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
cTask.RunSynchronously();
if (cTask.Result.Item2)
{
base.NewStatus($"set Parameter {cTask.Result.Item1} succeed");
NewStatus($"set Parameter {cTask.Result.Item1} succeed");
}
else
{
base.NewStatus($"set Parameter {cTask.Result.Item1} failed");
NewStatus($"set Parameter {cTask.Result.Item1} failed");
ret = false;
break;
}
base.Progress = 20 + ((Int32)Math.Round(((Double)done / (Double)overAllResult.Count) * 80, 0));
done = done + 1;
Progress = 20 + ((Int32)Math.Round((done / (Double)overAllResult.Count) * 80, 0));
done += 1;
}
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
@@ -26,7 +26,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -55,10 +55,11 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
try
{
var done1 = done;
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
new Action(() =>
{
UserControl.lblText.Content = $"Read {dic.GetIdent()}({done}/{total.Count})";
UserControl.lblText.Content = $"Read {dic.GetIdent()}({done1}/{total.Count})";
}
));
if (dic.RegisterName.ToLower() != "password" && dic.RegisterDetail.Privilege.Lvl8 != Access.Wo)
@@ -82,14 +83,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
base.Progress = (Int32)Math.Round(((Double)done / (Double)total.Count) * 100, 0);
Progress = (Int32)Math.Round(((Double)done / total.Count) * 100, 0);
}
catch (Exception e)
catch (Exception )
{
//todo: error logger
}
done = done + 1;
done += 1;
}
Meter.StoreCurrentRegisterDic();
@@ -97,13 +98,10 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
currentProcessState = ProductionProcessState.Done;
}
catch (Exception e)
catch (Exception )
{
currentProcessState = ProductionProcessState.Error;
}
}
}
}
@@ -3,21 +3,18 @@ using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.ProductionOrderCore;
using Xylem.Common.Logic.SoftwareAccessHelper;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
public class ProductionProcessGetFinalParameterizationVakoCsd : BaseProductionProcess
public class ProductionProcessGetFinalParametrizationVakoCsd : BaseProductionProcess
{
public IList<ProgrammingParameters> Result = new List<ProgrammingParameters>();
private UcPlain UserControl;
public ProductionProcessGetFinalParameterizationVakoCsd()
public ProductionProcessGetFinalParametrizationVakoCsd()
{
name = "Hole Kunden Parametrierung";
currentProcessState = ProductionProcessState.Waiting;
@@ -33,7 +30,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -47,47 +44,42 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void doStartProcessLoop()
{
var reTrysLeft = 2;
while (reTrysLeft >= 0)
var retriesRemaining = 2;
while (retriesRemaining >= 0)
{
try
{
base.Progress = 0;
Progress = 0;
//var url = $"http://localhost:56011/api/FinalCheck/GetProgrammingParameters?PcbID={Meter.PcbId}";
var url = $"{ServiceUrls.GenesisFinalCheckServiceUrl()}GetProgrammingParameters?PcbID={Meter.PcbId}";
var csdRet = LocalWebRequest.GetRequest(url, 60000);
Result = Newtonsoft.Json.JsonConvert.DeserializeObject<IList<ProgrammingParameters>>(csdRet);
base.Progress = 100;
Progress = 100;
if (!Result.Any())
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
currentProcessState = ProductionProcessState.Done;
return;
}
reTrysLeft = reTrysLeft - 1;
retriesRemaining -= 1;
}
catch (Exception ex)
catch (Exception )
{
base.currentProcessState = ProductionProcessState.Error;
reTrysLeft = reTrysLeft - 1;
currentProcessState = ProductionProcessState.Error;
retriesRemaining -= 1;
}
}
}
public override void StartProcess()
{
doStartProcessLoop();
}
}
}
@@ -30,7 +30,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -3,7 +3,6 @@ using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.UserControls.FinalTest;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@@ -33,42 +32,34 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
private void updateImage(Image ctlImage, Boolean? success = null)
{
String path = "/Resources/iconWating.png";
if (success.HasValue)
{
if (success.Value)
{
path = "/Resources/iconCheck.png";
}
else
{
path = "/Resources/iconWarn.png";
}
}
}
public override void StartProcess()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
return;
Boolean ret = RequestPassword();
updateImage(UserControl.RequestPassword, ret);
base.Progress = base.Progress + 16;
Progress = Progress + 16;
if (Encoding.UTF8.GetString(pwContainer.listOfPasswords.Last()) == pwContainer.Skeleton)//pwContainer.Skeleton )
{
NewStatus("Passwörter schon geschrieben. Prozess wird übersprungen");
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
return;
}
@@ -81,14 +72,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
updateImage(UserControl.CreateFile, ret);
base.Progress = base.Progress + 16;
Progress = Progress + 16;
if (ret)
{
ret = WritePasswordFileToMeter();
}
updateImage(UserControl.WriteToMeter, ret);
base.Progress = base.Progress + 16;
Progress = Progress + 16;
//Check if new password is in the meter ... even the file wirte wasnt succesfull
if (!ret)
{
@@ -101,14 +92,14 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
ret = UpdatePasswordinDb();
}
updateImage(UserControl.UpdatePassword, ret);
base.Progress = base.Progress + 16;
Progress = Progress + 16;
if (ret)
{
ret = Meter.Logout();
}
updateImage(UserControl.Logout, ret);
base.Progress = base.Progress + 16;
Progress = Progress + 16;
if (ret)
@@ -116,15 +107,15 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
ret = Meter.Login();
}
updateImage(UserControl.CheckNewPassword, ret);
base.Progress = 100;
Progress = 100;
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
else
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
}
public override void ProcessDone()
@@ -146,7 +137,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private MeterPwdFile meterPwdFile;
public Boolean RequestPassword()
{
base.NewStatus($"Request Passwords");
NewStatus($"Request Passwords");
var url = ServiceUrls.GenesisGetPasswordContainerServiceUrl();
//url = "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId=";
url = ($"{url}{Meter.PcbId}");
@@ -159,7 +150,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (errorCode == HttpStatusCode.OK.GetHashCode())
{
pwContainer = JsonConvert.DeserializeObject<MeterPasswordContainer>(resp);
base.NewStatus($"Passwörter verfügbar");
NewStatus($"Passwörter verfügbar");
return true;
}
return false;
@@ -1,6 +1,5 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -9,8 +8,6 @@ using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using System.Net;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Configuration;
using System.Configuration;
@@ -52,7 +49,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -66,13 +63,13 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (!ret)
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
//clear
}
private Byte[] SENSUSRADIO_WakeupInterval = null;
private Byte[] SENSUSRADIO_WakeupInterval;
public override void StartProcess()
{
@@ -104,7 +101,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
//}
BoxNr = Convert.ToByte(ConfigurationManager.AppSettings[$"SirtBoxNr"]);
DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAdress:{RadioAdress}s\r\n", false);
DebugMessage($"Start RadioCheck Comport:{Comport} ,BoxNr:{BoxNr}, freq: {freq}, RadioAddress:{RadioAdress}s\r\n", false);
Meter.WriteRegister("SENSUSRADIO_IrDAModulePresent", 1, true, true);
@@ -13,8 +13,8 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
public class ProductionProcessShippingMode : BaseProductionProcess
{
private UcPlain UserControl;
private Boolean doRestart = false;
private Boolean hasRadio = false;
private Boolean doRestart;
private Boolean hasRadio;
public ProductionProcessShippingMode(Boolean restart = false, Boolean registerHasRadio = true)
{
name = "Versandbereitschaft herstellen";
@@ -33,7 +33,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -58,12 +58,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (Meter.StoreAllConfigurations())
{
var writeList = new List<Boolean>();
writeList.Add(Meter.WriteRegister("SENSUSRADIO_SystemState", 1, true, false));
writeList.Add(Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", 0, true, false));
writeList.Add(Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", 0, true, false));
var writeList = new List<Boolean>
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 1),
Meter.WriteRegister("SENSUSRADIO_MainAlarmMask", 0),
Meter.WriteRegister("SENSUSRADIO_ExtendedAlarmMask", 0)
};
Thread.Sleep(15000);
@@ -86,16 +86,20 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
}
}
if (writeList.All(a => a == true))
if (writeList.All(a => a))
{
if (doRestart)
{
var CheckValuesAufterBoot = new List<Tuple<String, Byte[]>>();
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("METROLOGYASST_PulseLength", Meter.ReadRegister("METROLOGYASST_PulseLength")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("POWERMON_BatteryQuantity", Meter.ReadRegister("POWERMON_BatteryQuantity")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")));
CheckValuesAufterBoot.Add(new Tuple<String, Byte[]>("SENSUSRADIO_RadioAddress", Meter.ReadRegister("SENSUSRADIO_RadioAddress")));
var CheckValuesAfterBoot = new List<Tuple<String, Byte[]>>
{
new Tuple<String, Byte[]>("METROLOGYASST_PulseLength",
Meter.ReadRegister("METROLOGYASST_PulseLength")),
new Tuple<String, Byte[]>("POWERMON_BatteryQuantity",
Meter.ReadRegister("POWERMON_BatteryQuantity")),
new Tuple<String, Byte[]>("GENESISFLOW_MeterSize", Meter.ReadRegister("GENESISFLOW_MeterSize")),
new Tuple<String, Byte[]>("GENESISFLOW_CalFactor1", Meter.ReadRegister("GENESISFLOW_CalFactor1")),
new Tuple<String, Byte[]>("SENSUSRADIO_RadioAddress", Meter.ReadRegister("SENSUSRADIO_RadioAddress"))
};
var _meterResetPsu = new MeterResetPsu(Meter)
{
StoreConfigEnable = true
@@ -107,7 +111,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
Boolean? hasDiffrences = null;
foreach (var item in CheckValuesAufterBoot)
foreach (var item in CheckValuesAfterBoot)
{
if (!item.Item2.SequenceEqual(Meter.ReadRegister(item.Item1)))
{
@@ -125,7 +129,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (rebootSucceeded && hasDiffrences.HasValue && !hasDiffrences.Value)
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true, false);
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF);
Meter.Logout();
Thread.Sleep(5000);
Meter.Login();
@@ -134,12 +138,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var SENSUSRADIO_SystemState = Meter.ReadRegister("SENSUSRADIO_SystemState");
if (SENSUSRADIO_SystemState[0] == 0x02 && SENSUSRADIO_MainAlarmMask[0] != 0)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("resetRadio Failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -148,12 +152,12 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
else
{
Meter.WriteLog("reboot compare failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
else
{
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF, true, false);
Meter.WriteRegister("SENSUSRADIO_SystemState", 0xFF);
Meter.Logout();
Thread.Sleep(5000);
Meter.Login();
@@ -162,19 +166,19 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
var SENSUSRADIO_SystemState = Meter.ReadRegister("SENSUSRADIO_SystemState");
if (SENSUSRADIO_SystemState[0] == 0x02 && SENSUSRADIO_MainAlarmMask[0] != 0)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("resetRadio Failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
}
else
{
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -221,23 +225,23 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
if (rebootSucceeded && hasDiffrences.HasValue && !hasDiffrences.Value)
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
else
{
Meter.WriteLog("reboot compare failed");
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
}
else
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
return;
}
}
base.currentProcessState = ProductionProcessState.Error;
currentProcessState = ProductionProcessState.Error;
}
@@ -2,13 +2,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using ProductionUiCordonel.UserControls.FinalTest;
using System.Threading;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace ProductionUiCordonel.ProductionProcesses.Actions
{
@@ -16,7 +11,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
private UcDialog UserControl;
public Boolean DialogIsDone { get; private set; }
public Boolean DialogIsDone { get; }
public ProductionProcessSpecialConfig()
{
@@ -33,7 +28,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
{
if (UserControl == null)
{
throw new Exception($"UserControl {this.GetType()} not Ready");
throw new Exception($"UserControl {GetType()} not Ready");
}
return UserControl;
}
@@ -46,7 +41,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
private void StepDone()
{
base.currentProcessState = ProductionProcessState.Done;
currentProcessState = ProductionProcessState.Done;
}
private void StepRadio()
@@ -158,12 +153,9 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
UserControl.SetDialogOptions(pulseOptionList);
}
public override async void StartProcess()
public override void StartProcess()
{
StepPulse();
}
}
@@ -1,7 +1,5 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -12,7 +10,7 @@ namespace ProductionUiCordonel.ProductionProcesses
{
public abstract class BaseProductionProcess : IProductionProcess
{
private Int32 _progress = 0;
private Int32 _progress;
public Int32 Progress
{
get { return _progress; }
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses.Enum
{
@@ -1,10 +1,6 @@
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
@@ -1,9 +1,7 @@
using ProductionUiCordonel.ProductionProcesses.Actions;
using ProductionUiCordonel.ProductionProcesses.Enum;
using ProductionUiCordonel.ProductionProcesses.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionUiCordonel.ProductionProcesses
{