Merge branch 'main' of https://slm.sms-esaap.com/la_operations/laa_production
This commit is contained in:
@@ -171,7 +171,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState(2)" id="4">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:50075:localhost" />
|
||||
|
||||
@@ -72,8 +72,5 @@
|
||||
<Name>Common.Hardware.WaterMeter.eRegister</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="log.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -207,53 +207,93 @@
|
||||
|
||||
}
|
||||
|
||||
public static void MainCSD()
|
||||
//public static void /*MainCSD()*/ Main()
|
||||
//{
|
||||
// var alarmEnableMask = 0xD39F0000;
|
||||
// var ix = 0;
|
||||
|
||||
// foreach (var item in Enum.GetValues(typeof(AlarmMask)).Cast<AlarmMask>().OrderBy(x => (uint)x).ToArray())
|
||||
// {
|
||||
// Console.WriteLine($"{item,23} = {item:X} = {(uint)item,5} = {(alarmEnableMask << ix++) & 1}");
|
||||
// }
|
||||
|
||||
// foreach (var item in Enum.GetValues(typeof(FDRMask)).Cast<FDRMask>().OrderBy(x => x).ToArray())
|
||||
// {
|
||||
// Console.WriteLine($"{item} = {item:X} = {(uint)item}");
|
||||
// }
|
||||
|
||||
// ushort value = 3;
|
||||
|
||||
// Console.WriteLine($"0: {value >> 0 & 1}");
|
||||
// Console.WriteLine($"0: {value >> 1 & 1}");
|
||||
// Console.WriteLine($"0: {value >> 2 & 1}");
|
||||
|
||||
// Console.WriteLine("CSD CSD 772161_MW");
|
||||
// Console.WriteLine("=============================================================================");
|
||||
|
||||
// var alarm = AlarmMask.ALARM_REBOOT
|
||||
// | AlarmMask.ALARM_EMPTY_PIPE
|
||||
// | AlarmMask.ALARM_LOW_BATTERY
|
||||
// | AlarmMask.ALARM_REVERSE_FLOW;
|
||||
|
||||
// Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes((int)alarm))}");
|
||||
|
||||
|
||||
// var dlg = FDRMask.LOG_BILLING_COUNTER
|
||||
// | FDRMask.LOG_MIN_FLOW_VAL
|
||||
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
|
||||
// | FDRMask.LOG_ALARM_STATE
|
||||
// | FDRMask.LOG_EXT_ALARM_STATE;
|
||||
|
||||
// Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes((int)dlg))}");
|
||||
|
||||
// var fdr = FDRMask.LOG_BILLING_COUNTER
|
||||
// | FDRMask.LOG_MIN_FLOW_VAL
|
||||
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
|
||||
// | FDRMask.LOG_ALARM_STATE
|
||||
// | FDRMask.LOG_EXT_ALARM_STATE;
|
||||
|
||||
// Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes((int)fdr))}");
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// CSD 769400 Arqiva Thames Water
|
||||
/// </summary>
|
||||
public static void Main1231231()
|
||||
{
|
||||
//var alarmEnableMask = 0xD39F0000;
|
||||
//var ix = 0;
|
||||
Console.WriteLine("CSD 769400 Arqiva Thames Water");
|
||||
Console.WriteLine("=============================================================================");
|
||||
Console.WriteLine("--- DN50 --------------------------------------------------------------------");
|
||||
Console.WriteLine($"CUSTOMER_ExcessFlowVolumeThreshold: {BitConverter.ToString(BitConverter.GetBytes((int)(37.5 * 1000) / 256))}");
|
||||
|
||||
//foreach (var item in Enum.GetValues(typeof(AlarmMask)).Cast<AlarmMask>().OrderBy(x => (uint)x).ToArray())
|
||||
//{
|
||||
// Console.WriteLine($"{item,23} = {item:X} = {(uint)item,5} = {(alarmEnableMask << ix++) & 1}");
|
||||
//}
|
||||
var alarm = 1 << AlarmMask.ALARM_EMPTY_PIPE
|
||||
| 1 << AlarmMask.ALARM_SUSPECT_LEAK
|
||||
| 1 << AlarmMask.ALARM_LOW_BATTERY
|
||||
| 1 << AlarmMask.ALARM_HIGH_TEMPERATURE
|
||||
| 1 << AlarmMask.ALARM_LOW_TEMPERATURE
|
||||
| 1 << AlarmMask.ALARM_HIGH_PRESSURE
|
||||
| 1 << AlarmMask.ALARM_LOW_PRESSURE;
|
||||
|
||||
//foreach (var item in Enum.GetValues(typeof(FDRMask)).Cast<FDRMask>().OrderBy(x => x).ToArray())
|
||||
//{
|
||||
// Console.WriteLine($"{item} = {item:X} = {(uint)item}");
|
||||
//}
|
||||
|
||||
//ushort value = 3;
|
||||
|
||||
//Console.WriteLine($"0: {value >> 0 & 1}");
|
||||
//Console.WriteLine($"0: {value >> 1 & 1}");
|
||||
//Console.WriteLine($"0: {value >> 2 & 1}");
|
||||
|
||||
//Console.WriteLine("CSD CSD 772161_MW");
|
||||
//Console.WriteLine("=============================================================================");
|
||||
|
||||
//var alarm = AlarmMask.ALARM_REBOOT
|
||||
// | AlarmMask.ALARM_EMPTY_PIPE
|
||||
// | AlarmMask.ALARM_LOW_BATTERY
|
||||
// | AlarmMask.ALARM_REVERSE_FLOW;
|
||||
|
||||
//Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes((int)alarm))}");
|
||||
Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes(alarm))}");
|
||||
|
||||
|
||||
//var dlg = FDRMask.LOG_BILLING_COUNTER
|
||||
// | FDRMask.LOG_MIN_FLOW_VAL
|
||||
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
|
||||
// | FDRMask.LOG_ALARM_STATE
|
||||
// | FDRMask.LOG_EXT_ALARM_STATE;
|
||||
var dlg = 1 <<FDRMask.LOG_BILLING_COUNTER
|
||||
| 1 <<FDRMask.LOG_REVERSE_COUNTER
|
||||
| 1 <<FDRMask.LOG_MIN_FLOW_TIME
|
||||
| 1 <<FDRMask.LOG_MIN_FLOW_VAL
|
||||
| 1 <<FDRMask.LOG_CUR_FLOW_VAL
|
||||
| 1 <<FDRMask.LOG_PEAK_FLOW_TIME
|
||||
| 1 <<FDRMask.LOG_PEAK_FLOW_VAL
|
||||
| 1 <<FDRMask.LOG_MAX_FLOW_TIME
|
||||
| 1 <<FDRMask.LOG_MAX_FLOW_VAL
|
||||
| 1 <<FDRMask.LOG_ALARM_STATE;
|
||||
|
||||
//Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes((int)dlg))}");
|
||||
Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes(dlg))}");
|
||||
|
||||
//var fdr = FDRMask.LOG_BILLING_COUNTER
|
||||
// | FDRMask.LOG_MIN_FLOW_VAL
|
||||
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
|
||||
// | FDRMask.LOG_ALARM_STATE
|
||||
// | FDRMask.LOG_EXT_ALARM_STATE;
|
||||
var fdr = 1 << FDRMask.LOG_BILLING_COUNTER
|
||||
| 1 << FDRMask.LOG_ALARM_STATE;
|
||||
|
||||
//Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes((int)fdr))}");
|
||||
Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes(fdr))}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,9 +129,9 @@
|
||||
{
|
||||
task.SirtId = this.Id;
|
||||
this.tasks
|
||||
.AddOrUpdate(task.ResponseAddress, addr => task, (addr, oldTask) => task);
|
||||
.AddOrUpdate(task.RequestAddress, addr => task, (addr, oldTask) => task);
|
||||
var bytes = this.tasks
|
||||
.AddOrUpdate(address, addr => task, (addr, oldTask) => task)
|
||||
.AddOrUpdate(task.ResponseAddress, addr => task, (addr, oldTask) => task)
|
||||
.Start();
|
||||
this.sirtStream.Write(bytes);
|
||||
SIRTLogger.LogMessage($"{this.PortName}|TX: {BitConverter.ToString(bytes)}");
|
||||
@@ -203,7 +203,13 @@
|
||||
|
||||
if (this.tasks.TryGetValue(message.Address, out var task))
|
||||
{
|
||||
task?.Push(message);
|
||||
task.Push(message);
|
||||
|
||||
if (task.State == SIRTTaskState.Completed || task.State == SIRTTaskState.Cancelled)
|
||||
{
|
||||
this.tasks.TryRemove(task.RequestAddress, out _);
|
||||
this.tasks.TryRemove(task.ResponseAddress, out _);
|
||||
}
|
||||
}
|
||||
|
||||
if (messageReceivedEvent != null)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<byte[]> Read()
|
||||
public IEnumerable<byte[]> ReadAsEnumerable()
|
||||
{
|
||||
var buffer = Array.Empty<byte>();
|
||||
var length = default(int);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
namespace Common.Hardware.SIRT
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public sealed class SIRTStream
|
||||
@@ -27,7 +28,7 @@
|
||||
var messageLength = default(int);
|
||||
var message = default(byte[]);
|
||||
|
||||
foreach (var bytes in this.sirtPort.Read())
|
||||
foreach (var bytes in this.sirtPort.ReadAsEnumerable())
|
||||
{
|
||||
buffer.AddRange(bytes);
|
||||
bufferLength = buffer.Count;
|
||||
@@ -35,10 +36,9 @@
|
||||
// until can parse messages from the buffer
|
||||
while (bufferLength >= 12)
|
||||
{
|
||||
// reset the start index if needed
|
||||
if (startIndex < 0)
|
||||
if (startIndex < 0 || bufferLength < startIndex)
|
||||
{
|
||||
startIndex = 0;
|
||||
startIndex = Math.Min(Math.Max(startIndex, 0), bufferLength - 1);
|
||||
}
|
||||
|
||||
startIndex = buffer.IndexOf(SIRTConstants.SIRT_PC, startIndex);
|
||||
@@ -94,7 +94,6 @@
|
||||
|
||||
// in case there are more messages in the buffer
|
||||
bufferLength = buffer.Count;
|
||||
startIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,8 +87,6 @@
|
||||
public void SetPending()
|
||||
{
|
||||
this.State = SIRTTaskState.Pending;
|
||||
|
||||
this.awaiter.Set();
|
||||
}
|
||||
|
||||
public void SetRunning()
|
||||
@@ -110,8 +108,12 @@
|
||||
|
||||
public void Wait()
|
||||
{
|
||||
if (this.awaiter.IsSet)
|
||||
{
|
||||
this.awaiter.Reset();
|
||||
}
|
||||
|
||||
this.awaiter.Wait(this.Timeout);
|
||||
this.awaiter.Reset();
|
||||
}
|
||||
|
||||
public override bool Equals(object other)
|
||||
|
||||
+97
-67
@@ -47,23 +47,26 @@
|
||||
internal IEnumerable<EregisterTask> LoadInspectionInitializationTasks()
|
||||
{
|
||||
this.executionType = nameof(LoadInspectionInitializationTasks);
|
||||
var features = parameters.LoadInspectionInitializationFeatures();
|
||||
var features = this.parameters.LoadInspectionInitializationFeatures();
|
||||
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
if (this.runningTasks.Any())
|
||||
if (features.RequestAddress > 0 && features.ResponseAddress > 0)
|
||||
{
|
||||
this.runningTasks.Enqueue(new EregisterChangeMeterTypeTask(features.Frequency)
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
if (this.runningTasks.Any())
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
DelPamSemi = true,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Change Meter Type"
|
||||
});
|
||||
this.runningTasks.Enqueue(new EregisterChangeMeterTypeTask(features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
DelPamSemi = true,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Change Meter Type"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
@@ -72,39 +75,61 @@
|
||||
internal IEnumerable<EregisterTask> LoadInspectionFinalizationTasks()
|
||||
{
|
||||
this.executionType = nameof(LoadInspectionFinalizationTasks);
|
||||
var features = parameters.LoadInspectionFinalizationFeatures();
|
||||
var features = this.parameters.LoadInspectionFinalizationFeatures();
|
||||
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
// Setting all transmision intervals at the end
|
||||
this.runningTasks.Enqueue(new EregisterTask(features.Frequency)
|
||||
if (features.RequestAddress > 0 && features.ResponseAddress > 0)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.ResponseAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval)
|
||||
.Append(new ChangeNumberOfLatWindows(this.parameters.LAT_Interval))
|
||||
.Append(new ChangeTransmissionInterval(this.parameters.Transmission_Intervall))
|
||||
.Append(new OpenMeteringTransmitionIntervalWMBus(this.parameters.OMS_Interval))
|
||||
.Append(new ProvidePin(AuthLevel.II)),
|
||||
Name = "0, 2, 16, 17",
|
||||
});
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
// The last checked DEBUG telegram
|
||||
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.ResponseAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
});
|
||||
if (this.parameters.StatusFertigung == 30)
|
||||
{
|
||||
// Setting all transmision intervals at the end
|
||||
this.runningTasks.Enqueue(new EregisterTask(features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval)
|
||||
.Append(new ChangeNumberOfLatWindows(this.parameters.LAT_Interval))
|
||||
.Append(new ChangeTransmissionInterval(this.parameters.Transmission_Intervall))
|
||||
.Append(new OpenMeteringTransmitionIntervalWMBus(this.parameters.OMS_Interval))
|
||||
.Append(new ProvidePin(AuthLevel.II)),
|
||||
Name = "0, 2, 16, 17",
|
||||
});
|
||||
|
||||
// The last checked DEBUG telegram
|
||||
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
WakeUpModul = true,
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
});
|
||||
|
||||
// Setting all transmision intervals at the end
|
||||
this.runningTasks.Enqueue(new EregisterTask(features.Frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
Data = new ChangeWakeUp((WakeUpMode)this.parameters.Wake_Up_Interval)
|
||||
.Append(new ProvidePin(AuthLevel.II)),
|
||||
Name = "Funk aus",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
}
|
||||
@@ -120,10 +145,12 @@
|
||||
this.history.TempAdresse = this.parameters.TempAdresse;
|
||||
|
||||
var stopProgramming = false;
|
||||
var factoryState = FactoryState.Production;
|
||||
var task = default(EregisterTask);
|
||||
var lat = default(LAT);
|
||||
var debug = default(DEBUG);
|
||||
var semi = default(SEMI);
|
||||
var awaiter = new ManualResetEventSlim(false);
|
||||
|
||||
while (this.runningTasks.TryPeek(out task) && task.State != SIRTTaskState.Cancelled && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
@@ -131,9 +158,15 @@
|
||||
|
||||
while (task.State != SIRTTaskState.Completed && task.State != SIRTTaskState.Cancelled && !cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
this.sirtHub.Start(task);
|
||||
this.history.Push(task);
|
||||
task.Wait();
|
||||
if (this.sirtHub.Start(task))
|
||||
{
|
||||
this.history.Push(task);
|
||||
task.Wait();
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (task.ErrorMessage != null)
|
||||
{
|
||||
@@ -173,16 +206,10 @@
|
||||
lat = task.LATMessage;
|
||||
debug = task.DEBUGMessage;
|
||||
semi = task.SEMIMessage;
|
||||
factoryState = task.FactoryState;
|
||||
}
|
||||
|
||||
if (!this.runningTasks.TryDequeue(out task))
|
||||
{
|
||||
MessageBox.Show($"Task an Ep: {task.SlotNr} mit Funkadresse: {task.RequestAddress}|{task.ResponseAddress} könnte nicht gelöscht werden."
|
||||
, "Achtung"
|
||||
, MessageBoxButtons.OK);
|
||||
|
||||
break;
|
||||
}
|
||||
this.runningTasks.TryDequeue(out task);
|
||||
}
|
||||
else if (task.State == SIRTTaskState.Cancelled)
|
||||
{
|
||||
@@ -197,17 +224,20 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.executionType == nameof(LoadInspectionFinalizationTasks))
|
||||
this.state.ShouldUpdate = true; // task.FactoryState == FactoryState.Shipment;
|
||||
this.state.Bemerkung = this.executionType;
|
||||
this.state.Fabrikationsnummer = debug?.PCBID;
|
||||
this.state.BUP = lat?.ToString()?.Replace('-', '\t');
|
||||
this.state.DEBUG = debug?.ToString()?.Replace('-', '\t');
|
||||
this.state.SEMI = semi?.ToString()?.Replace('-', '\t');
|
||||
this.state.SemiDebugDatum = DateTime.Now;
|
||||
this.state.Seriennummer = this.parameters.SerienNr;
|
||||
this.state.TempAdresse = this.parameters.TempAdresse;
|
||||
|
||||
if (this.executionType == nameof(LoadInspectionFinalizationTasks)
|
||||
&& factoryState == FactoryState.Shipment
|
||||
&& this.parameters.StatusFertigung == 30)
|
||||
{
|
||||
this.state.ShouldUpdate = true;
|
||||
this.state.Bemerkung = this.executionType;
|
||||
this.state.Fabrikationsnummer = debug?.PCBID;
|
||||
this.state.BUP = lat?.ToString()?.Replace('-', '\t');
|
||||
this.state.DEBUG = debug?.ToString()?.Replace('-', '\t');
|
||||
this.state.SEMI = semi?.ToString()?.Replace('-', '\t');
|
||||
this.state.SemiDebugDatum = DateTime.Now;
|
||||
this.state.Seriennummer = this.parameters.SerienNr;
|
||||
this.state.TempAdresse = this.parameters.TempAdresse;
|
||||
this.state.FunkadresseDatum = DateTime.Now;
|
||||
this.state.GeschlossenDatum = DateTime.Now;
|
||||
}
|
||||
@@ -258,7 +288,7 @@
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.ResponseAddress,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
@@ -271,7 +301,7 @@
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
RequestAddress = features.ResponseAddress,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
IsEncrypted = this.parameters.IsEncrypted,
|
||||
|
||||
+8
@@ -16,6 +16,7 @@
|
||||
{
|
||||
this.parameters = parameters;
|
||||
this.Name = "Check state";
|
||||
this.WakeUpCmd = true;
|
||||
this.Data = new OpticalTelegram
|
||||
{
|
||||
Minutes = 1
|
||||
@@ -26,6 +27,13 @@
|
||||
});
|
||||
}
|
||||
|
||||
public override byte[] Start()
|
||||
{
|
||||
this.WakeUpModul = !this.AnyTelegramReceived;
|
||||
|
||||
return base.Start();
|
||||
}
|
||||
|
||||
public override void Push(SIRTMessage response)
|
||||
{
|
||||
base.Push(response);
|
||||
|
||||
+4
-12
@@ -13,10 +13,10 @@
|
||||
{
|
||||
private byte[] payload;
|
||||
private int countFailures;
|
||||
private int runsCount = 1;
|
||||
|
||||
public EregisterTask(int frequency)
|
||||
{
|
||||
this.Timeout = 10_000;
|
||||
this.DelPamSemi = true;
|
||||
this.Frequency = frequency;
|
||||
this.RSSI = new RSSI(0, frequency);
|
||||
@@ -40,7 +40,7 @@
|
||||
get => this.label;
|
||||
set
|
||||
{
|
||||
this.label = value;
|
||||
this.label = value; // $"({this.runsCount}) {value}";
|
||||
|
||||
var changeEvent = this.Changed;
|
||||
|
||||
@@ -75,13 +75,8 @@
|
||||
|
||||
public ErrorMessage ErrorMessage { get; protected set; }
|
||||
|
||||
public bool SkipWakeUpCommands { get; set; }
|
||||
|
||||
public override byte[] Start()
|
||||
{
|
||||
this.WakeUpCmd = !this.AnyTelegramReceived;
|
||||
this.WakeUpModul = !this.AnyTelegramReceived;
|
||||
|
||||
var payloadL = this.request.Payload.Length;
|
||||
this.payload = new byte[payloadL];
|
||||
|
||||
@@ -103,6 +98,7 @@
|
||||
this.DEBUGMessage = default(DEBUG);
|
||||
this.SEMIMessage = default(SEMI);
|
||||
this.AnyTelegramReceived = false;
|
||||
this.runsCount++;
|
||||
|
||||
this.SetRunning();
|
||||
|
||||
@@ -240,11 +236,7 @@
|
||||
{
|
||||
this.P12 = new P12(response.P1);
|
||||
this.Label = "AKN";
|
||||
|
||||
if (this.Label != "AKN")
|
||||
{
|
||||
this.SetPending();
|
||||
}
|
||||
this.SetPending();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+29
-28
@@ -219,7 +219,7 @@
|
||||
|
||||
public byte ActivationByThreshold { get; set; }
|
||||
|
||||
[CompareProperty]
|
||||
// [CompareProperty]
|
||||
public ushort OMS_Interval { get; set; }
|
||||
|
||||
public uint DisplayVolume { get; set; }
|
||||
@@ -263,12 +263,11 @@
|
||||
ResponseAddress = (uint)(this.IsEncrypted ? this.TempAdresse : this.Adresse),
|
||||
Frequency = this.Frequency,
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
/////////////////////////////////////////////////////
|
||||
ChangeMeterReading = this.DisplayVolume,
|
||||
Debug = new EregisterDebugFeatures()
|
||||
};
|
||||
|
||||
features.ChangeMeterReading = this.DisplayVolume;
|
||||
|
||||
features.Debug = new EregisterDebugFeatures();
|
||||
|
||||
if (!this.IsEbeling && !this.IsFuhzoe)
|
||||
{
|
||||
features.Debug.DisableOTAFirmwareUpdate = this.DisableOTA;
|
||||
@@ -277,12 +276,13 @@
|
||||
|
||||
if (this.StatusFertigung != 30)
|
||||
{
|
||||
features.ChangeWakeUp = WakeUpMode.StayAwake;
|
||||
features.ChangeMeterReading = 333_333_333;
|
||||
features.Debug = new EregisterDebugFeatures
|
||||
{
|
||||
OpticalTelegram = 0
|
||||
};
|
||||
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
@@ -334,6 +334,7 @@
|
||||
Counter = this.Data_Logging_Counter,
|
||||
AlarmState = this.Data_Logging_Alarm_State,
|
||||
};
|
||||
features.ChangeWakeUp = WakeUpMode.SleepAutoOn;
|
||||
features.ChangeFixedDateReadingSettings = new ChangeFixedDateReadingSettings
|
||||
{
|
||||
DayOfMonth = this.FDR_Day_Of_Data_Reading,
|
||||
@@ -372,28 +373,28 @@
|
||||
ResponseAddress = (uint)(this.IsEncrypted ? this.TempAdresse : this.Adresse),
|
||||
Frequency = this.Frequency,
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
};
|
||||
|
||||
features.ChangeWakeUp = WakeUpMode.StayAwake;
|
||||
features.ChangeTransmissionInterval = this.TransmissionIntervalInitialization;
|
||||
features.ChangeNumberOfLatWindows = this.LatWindowsInitialization;
|
||||
features.ChangeMeterReading = 111_111_111;
|
||||
features.WirelessMBusMode = this.MBusStatus;
|
||||
features.SetMetrologyParameters = new SetMetrologyParameters
|
||||
{
|
||||
UseCandIRules = this.DisallowReverseVolume,
|
||||
DecimalPoint = (DecimalPointLocations)this.DecimalPoint,
|
||||
FactoryCalibration = this.FactoryCalibration,
|
||||
MeterSize = this.MeterSize,
|
||||
OffsetFactor = this.OffsetFactor,
|
||||
OffsetTime = this.OffsetTime,
|
||||
Units = (MessurementUnits)this.UnitsOfMessure,
|
||||
Vpp = (int)this.VolumePerPulse,
|
||||
VppLED = this.VolumePerLedPulse
|
||||
};
|
||||
features.Debug = new EregisterDebugFeatures
|
||||
{
|
||||
OpticalTelegram = this.LED_ON_Minutes
|
||||
/////////////////////////////////////////////////////
|
||||
ChangeWakeUp = WakeUpMode.StayAwake,
|
||||
ChangeTransmissionInterval = this.TransmissionIntervalInitialization,
|
||||
ChangeNumberOfLatWindows = this.LatWindowsInitialization,
|
||||
ChangeMeterReading = 111_111_111,
|
||||
WirelessMBusMode = this.MBusStatus,
|
||||
SetMetrologyParameters = new SetMetrologyParameters
|
||||
{
|
||||
UseCandIRules = this.DisallowReverseVolume,
|
||||
DecimalPoint = (DecimalPointLocations)this.DecimalPoint,
|
||||
FactoryCalibration = this.FactoryCalibration,
|
||||
MeterSize = this.MeterSize,
|
||||
OffsetFactor = this.OffsetFactor,
|
||||
OffsetTime = this.OffsetTime,
|
||||
Units = (MessurementUnits)this.UnitsOfMessure,
|
||||
Vpp = (int)this.VolumePerPulse,
|
||||
VppLED = this.VolumePerLedPulse
|
||||
},
|
||||
Debug = new EregisterDebugFeatures
|
||||
{
|
||||
OpticalTelegram = this.LED_ON_Minutes
|
||||
}
|
||||
};
|
||||
|
||||
return features;
|
||||
|
||||
+1
-2
@@ -23,7 +23,6 @@
|
||||
public DateTime? FunkadresseDatum { get; set; }
|
||||
|
||||
public long Seriennummer { get; set; }
|
||||
|
||||
public bool ShouldUpdate { get; set; }
|
||||
public Boolean ShouldUpdate { get; internal set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;" />
|
||||
<add key="EncryptionKeisUrl" value="http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/eregister/radiokey/byserialno/{0}" />
|
||||
<add key="SIRTComPorts" value="COM6,COM8" />
|
||||
<add key="PSNR" value="2015" />
|
||||
<add key="PSNR" value="1001" />
|
||||
<add key="SIRT_433" value=""/>
|
||||
<add key="SIRT_868" value=""/>
|
||||
</appSettings>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
if (!this.ShutdownRunningInstance())
|
||||
{
|
||||
var mainWindow = new MainWindow();
|
||||
var args = e.Args;
|
||||
var args = e.Args; // new object[] { "EregisterInitialize", 146 }; //
|
||||
var argsLength = args?.Length ?? 0;
|
||||
|
||||
if (argsLength > 0)
|
||||
|
||||
@@ -159,20 +159,7 @@
|
||||
<Compile Include="Pages\EregisterInitialize.xaml.cs">
|
||||
<DependentUpon>EregisterInitialize.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Eregister\History.xaml.cs">
|
||||
<DependentUpon>History.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Eregister\M\Data\EregisterSqlite.cs" />
|
||||
<Compile Include="Pages\Eregister\M\Data\Message.cs" />
|
||||
<Compile Include="Pages\Eregister\M\HistoryM.cs" />
|
||||
<Compile Include="Pages\Eregister\M\MessageM.cs" />
|
||||
<Compile Include="Pages\Eregister\VM\AddressVM.cs" />
|
||||
<Compile Include="Pages\Eregister\VM\HistoryVM.cs" />
|
||||
<Compile Include="Infrastructure\VMLocator.cs" />
|
||||
<Compile Include="Pages\Eregister\VM\EregisterLocator.cs" />
|
||||
<Compile Include="Pages\Eregister\V\AddressesItemsControl.xaml.cs">
|
||||
<DependentUpon>AddressesItemsControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Home.xaml.cs">
|
||||
<DependentUpon>Home.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -254,14 +241,6 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\Eregister\History.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Eregister\V\AddressesItemsControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Home.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
<Grid x:Class="Common.UI.Controls.GridLayout"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels">
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels" >
|
||||
<Grid.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:UIGridItem}" >
|
||||
<Border Background="{Binding BackgroundColor}"
|
||||
BorderBrush="{Binding BorderColor}"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="1 1 1 0"
|
||||
Padding="10, 5">
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding ForegroundColor}"
|
||||
HorizontalContentAlignment="Center"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Stretch"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterTaskVM}" >
|
||||
<Border Background="{Binding Label, Converter={StaticResource TaskStateToBG}}"
|
||||
BorderBrush="Gray"
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
for (var i = 0; i < columnsCount; i++)
|
||||
{
|
||||
this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star), MinWidth = 200 });
|
||||
this.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star)/*, MinWidth = 200*/ });
|
||||
}
|
||||
|
||||
foreach (var item in this.ItemsSource)
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
var dll = new FileInfo(typeof(AppHost).Assembly.Location);
|
||||
var name = "NLogs";
|
||||
var nlogs = dll.Directory.CreateSubdirectory(name);
|
||||
var file = Path.Combine(nlogs.FullName, $"{DateTime.Now:yyyy-MM-dd}.txt");
|
||||
var file = Path.Combine(nlogs.FullName, $"{DateTime.Now:yyyy-MM-dd HH:mm}.txt");
|
||||
|
||||
LogManager.Configuration = new LoggingConfiguration();
|
||||
LogManager.ThrowConfigExceptions = true;
|
||||
@@ -98,7 +98,7 @@
|
||||
private static SIRTHub CreateSIRTFactory()
|
||||
{
|
||||
var sirtHub = new SIRTHub();
|
||||
|
||||
|
||||
SIRTLogger.Message += NLogger.Debug;
|
||||
SIRTLogger.State += NLogger.Debug;
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
ShowsNavigationUI="False"
|
||||
Source="Pages/EregisterFinalize.xaml"
|
||||
Source="Pages/EregisterInitialize.xaml"
|
||||
Title="PAM 146: Set metrology parameters">
|
||||
</NavigationWindow>
|
||||
|
||||
@@ -26,31 +26,32 @@
|
||||
{
|
||||
foreach (var state in states)
|
||||
{
|
||||
if (state.ShouldUpdate)
|
||||
{
|
||||
sqlConnection
|
||||
.CreateCommand($@"
|
||||
sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE eRegister
|
||||
SET Bemerkung = @{nameof(state.Bemerkung)}
|
||||
, BUP = @{nameof(state.BUP)}
|
||||
, SEMI = @{nameof(state.SEMI)}
|
||||
, DEBUG = @{nameof(state.DEBUG)}
|
||||
, SemiDebugDatum = @{nameof(state.SemiDebugDatum)}
|
||||
, GeschlossenDatum = @{nameof(state.GeschlossenDatum)}
|
||||
, FunkadresseDatum = @{nameof(state.FunkadresseDatum)}
|
||||
, TempAdresse = @{nameof(state.TempAdresse)}
|
||||
WHERE Seriennummer = @{nameof(state.Seriennummer)}")
|
||||
.SetParameter(nameof(state.Bemerkung), state.Bemerkung)
|
||||
.SetParameter(nameof(state.BUP), state.BUP)
|
||||
.SetParameter(nameof(state.SEMI), state.SEMI)
|
||||
.SetParameter(nameof(state.DEBUG), state.DEBUG)
|
||||
.SetParameter(nameof(state.SemiDebugDatum), state.SemiDebugDatum)
|
||||
.SetParameter(nameof(state.GeschlossenDatum), state.GeschlossenDatum)
|
||||
.SetParameter(nameof(state.FunkadresseDatum), state.FunkadresseDatum)
|
||||
.SetParameter(nameof(state.TempAdresse), state.TempAdresse)
|
||||
.SetParameter(nameof(state.Seriennummer), state.Seriennummer)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
SET Bemerkung = ISNULL(@{nameof(state.Bemerkung)}, er.Bemerkung)
|
||||
, BUP = ISNULL(@{nameof(state.BUP)}, er.BUP)
|
||||
, SEMI = ISNULL(@{nameof(state.SEMI)}, er.SEMI)
|
||||
, DEBUG = ISNULL(@{nameof(state.DEBUG)}, er.DEBUG)
|
||||
, SemiDebugDatum = ISNULL(@{nameof(state.SemiDebugDatum)}, er.SemiDebugDatum)
|
||||
, GeschlossenDatum = ISNULL(@{nameof(state.GeschlossenDatum)}, er.GeschlossenDatum)
|
||||
, FunkadresseDatum = ISNULL(@{nameof(state.FunkadresseDatum)}, er.FunkadresseDatum)
|
||||
, TempAdresse = ISNULL(@{nameof(state.TempAdresse)}, er.TempAdresse)
|
||||
FROM eRegister AS er
|
||||
JOIN AuftragPositionSerienNr AS aps
|
||||
ON er.Seriennummer = aps.SerienNr
|
||||
WHERE er.Seriennummer = @{nameof(state.Seriennummer)}
|
||||
AND aps.StatusFertigung = 30")
|
||||
.SetParameter(nameof(state.Bemerkung), state.Bemerkung)
|
||||
.SetParameter(nameof(state.BUP), state.BUP)
|
||||
.SetParameter(nameof(state.SEMI), state.SEMI)
|
||||
.SetParameter(nameof(state.DEBUG), state.DEBUG)
|
||||
.SetParameter(nameof(state.SemiDebugDatum), state.SemiDebugDatum)
|
||||
.SetParameter(nameof(state.GeschlossenDatum), state.GeschlossenDatum)
|
||||
.SetParameter(nameof(state.FunkadresseDatum), state.FunkadresseDatum)
|
||||
.SetParameter(nameof(state.TempAdresse), state.TempAdresse)
|
||||
.SetParameter(nameof(state.Seriennummer), state.Seriennummer)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<Page x:Class="Common.UI.Pages.Eregister.History"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:V="clr-namespace:Common.UI.Pages.Eregister.V"
|
||||
DataContext="{Binding Eregister.HistoryVM, Source={StaticResource VMLocator}}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Controls:MainMenu Grid.Row="0"/>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ScrollViewer Grid.Column="0"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<V:AddressItemsControl FontFamily="Verdana"
|
||||
ItemsSource="{Binding Addresses}"
|
||||
Margin="3" />
|
||||
</ScrollViewer>
|
||||
<GridSplitter Background="LightGray"
|
||||
Grid.Column="1"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
ResizeDirection="Columns"
|
||||
Width="3"/>
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class History : Page
|
||||
{
|
||||
public History() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.M.Data
|
||||
{
|
||||
using SQLite;
|
||||
|
||||
internal class EregisterSqlite
|
||||
{
|
||||
public const string SQLiteConnectionStringKey = nameof(SQLiteConnectionString);
|
||||
|
||||
private readonly SQLiteConnection connection;
|
||||
|
||||
public EregisterSqlite(string connectionString)
|
||||
{
|
||||
this.connection = new SQLiteConnection(connectionString);
|
||||
_ = this.connection.CreateTable<Message>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.M.Data
|
||||
{
|
||||
using SQLite;
|
||||
using System;
|
||||
|
||||
public class Message
|
||||
{
|
||||
[PrimaryKey]
|
||||
[AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int SerialNr { get; set; }
|
||||
|
||||
public byte Start { get; set; }
|
||||
|
||||
public byte Cmd { get; set; }
|
||||
|
||||
public byte P1 { get; set; }
|
||||
|
||||
public byte P2 { get; set; }
|
||||
|
||||
public uint Address { get; set; }
|
||||
|
||||
public byte Length { get; set; }
|
||||
|
||||
public byte[] Data { get; set; }
|
||||
|
||||
public ushort CRC { get; set; }
|
||||
|
||||
public byte End { get; set; }
|
||||
|
||||
public DateTime TimeStamp { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.M
|
||||
{
|
||||
using Common.UI.Pages.Eregister.M.Data;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal class HistoryM
|
||||
{
|
||||
private readonly EregisterSqlite sqlite;
|
||||
|
||||
public HistoryM(EregisterSqlite sqlite)
|
||||
=> this.sqlite = sqlite;
|
||||
|
||||
public IEnumerable<uint> EnumerateAddresses()
|
||||
{
|
||||
foreach (var address in new uint[] { 4291025098, 4291025027, 4291023847, 4291025038, 4291025000, 4291025090 })
|
||||
{
|
||||
yield return address;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<string, MessageM> GetHistory(uint? address)
|
||||
{
|
||||
return new Dictionary<string, MessageM>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.M
|
||||
{
|
||||
public class MessageM
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
<ItemsControl x:Class="Common.UI.Pages.Eregister.V.AddressItemsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.Pages.Eregister.VM">
|
||||
<ItemsControl.Resources>
|
||||
<Style x:Key="FocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="2"
|
||||
SnapsToDevicePixels="true"
|
||||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
|
||||
StrokeThickness="1"
|
||||
StrokeDashArray="1 2"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<SolidColorBrush x:Key="RadioButton.Static.Background" Color="Transparent"/>
|
||||
<SolidColorBrush x:Key="RadioButton.Static.Border" Color="Transparent"/>
|
||||
<Style x:Key="OptionMarkFocusVisual">
|
||||
<Setter Property="Control.Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate>
|
||||
<Rectangle Margin="0"
|
||||
SnapsToDevicePixels="true"
|
||||
Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
|
||||
StrokeThickness="1"
|
||||
StrokeDashArray="1 2"/>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<SolidColorBrush x:Key="RadioButton.MouseOver.Background" Color="WhiteSmoke"/>
|
||||
<SolidColorBrush x:Key="RadioButton.MouseOver.Border" Color="WhiteSmoke"/>
|
||||
<SolidColorBrush x:Key="RadioButton.Checked.Border" Color="LightGray"/>
|
||||
<Style x:Key="AddressButton" TargetType="{x:Type RadioButton}">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
|
||||
<Setter Property="Background" Value="{StaticResource RadioButton.Static.Background}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource RadioButton.Static.Border}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="GroupName" Value="addresses"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Margin" Value="0 0 0 1"/>
|
||||
<Setter Property="Padding" Value="21 3"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type RadioButton}">
|
||||
<Border x:Name="templateRoot"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
Margin="{TemplateBinding Margin}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<ContentPresenter x:Name="contentPresenter"
|
||||
ContentSource="Content"
|
||||
Grid.Column="1"
|
||||
Focusable="False"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Border}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="Background" TargetName="templateRoot" Value="{StaticResource RadioButton.MouseOver.Background}"/>
|
||||
<Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource RadioButton.Checked.Border}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ItemsControl.Resources>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:AddressVM}">
|
||||
<RadioButton Command="{Binding Selected}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{Binding Address}"
|
||||
Style="{StaticResource AddressButton}"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.V
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class AddressItemsControl : ItemsControl
|
||||
{
|
||||
public AddressItemsControl() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.VM
|
||||
{
|
||||
using System.Windows.Input;
|
||||
|
||||
public class AddressVM
|
||||
{
|
||||
public AddressVM(uint? address, ICommand selected)
|
||||
{
|
||||
this.Address = address;
|
||||
this.Selected = selected;
|
||||
}
|
||||
|
||||
public uint? Address { get; }
|
||||
|
||||
public ICommand Selected { get; }
|
||||
|
||||
public override string ToString()
|
||||
=> this.Address?.ToString();
|
||||
|
||||
public static implicit operator uint? (AddressVM vm) => vm?.Address;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.VM
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Pages.Eregister.M;
|
||||
using Common.UI.Pages.Eregister.M.Data;
|
||||
|
||||
internal class EregisterLocator
|
||||
{
|
||||
public HistoryVM HistoryVM
|
||||
{
|
||||
get
|
||||
{
|
||||
var connectionString = AppHost.GetSetting(EregisterSqlite.SQLiteConnectionStringKey);
|
||||
var eregisterSqlite = new EregisterSqlite(connectionString);
|
||||
var historyM = new HistoryM(eregisterSqlite);
|
||||
var historyVM = new HistoryVM(historyM);
|
||||
|
||||
return historyVM;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
namespace Common.UI.Pages.Eregister.VM
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Pages.Eregister.M;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
|
||||
internal class HistoryVM : VM<HistoryVM>
|
||||
{
|
||||
private readonly HistoryM historyM;
|
||||
|
||||
public HistoryVM(HistoryM historyM)
|
||||
{
|
||||
this.historyM = historyM;
|
||||
this.RefreshAddresses = new Command(this.LoadAddresses);
|
||||
this.ViewHistory = new Command<AddressVM>(this.ViewHistory_Command);
|
||||
this.Addresses = new ObservableCollection<AddressVM>();
|
||||
|
||||
this.LoadAddresses();
|
||||
}
|
||||
|
||||
private AddressVM address;
|
||||
public AddressVM Address
|
||||
{
|
||||
get => this.address;
|
||||
set => this.SetValue(x => x.address = value);
|
||||
}
|
||||
|
||||
public ICommand RefreshAddresses { get; }
|
||||
|
||||
public ICommand ViewHistory { get; }
|
||||
|
||||
public ObservableCollection<AddressVM> Addresses { get; }
|
||||
|
||||
private void LoadAddresses()
|
||||
{
|
||||
this.InvokeTaskAsync(() =>
|
||||
{
|
||||
foreach (var address in this.historyM.EnumerateAddresses())
|
||||
{
|
||||
var addressesCount = this.Addresses.Count;
|
||||
var addAddress = true;
|
||||
|
||||
for (var ix = 0; ix < addressesCount; ix++)
|
||||
{
|
||||
var _address = this.Addresses[ix];
|
||||
|
||||
if (address < _address)
|
||||
{
|
||||
this.Addresses.Insert(ix, new AddressVM(address, this.ViewHistory));
|
||||
|
||||
addAddress = false;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (address == _address)
|
||||
{
|
||||
addAddress = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (addAddress)
|
||||
{
|
||||
this.Addresses.Add(new AddressVM(address, this.ViewHistory));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ViewHistory_Command(AddressVM addressVM)
|
||||
{
|
||||
this.Address = addressVM;
|
||||
|
||||
var history = this.historyM.GetHistory(this.Address);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Controls:GridLayout Background="#FFF0F0F0" ItemsSource="{Binding ProgrammingTasks}" />
|
||||
<Controls:GridLayout ItemsSource="{Binding ProgrammingTasks}" />
|
||||
</ScrollViewer>
|
||||
<Border BorderBrush="Gray"
|
||||
BorderThickness="0, 1, 0, 0"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
using System.Windows.Media;
|
||||
using SystemTimer = System.Timers.Timer;
|
||||
|
||||
public class EregisterInitializeVM : VM<EregisterInitializeVM>
|
||||
@@ -89,7 +89,7 @@
|
||||
});
|
||||
|
||||
protected virtual void PrepareProgramming()
|
||||
{
|
||||
{
|
||||
if (!int.TryParse($"{Appsettings.GetSetting("PSNR")}", out var psnr))
|
||||
{
|
||||
MessageBox.Show("Prüfstationnummer ist nicht konfiguriert.", "Fehler");
|
||||
@@ -169,12 +169,9 @@
|
||||
|
||||
protected void UpdateUIProgrammingTasks(IEnumerable<IEnumerable<EregisterTask>> programmingTasksEnumerable)
|
||||
{
|
||||
var tasks = new List<GridItem>();
|
||||
var col = 0;
|
||||
var row = 0;
|
||||
var tasks = new List<GridItem>();
|
||||
|
||||
col = 0;
|
||||
row = 0;
|
||||
|
||||
foreach (var programmingTasks in programmingTasksEnumerable)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using System.Windows.Media;
|
||||
|
||||
public class GridItem : GridItem<GridItem>
|
||||
{
|
||||
public int Column { get; set; }
|
||||
@@ -17,4 +19,33 @@
|
||||
set => this.Set(() => this.label = value);
|
||||
}
|
||||
}
|
||||
|
||||
public class UIGridItem : GridItem
|
||||
{
|
||||
private Brush foregroundColor;
|
||||
public Brush ForegroundColor
|
||||
{
|
||||
get => this.foregroundColor;
|
||||
set => this.Set(() => this.foregroundColor = value);
|
||||
}
|
||||
|
||||
private Brush backgroundColor;
|
||||
public Brush BackgroundColor
|
||||
{
|
||||
get => this.backgroundColor;
|
||||
set => this.Set(() => this.backgroundColor = value);
|
||||
}
|
||||
|
||||
private Brush borderColor;
|
||||
public Brush BorderColor
|
||||
{
|
||||
get => this.borderColor;
|
||||
set => this.Set(() => this.borderColor = value);
|
||||
}
|
||||
}
|
||||
|
||||
public class TaskGridItem : UIGridItem
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user