sync before adding submodules
This commit is contained in:
@@ -8,44 +8,27 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
foreach (var property in typeof(Pam).GetFields(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
Console.WriteLine($"{property.Name}: {property.GetValue(null)}");
|
||||
}
|
||||
var client = new SIRTClient("COM6");
|
||||
|
||||
//var client = new SIRTClient("COM6");
|
||||
|
||||
//client.OpenConnection();
|
||||
//Console.ReadKey();
|
||||
//client.CloseConnection();
|
||||
client.OpenConnection();
|
||||
Console.ReadKey();
|
||||
client.CloseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
public class SIRTClient
|
||||
{
|
||||
private readonly ConcurrentDictionary<uint, EregisterTask> activateable;
|
||||
private readonly ConcurrentDictionary<uint, EregisterTask> tasks;
|
||||
private readonly SIRTBroadcaster broadcaster;
|
||||
|
||||
public SIRTClient(string comPort)
|
||||
{
|
||||
this.activateable = new ConcurrentDictionary<uint, EregisterTask>(new Dictionary<uint, EregisterTask>
|
||||
{
|
||||
// 433
|
||||
{ 875770417, null },
|
||||
{ 4291267283, null },
|
||||
{ 4291317405, null },
|
||||
// 868
|
||||
// { 4291631647, null },
|
||||
});
|
||||
this.tasks = new ConcurrentDictionary<uint, EregisterTask>();
|
||||
this.broadcaster = new SIRTBroadcaster(comPort);
|
||||
this.broadcaster.Activated += this.Broadcaster_Activated;
|
||||
@@ -55,59 +38,46 @@
|
||||
this.broadcaster.MessageReceived += this.Broadcaster_MessageReceived;
|
||||
}
|
||||
|
||||
internal void CloseConnection()
|
||||
{
|
||||
this.broadcaster.Close();
|
||||
}
|
||||
internal void CloseConnection() => this.broadcaster.Close();
|
||||
|
||||
internal void OpenConnection()
|
||||
{
|
||||
this.broadcaster.Open();
|
||||
}
|
||||
internal void OpenConnection() => this.broadcaster.Open();
|
||||
|
||||
private void Broadcaster_Activated()
|
||||
{
|
||||
Console.WriteLine(nameof(Broadcaster_Activated));
|
||||
|
||||
foreach (var kvp in this.activateable)
|
||||
this.tasks.GetOrAdd(4291796386, _ =>
|
||||
{
|
||||
this.tasks.GetOrAdd(kvp.Key, _ =>
|
||||
var task = new EregisterTask(868)
|
||||
{
|
||||
var task = new EregisterTask(433, 3000)
|
||||
Cmd = SIRTMessage.W_PAM,
|
||||
P1 = new P811
|
||||
{
|
||||
Cmd = SIRTMessage.W_PAM,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
Data = new OpticalTelegram
|
||||
{
|
||||
Minutes = 1
|
||||
}.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
}),
|
||||
RequestAddress = kvp.Key
|
||||
};
|
||||
DelPamSemi = true,
|
||||
},
|
||||
Data = new ChangeRadioId
|
||||
{
|
||||
Address = 309030150
|
||||
|
||||
task.Completed += this.Task_Completed;
|
||||
}.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
}),
|
||||
RequestAddress = 4291796386,
|
||||
ResponseAddress = 309030150
|
||||
};
|
||||
|
||||
this.broadcaster.EnqueueTask(task);
|
||||
task.Completed += this.Task_Completed;
|
||||
|
||||
return task;
|
||||
});
|
||||
}
|
||||
this.broadcaster.EnqueueTask(task);
|
||||
|
||||
return task;
|
||||
});
|
||||
}
|
||||
|
||||
private void Broadcaster_Connected()
|
||||
{
|
||||
Console.WriteLine(nameof(Broadcaster_Connected));
|
||||
}
|
||||
private void Broadcaster_Connected() => Console.WriteLine(nameof(Broadcaster_Connected));
|
||||
|
||||
private void Broadcaster_Disconnected()
|
||||
{
|
||||
Console.WriteLine(nameof(Broadcaster_Disconnected));
|
||||
}
|
||||
private void Broadcaster_Disconnected() => Console.WriteLine(nameof(Broadcaster_Disconnected));
|
||||
|
||||
private void Broadcaster_Logging(string message)
|
||||
{
|
||||
|
||||
@@ -139,6 +139,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveConnection()
|
||||
{
|
||||
this.Close();
|
||||
serialPorts.TryRemove(this.COMPort, out _);
|
||||
}
|
||||
|
||||
public void Write(byte[] bytes)
|
||||
{
|
||||
var sp = this.GetOpenSP();
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
|
||||
public partial class SIRTBroadcaster
|
||||
{
|
||||
private readonly ConcurrentDictionary<uint, ConcurrentQueue<SIRTTask>> tasks;
|
||||
private readonly ManualResetEventSlim processingWaitHandle;
|
||||
private readonly ConcurrentDictionary<uint, ConcurrentQueue<SIRTTask>> tasks
|
||||
= new ConcurrentDictionary<uint, ConcurrentQueue<SIRTTask>>();
|
||||
private readonly SerialPort serialPort;
|
||||
|
||||
private CancellationTokenSource cancellationTokenSource;
|
||||
private CancellationToken cancellationToken;
|
||||
private Task processingTask;
|
||||
|
||||
private void ActivateSIRT()
|
||||
{
|
||||
@@ -33,12 +34,20 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.Logging?.Invoke($"SIRT on {this.COMPort} not identified.");
|
||||
this.Logging?.Invoke($"SIRT on {this.COMPort} not identified.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// this.Logging?.Invoke($"SIRT on {this.COMPort} not activated.");
|
||||
this.Logging?.Invoke($"SIRT on {this.COMPort} not activated.");
|
||||
}
|
||||
}
|
||||
|
||||
private void ExceptionLogging(Task task)
|
||||
{
|
||||
if (task.Exception != null)
|
||||
{
|
||||
this.Logging?.Invoke(task.Exception.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,26 +81,25 @@
|
||||
|
||||
private void OnStateChanged(SIRTTask task)
|
||||
{
|
||||
this.TaskRemoveEventHandlers(task);
|
||||
|
||||
if (task.State == SIRTTaskState.Completed)
|
||||
{
|
||||
if (this.tasks.TryGetValue(task.RequestAddress, out var requestTasks))
|
||||
if (this.tasks.TryGetValue(task.RequestAddress, out var tasks) && tasks.TryPeek(out var _task) && _task.State == SIRTTaskState.Completed)
|
||||
{
|
||||
if (requestTasks.TryDequeue(out var _))
|
||||
{
|
||||
this.TaskRemoveEventHandlers(task);
|
||||
}
|
||||
tasks.TryDequeue(out _task);
|
||||
}
|
||||
else if (this.tasks.TryGetValue(task.ResponseAddress, out var responseTasks))
|
||||
|
||||
if (task.RequestAddress != task.ResponseAddress)
|
||||
{
|
||||
if (responseTasks.TryDequeue(out var _))
|
||||
if (this.tasks.TryGetValue(task.ResponseAddress, out tasks) && tasks.TryPeek(out _task) && _task.State == SIRTTaskState.Completed)
|
||||
{
|
||||
this.TaskRemoveEventHandlers(task);
|
||||
tasks.TryDequeue(out _task);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (task.State == SIRTTaskState.Cancelled)
|
||||
{
|
||||
this.TaskRemoveEventHandlers(task);
|
||||
this.OnTaskTimeout(task);
|
||||
}
|
||||
}
|
||||
@@ -105,24 +113,17 @@
|
||||
this.TryRun(deleteResponseAddress);
|
||||
}
|
||||
|
||||
private void OnTaskUpdated(SIRTTask task)
|
||||
{
|
||||
if (this.tasks.TryGetValue(task.RequestAddress, out var tasksQueue))
|
||||
{
|
||||
foreach (var _task in tasksQueue.AsEnumerable())
|
||||
{
|
||||
_task.UpdateFrom(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SerialPort_Connected()
|
||||
{
|
||||
this.cancellationTokenSource = new CancellationTokenSource();
|
||||
this.cancellationToken = this.cancellationTokenSource.Token;
|
||||
|
||||
Task.Factory.StartNew(this.StartReadingMessages, this.cancellationToken);
|
||||
Task.Factory.StartNew(this.ActivateSIRT, this.cancellationToken);
|
||||
Task.Factory
|
||||
.StartNew(this.StartReadingMessages, this.cancellationToken)
|
||||
.ContinueWith(this.ExceptionLogging);
|
||||
Task.Factory
|
||||
.StartNew(this.ActivateSIRT, this.cancellationToken)
|
||||
.ContinueWith(this.ExceptionLogging);
|
||||
|
||||
this.Connected?.Invoke();
|
||||
}
|
||||
@@ -141,10 +142,7 @@
|
||||
this.Disconnected?.Invoke();
|
||||
}
|
||||
|
||||
private void SerialPort_Logging(string e)
|
||||
{
|
||||
//this.Logging?.Invoke(e);
|
||||
}
|
||||
private void SerialPort_Logging(string e) => this.Logging?.Invoke(e);
|
||||
|
||||
private void SIRTConnection_MessageReceived(SIRTMessage message)
|
||||
{
|
||||
@@ -160,40 +158,38 @@
|
||||
|
||||
private void StartProcessingTasksAsync()
|
||||
{
|
||||
Task.Factory.StartNew(async state =>
|
||||
this.processingTask = Task.Factory.StartNew(() =>
|
||||
{
|
||||
var connection = state as SIRTBroadcaster;
|
||||
var totalTasksCount = 0;
|
||||
var manualResetEventSlim = new ManualResetEventSlim();
|
||||
var addresses = default(ICollection<uint>);
|
||||
|
||||
while (!connection.cancellationToken.IsCancellationRequested)
|
||||
while (!this.cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
totalTasksCount = 0;
|
||||
// addresses = this.GetAddressesInPamPool();
|
||||
|
||||
foreach (var tasksQueue in connection.tasks.Values.ToArray())
|
||||
foreach (var tasksQueue in this.tasks.Values.ToArray())
|
||||
{
|
||||
totalTasksCount += tasksQueue.Count;
|
||||
|
||||
if (tasksQueue.TryPeek(out var task) && task.State == SIRTTaskState.Pending)
|
||||
{
|
||||
connection.serialPort.Write(task.Start());
|
||||
this.Logging?.Invoke(task.ToString());
|
||||
// if (addresses.Count < 5 && !addresses.Any(x => x == task.RequestAddress) && !addresses.Any(x => x == task.ResponseAddress))
|
||||
{
|
||||
this.serialPort.Write(task.Start());
|
||||
this.Logging?.Invoke(task.ToString());
|
||||
|
||||
// addresses.Add(task.RequestAddress);
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(50);
|
||||
manualResetEventSlim.Wait(100);
|
||||
manualResetEventSlim.Reset();
|
||||
}
|
||||
|
||||
if (totalTasksCount <= 0)
|
||||
{
|
||||
this.processingWaitHandle.Wait();
|
||||
this.processingWaitHandle.Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(100);
|
||||
}
|
||||
manualResetEventSlim.Wait(100);
|
||||
manualResetEventSlim.Reset();
|
||||
}
|
||||
|
||||
}, this, this.cancellationToken);
|
||||
}, this.cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current)
|
||||
.ContinueWith(this.ExceptionLogging);
|
||||
}
|
||||
|
||||
private void StartReadingMessages()
|
||||
@@ -266,7 +262,6 @@
|
||||
task.Cancelled += this.OnStateChanged;
|
||||
task.Completed += this.OnStateChanged;
|
||||
task.Timeouted += this.OnTaskTimeout;
|
||||
task.Updated += this.OnTaskUpdated;
|
||||
}
|
||||
|
||||
private void TaskRemoveEventHandlers(SIRTTask task)
|
||||
@@ -274,7 +269,6 @@
|
||||
task.Cancelled -= this.OnStateChanged;
|
||||
task.Completed -= this.OnStateChanged;
|
||||
task.Timeouted -= this.OnTaskTimeout;
|
||||
task.Updated -= this.OnTaskUpdated;
|
||||
}
|
||||
|
||||
private bool TryRun<TTask>(TTask task) where TTask : SIRTTask
|
||||
@@ -301,7 +295,6 @@
|
||||
task.Completed += taskStateChanged;
|
||||
|
||||
this.serialPort.Write(task.Start());
|
||||
// this.Logging?.Invoke(task.ToString());
|
||||
manualResetEventSlim.Wait(task.Timeout);
|
||||
manualResetEventSlim.Reset();
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
|
||||
using Parity = System.IO.Ports.Parity;
|
||||
using StopBits = System.IO.Ports.StopBits;
|
||||
@@ -15,7 +14,6 @@
|
||||
{
|
||||
this.serialPort = new SerialPort(comPort, 115200, Parity.None, 8, StopBits.One);
|
||||
this.tasks = new ConcurrentDictionary<uint, ConcurrentQueue<SIRTTask>>();
|
||||
this.processingWaitHandle = new ManualResetEventSlim();
|
||||
}
|
||||
|
||||
public event Action Activated;
|
||||
@@ -82,12 +80,10 @@
|
||||
{
|
||||
this.tasks.AddOrUpdate(task.ResponseAddress, requestTasks, (_, _requestTasks) => _requestTasks);
|
||||
}
|
||||
|
||||
if (!this.processingWaitHandle.IsSet)
|
||||
{
|
||||
this.processingWaitHandle.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveConnection()
|
||||
=> this.serialPort.RemoveConnection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,25 +44,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
public SIRTBroadcaster ConnectSIRT(string comPort)
|
||||
public void ConnectSIRT(string portName, Action<SIRTBroadcaster> callback)
|
||||
{
|
||||
if (!this.connections.TryGetValue(comPort, out var connection))
|
||||
if (!this.connections.TryGetValue(portName, out var broadcaster))
|
||||
{
|
||||
connection = new SIRTBroadcaster(comPort);
|
||||
broadcaster = new SIRTBroadcaster(portName);
|
||||
broadcaster.Logging += message => this.Logging?.Invoke(message);
|
||||
|
||||
if (this.connections.TryAdd(comPort, connection))
|
||||
if (!this.connections.TryAdd(portName, broadcaster))
|
||||
{
|
||||
connection.Logging += message => this.Logging?.Invoke(message);
|
||||
connection.Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
connection = null;
|
||||
this.Logging?.Invoke($"Cann't connect SIRT to {comPort}");
|
||||
broadcaster = null;
|
||||
}
|
||||
}
|
||||
|
||||
return connection;
|
||||
callback(broadcaster);
|
||||
broadcaster?.Close();
|
||||
broadcaster?.Open();
|
||||
}
|
||||
|
||||
public void EnqueueTask(SIRTTask task)
|
||||
@@ -73,8 +70,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetPortNames() => this.connections.Keys.ToArray();
|
||||
public IEnumerable<string> GetPortNames()
|
||||
=> this.connections.Keys.ToArray();
|
||||
|
||||
private IEnumerable<SIRTBroadcaster> GetConnections() => this.connections.Values.ToArray();
|
||||
public void RemoveConnections()
|
||||
{
|
||||
foreach (var key in this.connections.Keys.ToArray())
|
||||
{
|
||||
if (this.connections.TryRemove(key, out var broadcaster))
|
||||
{
|
||||
broadcaster.RemoveConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<SIRTBroadcaster> GetConnections()
|
||||
=> this.connections.Values.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
public event Action<SIRTTask> Completed;
|
||||
public event Action<SIRTTask> Cancelled;
|
||||
public event Action<SIRTTask> Timeouted;
|
||||
public event Action<SIRTTask> Updated;
|
||||
|
||||
public byte Cmd
|
||||
{
|
||||
@@ -76,48 +75,25 @@
|
||||
{
|
||||
if (this.State == SIRTTaskState.Cancelled)
|
||||
{
|
||||
return;
|
||||
this.NotifyCancelled();
|
||||
}
|
||||
|
||||
this.responses.Push(response);
|
||||
|
||||
if (response.Length >= 13)
|
||||
else
|
||||
{
|
||||
var responseAddress = response.Address;
|
||||
|
||||
if (responseAddress != this.RequestAddress)
|
||||
{
|
||||
var requestAddress = this.RequestAddress;
|
||||
this.RequestAddress = this.ResponseAddress;
|
||||
this.ResponseAddress = requestAddress;
|
||||
|
||||
this.NotifyUpdated();
|
||||
}
|
||||
this.responses.Push(response);
|
||||
this.ProcessResponse(response);
|
||||
}
|
||||
|
||||
this.ProcessResponse(response);
|
||||
}
|
||||
|
||||
public virtual byte[] ToByteArray() => this.request.ToByteArray();
|
||||
|
||||
public override string ToString() => BitConverter.ToString(this.ToByteArray());
|
||||
|
||||
public virtual void UpdateFrom(SIRTTask task)
|
||||
{
|
||||
this.P1 = task.P1;
|
||||
this.P2 = task.P2;
|
||||
this.RequestAddress = task.RequestAddress;
|
||||
this.ResponseAddress = task.ResponseAddress;
|
||||
}
|
||||
|
||||
protected void NotifyCancelled() => this.Cancelled?.Invoke(this);
|
||||
|
||||
protected void NotifyCompleted() => this.Completed?.Invoke(this);
|
||||
|
||||
protected void NotifyTimeouted() => this.Timeouted?.Invoke(this);
|
||||
|
||||
protected void NotifyUpdated() => this.Updated?.Invoke(this);
|
||||
|
||||
protected virtual void OnTimeout(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
this.State = SIRTTaskState.Cancelled;
|
||||
|
||||
+1
-2
@@ -58,11 +58,10 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Attributes\EregisterFeatureAttribute.cs" />
|
||||
<Compile Include="Eregister.cs" />
|
||||
<Compile Include="EregisterBatch.cs" />
|
||||
<Compile Include="EregisterFactory.cs" />
|
||||
<Compile Include="EregisterCheckFinalizationTask.cs" />
|
||||
<Compile Include="EregisterCheckInitializationTask.cs" />
|
||||
<Compile Include="EregisterExtensions.cs" />
|
||||
<Compile Include="EregisterCheckStateTask.cs" />
|
||||
<Compile Include="EregisterTask.cs" />
|
||||
<Compile Include="Features\ActivateMetrologyTestMode.cs" />
|
||||
<Compile Include="Features\AlarmPersistence.cs" />
|
||||
|
||||
+107
-76
@@ -2,80 +2,88 @@
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
public class Eregister
|
||||
{
|
||||
private readonly EregisterFeatures features;
|
||||
private readonly ConcurrentQueue<EregisterTask> runningTasks;
|
||||
private readonly EregisterProgrammingParameters parameters;
|
||||
private readonly Action<SIRTTask> enqueueTask;
|
||||
private readonly Queue<EregisterTask> runningTasks;
|
||||
private readonly Queue<EregisterTask> completedTasks;
|
||||
|
||||
public Eregister(EregisterFeatures features, Action<SIRTTask> enqueueTask)
|
||||
public Eregister(EregisterProgrammingParameters parameters, Action<SIRTTask> enqueueTask)
|
||||
{
|
||||
this.features = features;
|
||||
this.parameters = parameters;
|
||||
this.enqueueTask = enqueueTask;
|
||||
this.runningTasks = new Queue<EregisterTask>();
|
||||
this.completedTasks = new Queue<EregisterTask>();
|
||||
this.runningTasks = new ConcurrentQueue<EregisterTask>();
|
||||
}
|
||||
|
||||
public uint Address => this.features?.RequestAddress ?? 4291189262;
|
||||
public uint Address => this.parameters?.RequestAddress ?? 4291189262;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
this.runningTasks.Clear();
|
||||
this.completedTasks.Clear();
|
||||
while (this.runningTasks.TryDequeue(out var _))
|
||||
{
|
||||
// Just dequeue all tasks
|
||||
}
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterTask> LoadCustomTasks(EregisterProgrammingParameters parameters)
|
||||
internal IEnumerable<EregisterTask> LoadCustomTasks()
|
||||
{
|
||||
this.LoadProgrammingParameters();
|
||||
var features = parameters.LoadCustomFeatures();
|
||||
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterTask> LoadInspectionFinalizationTasks(EregisterProgrammingParameters parameters)
|
||||
internal IEnumerable<EregisterTask> LoadInspectionFinalizationTasks()
|
||||
{
|
||||
this.LoadProgrammingParameters();
|
||||
var features = parameters.LoadInspectionFinalizationFeatures();
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(parameters, this.features.Frequency)
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckFinalizationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
SlotNr = this.features.SlotNr,
|
||||
PoNr = this.features.PoNr,
|
||||
SerialNr = this.features.SerialNr,
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
RequestAddress = this.features.RequestAddress,
|
||||
ResponseAddress = this.features.ResponseAddress,
|
||||
EncryptionKey = this.features.EncryptionKey
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey
|
||||
});
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
}
|
||||
|
||||
internal IEnumerable<EregisterTask> LoadInspectionInitializationTasks(EregisterProgrammingParameters parameters)
|
||||
internal IEnumerable<EregisterTask> LoadInspectionInitializationTasks()
|
||||
{
|
||||
this.LoadProgrammingParameters();
|
||||
var features = parameters.LoadInspectionInitializationFeatures();
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckInitializationTask(parameters, this.features.Frequency)
|
||||
this.LoadProgrammingParameters(features);
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckInitializationTask(this.parameters, features.Frequency)
|
||||
{
|
||||
SlotNr = this.features.SlotNr,
|
||||
PoNr = this.features.PoNr,
|
||||
SerialNr = this.features.SerialNr,
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
RequestAddress = this.features.RequestAddress,
|
||||
ResponseAddress = this.features.ResponseAddress,
|
||||
EncryptionKey = this.features.EncryptionKey
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey
|
||||
});
|
||||
|
||||
return this.runningTasks.AsEnumerable();
|
||||
@@ -85,87 +93,110 @@
|
||||
{
|
||||
var manualResetEventSlim = new ManualResetEventSlim();
|
||||
|
||||
void Completed(SIRTTask _task)
|
||||
void CompletedOrCancelled(SIRTTask task)
|
||||
{
|
||||
if (_task is EregisterTask task)
|
||||
task.Completed -= CompletedOrCancelled;
|
||||
task.Cancelled -= CompletedOrCancelled;
|
||||
|
||||
if (task is EregisterTask _task)
|
||||
{
|
||||
task.Completed -= Completed;
|
||||
task.Cancelled -= Cancelled;
|
||||
}
|
||||
|
||||
if (this.runningTasks.Count > 0)
|
||||
{
|
||||
task = this.runningTasks.Dequeue();
|
||||
|
||||
this.completedTasks.Enqueue(task);
|
||||
|
||||
if (this.runningTasks.Count == 0)
|
||||
foreach (var etask in this.runningTasks)
|
||||
{
|
||||
manualResetEventSlim.Set();
|
||||
if (etask.State != SIRTTaskState.Cancelled && etask.State != SIRTTaskState.Completed)
|
||||
{
|
||||
etask.Mode = _task.Mode;
|
||||
etask.IsEncrypted = _task.IsEncrypted;
|
||||
etask.RequestAddress = _task.RequestAddress;
|
||||
etask.ResponseAddress = _task.ResponseAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Cancelled(SIRTTask _task)
|
||||
{
|
||||
if (_task is EregisterTask task)
|
||||
{
|
||||
task.Completed -= Completed;
|
||||
task.Cancelled -= Cancelled;
|
||||
}
|
||||
|
||||
manualResetEventSlim.Set();
|
||||
}
|
||||
|
||||
foreach (var task in this.runningTasks.AsEnumerable())
|
||||
while (this.runningTasks.TryPeek(out var task))
|
||||
{
|
||||
task.Completed += Completed;
|
||||
task.Cancelled += Cancelled;
|
||||
task.Completed += CompletedOrCancelled;
|
||||
task.Cancelled += CompletedOrCancelled;
|
||||
|
||||
this.enqueueTask(task);
|
||||
}
|
||||
|
||||
manualResetEventSlim.Wait();
|
||||
manualResetEventSlim.Reset();
|
||||
manualResetEventSlim.Wait();
|
||||
manualResetEventSlim.Reset();
|
||||
|
||||
if (task.State == SIRTTaskState.Completed)
|
||||
{
|
||||
this.runningTasks.TryDequeue(out task);
|
||||
}
|
||||
else if (task.State == SIRTTaskState.Cancelled)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadProgrammingParameters()
|
||||
private void LoadProgrammingParameters(EregisterFeatures features)
|
||||
{
|
||||
this.runningTasks.Clear();
|
||||
this.Clear();
|
||||
|
||||
var frequency = this.features.Frequency;
|
||||
var frequency = this.parameters.Frequency;
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterCheckStateTask(frequency)
|
||||
this.runningTasks.Enqueue(new EregisterTask(frequency)
|
||||
{
|
||||
SlotNr = this.features.SlotNr,
|
||||
PoNr = this.features.PoNr,
|
||||
SerialNr = this.features.SerialNr,
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
WakeUpCmd = true,
|
||||
},
|
||||
RequestAddress = this.features.RequestAddress,
|
||||
ResponseAddress = this.features.ResponseAddress,
|
||||
EncryptionKey = this.features.EncryptionKey
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Dummy PAM"
|
||||
});
|
||||
|
||||
this.runningTasks.Enqueue(new EregisterTask(frequency)
|
||||
{
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
Data = new OpticalTelegram
|
||||
{
|
||||
Minutes = 0
|
||||
}
|
||||
.Append(new ProvidePin
|
||||
{
|
||||
AuthLevel = AuthLevel.III
|
||||
}),
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
EncryptionKey = features.EncryptionKey,
|
||||
Name = "Get Debug"
|
||||
});
|
||||
|
||||
foreach (var pam in this.features.BuildPamsFull())
|
||||
foreach (var pam in features.BuildPams())
|
||||
{
|
||||
this.runningTasks.Enqueue(new EregisterTask(frequency)
|
||||
{
|
||||
SlotNr = this.features.SlotNr,
|
||||
PoNr = this.features.PoNr,
|
||||
SerialNr = this.features.SerialNr,
|
||||
SlotNr = features.SlotNr,
|
||||
PoNr = features.PoNr,
|
||||
SerialNr = features.SerialNr,
|
||||
Name = pam.Key,
|
||||
P1 = new P811
|
||||
{
|
||||
DelPamSemi = true,
|
||||
},
|
||||
RequestAddress = this.features.RequestAddress,
|
||||
ResponseAddress = this.features.ResponseAddress,
|
||||
RequestAddress = features.RequestAddress,
|
||||
ResponseAddress = features.ResponseAddress,
|
||||
Data = pam.Value,
|
||||
EncryptionKey = this.features.EncryptionKey
|
||||
EncryptionKey = features.EncryptionKey
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -110,10 +110,10 @@
|
||||
{
|
||||
VolumePerLedPulse = this.DEBUG.VolumePerLedPulse,
|
||||
VolumePerPulse = this.DEBUG.VolumePerPulse,
|
||||
OffsetFactor = (byte)this.DEBUG.OffsetFactor, // TODO: normalize debug or parameter value
|
||||
OffsetFactor = (byte)this.DEBUG.OffsetFactor,
|
||||
OffsetTime = this.DEBUG.OffsetTime,
|
||||
FactoryCalibration = (byte)(this.DEBUG.FactoryCalibration * 10), // TODO: normalize debug or parameter value
|
||||
UnitsOfMessureSEMI = (byte)this.SEMI.Units, // TODO: normalize debug or parameter value
|
||||
FactoryCalibration = (byte)(this.DEBUG.FactoryCalibration * 10),
|
||||
UnitsOfMessureSEMI = (byte)this.SEMI.Units,
|
||||
MeterSize = this.SEMI.MeterSize,
|
||||
Alarm_Backflow = alarms.Backflow,
|
||||
Alarm_Broken_Pipe = alarms.BrokenPipe,
|
||||
@@ -159,7 +159,7 @@
|
||||
FDR_Time_Of_Maximum_Flow = fdrLogContent.TimeOfMaximumFlow,
|
||||
FDR_Time_Of_Minimum_Flow = fdrLogContent.TimeOfMinimumFlow,
|
||||
FDR_Time_Of_Peak_Flow = fdrLogContent.TimeOfPeakFlow,
|
||||
TransmissionIntervalFinalization = (byte)this.SEMI.TransmissionInterval, // TODO: normalize debug or parameter value
|
||||
TransmissionIntervalFinalization = (byte)this.SEMI.TransmissionInterval,
|
||||
LATWindowsFinalization = this.SEMI.LATInterval,
|
||||
MBusStatus = this.SEMI.MBusStatus,
|
||||
Adresse = this.SEMI.Address,
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
this.parameters = parameters;
|
||||
this.pendingState = SIRTTaskState.Completed;
|
||||
this.Name = "Initial Check";
|
||||
this.Data = new OpticalTelegram { Minutes = 0, } // parameters.LED_On_Minutes }
|
||||
this.Data = new OpticalTelegram { Minutes = parameters.LED_On_Minutes }
|
||||
.Append(new ProvidePin { AuthLevel = AuthLevel.III });
|
||||
}
|
||||
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
namespace Common.Hardware.WaterMeter.eRegister
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister.Telegrams;
|
||||
|
||||
public class EregisterCheckStateTask : EregisterTask
|
||||
{
|
||||
public EregisterCheckStateTask(int frequency)
|
||||
: base(frequency)
|
||||
=> this.Name = "Check State";
|
||||
|
||||
protected override void ProcessResponse(SIRTMessage response)
|
||||
{
|
||||
base.ProcessResponse(response);
|
||||
|
||||
if (this.SEMI != null)
|
||||
{
|
||||
var isEncrypted = this.IsEncrypted;
|
||||
this.IsEncrypted = this.SEMI.PAMStatus == PAMStatus.OK && this.SEMI.Crc != 0;
|
||||
|
||||
if (this.IsEncrypted != isEncrypted)
|
||||
{
|
||||
var data = response.Data.DecryptResponse(this.EncryptionKey);
|
||||
this.SEMI = new SEMI(data, this.Frequency, response.P1);
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
|
||||
this.NotifyTelegram(this.SEMI);
|
||||
this.NotifyUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -93,7 +93,7 @@
|
||||
.Select(auth => new
|
||||
{
|
||||
Name = $"{string.Join(", ", auth.Value.OrderBy(x => x[0]).Select(x => $"{x[0]}"))}",
|
||||
Cmd = auth.Value.OrderBy(x => x[0]).SelectMany(x => x).ToList(),
|
||||
Cmd = auth.Value.OrderByDescending(x => x[0]).SelectMany(x => x).ToList(),
|
||||
AuthLvl = auth.Key.AuthBytes()
|
||||
})
|
||||
// Single pams
|
||||
@@ -190,7 +190,7 @@
|
||||
}
|
||||
|
||||
var sortedPams = pamList
|
||||
.OrderBy(x => x.Value[0])
|
||||
.OrderByDescending(x => x.Value[0])
|
||||
.ToList();
|
||||
var sortedDebugs = debugList
|
||||
.OrderByDescending(x => x.Value[2])
|
||||
|
||||
+14
-17
@@ -8,12 +8,12 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class EregisterBatch
|
||||
public class EregisterFactory
|
||||
{
|
||||
private readonly SIRTFactory sirtFactory;
|
||||
private readonly ICollection<Eregister> eregisters;
|
||||
|
||||
public EregisterBatch(SIRTFactory broadcaster)
|
||||
public EregisterFactory(SIRTFactory broadcaster)
|
||||
{
|
||||
this.sirtFactory = broadcaster;
|
||||
this.eregisters = new List<Eregister>();
|
||||
@@ -25,14 +25,13 @@
|
||||
|
||||
foreach (var parameters in parametersList)
|
||||
{
|
||||
var features = parameters.LoadCustomFeatures();
|
||||
var eregister = new Eregister(features, this.sirtFactory.EnqueueTask);
|
||||
var eregister = new Eregister(parameters, this.sirtFactory.EnqueueTask);
|
||||
|
||||
this.sirtFactory.DequeueTasks(features.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(features.ResponseAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.ResponseAddress);
|
||||
this.eregisters.Add(eregister);
|
||||
|
||||
yield return eregister.LoadCustomTasks(parameters);
|
||||
yield return eregister.LoadCustomTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +41,13 @@
|
||||
|
||||
foreach (var parameters in parametersList)
|
||||
{
|
||||
var features = parameters.LoadInspectionFinalizationFeatures();
|
||||
var eregister = new Eregister(features, this.sirtFactory.EnqueueTask);
|
||||
var eregister = new Eregister(parameters, this.sirtFactory.EnqueueTask);
|
||||
|
||||
this.sirtFactory.DequeueTasks(features.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(features.ResponseAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.ResponseAddress);
|
||||
this.eregisters.Add(eregister);
|
||||
|
||||
yield return eregister.LoadInspectionFinalizationTasks(parameters);
|
||||
yield return eregister.LoadInspectionFinalizationTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +57,13 @@
|
||||
|
||||
foreach (var parameters in parametersList)
|
||||
{
|
||||
var features = parameters.LoadInspectionInitializationFeatures();
|
||||
var eregister = new Eregister(features, this.sirtFactory.EnqueueTask);
|
||||
var eregister = new Eregister(parameters, this.sirtFactory.EnqueueTask);
|
||||
|
||||
this.sirtFactory.DequeueTasks(features.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(features.ResponseAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.RequestAddress);
|
||||
this.sirtFactory.DequeueTasks(parameters.ResponseAddress);
|
||||
this.eregisters.Add(eregister);
|
||||
|
||||
yield return eregister.LoadInspectionInitializationTasks(parameters);
|
||||
yield return eregister.LoadInspectionInitializationTasks();
|
||||
}
|
||||
}
|
||||
|
||||
+56
-74
@@ -1,5 +1,6 @@
|
||||
namespace Common.Hardware.WaterMeter.eRegister
|
||||
{
|
||||
using Common.Hardware.Ports;
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.SIRT.Parameters;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
@@ -11,7 +12,9 @@
|
||||
|
||||
public class EregisterTask : SIRTTask
|
||||
{
|
||||
public EregisterTask(int frequency, int timeout = 6_000)
|
||||
private int countFailures;
|
||||
|
||||
public EregisterTask(int frequency, int timeout = 5_000)
|
||||
: base(frequency, timeout)
|
||||
{
|
||||
this.Cmd = SIRTMessage.W_PAM;
|
||||
@@ -52,34 +55,18 @@
|
||||
|
||||
public byte[] EncryptionKey { get; set; }
|
||||
|
||||
public StateModes Mode { get; set; }
|
||||
|
||||
public override void UpdateFrom(SIRTTask task)
|
||||
{
|
||||
base.UpdateFrom(task);
|
||||
|
||||
if (task is EregisterTask etask)
|
||||
{
|
||||
this.Mode = etask.Mode;
|
||||
this.IsEncrypted = etask.IsEncrypted;
|
||||
|
||||
if (this.Mode == StateModes.Shipment)
|
||||
{
|
||||
this.Data = new EregisterAvailableParametersParser(this.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
public FactoryState Mode { get; set; }
|
||||
|
||||
public override byte[] ToByteArray()
|
||||
{
|
||||
var data = this.request.Data;
|
||||
|
||||
// if (this.SEMI?.PAMStatus?.WRONG_AUTH == true || this.Mode == StateModes.Shipment)
|
||||
if (this.Mode == FactoryState.Shipment)
|
||||
{
|
||||
data = new EregisterAvailableParametersParser(data);
|
||||
}
|
||||
|
||||
if (this.IsEncrypted || this.Mode == StateModes.Shipment)
|
||||
if (this.IsEncrypted)
|
||||
{
|
||||
data = data.EncryptRequest(this.EncryptionKey, this.RequestAddress);
|
||||
}
|
||||
@@ -97,9 +84,9 @@
|
||||
|
||||
protected override void OnTimeout(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
this.NotifyTimeouted();
|
||||
|
||||
this.State = SIRTTaskState.Pending;
|
||||
|
||||
this.NotifyTimeouted();
|
||||
}
|
||||
|
||||
protected override void ProcessResponse(SIRTMessage response)
|
||||
@@ -111,23 +98,37 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (response.Address != this.RequestAddress)
|
||||
{
|
||||
var requestAddress = this.RequestAddress;
|
||||
this.RequestAddress = this.ResponseAddress;
|
||||
this.ResponseAddress = requestAddress;
|
||||
}
|
||||
|
||||
if (response.Cmd == SIRTMessage.FROMAIR)
|
||||
{
|
||||
var data = response.Data;
|
||||
var dataLength = data?.Length ?? 0;
|
||||
|
||||
this.P11 = new P11(response.P1);
|
||||
this.RSSI = new RSSI(response.P2, (ushort)this.Frequency);
|
||||
|
||||
if (dataLength > 0)
|
||||
var data = response.Data;
|
||||
var length = data.Length;
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
var type = data[0];
|
||||
if (!this.IsEncrypted)
|
||||
{
|
||||
var crc = data.ToUInt16BE(length - 2);
|
||||
|
||||
this.IsEncrypted = crc != 0;
|
||||
}
|
||||
|
||||
if (this.IsEncrypted)
|
||||
{
|
||||
data = data.DecryptResponse(this.EncryptionKey);
|
||||
}
|
||||
|
||||
var type = data[0];
|
||||
|
||||
if (type == SIRTMessage.BUP)
|
||||
{
|
||||
this.Label = nameof(SIRTMessage.BUP);
|
||||
@@ -144,25 +145,46 @@
|
||||
{
|
||||
this.Label = nameof(SIRTMessage.DEBUG);
|
||||
this.DEBUG = new DEBUG(data, this.P11);
|
||||
this.Mode = (FactoryState)(this.DEBUG.FactoryState - 1);
|
||||
this.NotifyTelegram(this.DEBUG);
|
||||
|
||||
this.Mode = (StateModes)(this.DEBUG.FactoryState - 1);
|
||||
this.IsEncrypted = this.Mode == StateModes.Shipment;
|
||||
this.NotifyUpdated();
|
||||
}
|
||||
else if (type == SIRTMessage.SEMI)
|
||||
{
|
||||
this.ProcessSEMI(data);
|
||||
this.SEMI = new SEMI(data, this.Frequency, this.P11);
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
|
||||
if (this.State == SIRTTaskState.Completed || this.State == SIRTTaskState.Cancelled)
|
||||
if (this.request.Data.Length > 0 && this.request.Data[0] == Pam.GetDebug && this.DEBUG == null)
|
||||
{
|
||||
this.Label = "!DEBUG";
|
||||
}
|
||||
else if (this.SEMI.PAMStatus == PAMStatus.OK)
|
||||
{
|
||||
this.State = SIRTTaskState.Completed;
|
||||
this.EndProcessResponse(response);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.SEMI.PAMStatus == PAMStatus.EXPIREDAUTH)
|
||||
{
|
||||
this.State = SIRTTaskState.Cancelled;
|
||||
this.timeoutTimer.Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.countFailures++;
|
||||
|
||||
if (countFailures > 3)
|
||||
{
|
||||
this.State = SIRTTaskState.Cancelled;
|
||||
this.EndProcessResponse(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Label = "NA";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (response.Cmd == SIRTMessage.ACKNANSW)
|
||||
@@ -184,45 +206,5 @@
|
||||
protected void NotifyChanged() => this.Changed?.Invoke(this);
|
||||
|
||||
protected void NotifyTelegram(object value) => this.Telegram?.Invoke(value);
|
||||
|
||||
private void ProcessSEMI(byte[] data)
|
||||
{
|
||||
this.SEMI = new SEMI(data, this.Frequency, this.P11);
|
||||
|
||||
if (this.SEMI.PAMStatus == PAMStatus.OK)
|
||||
{
|
||||
this.State = SIRTTaskState.Completed;
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
var isEncrypted = this.IsEncrypted;
|
||||
this.IsEncrypted = this.SEMI.Crc != 0;
|
||||
|
||||
if (this.IsEncrypted != isEncrypted)
|
||||
{
|
||||
data = data.DecryptResponse(this.EncryptionKey);
|
||||
}
|
||||
|
||||
this.SEMI = new SEMI(data, this.Frequency, this.P11);
|
||||
|
||||
if (this.SEMI.PAMStatus == PAMStatus.OK)
|
||||
{
|
||||
this.State = SIRTTaskState.Completed;
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
}
|
||||
else if (this.SEMI.PAMStatus == PAMStatus.EXPIREDAUTH)
|
||||
{
|
||||
this.State = SIRTTaskState.Cancelled;
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
this.timeoutTimer.Stop();
|
||||
}
|
||||
|
||||
this.Label = this.SEMI.PAMStatus.ToString();
|
||||
}
|
||||
|
||||
this.NotifyTelegram(this.SEMI);
|
||||
this.NotifyUpdated();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -6,9 +6,9 @@
|
||||
{
|
||||
}
|
||||
|
||||
public StateModes Mode
|
||||
public FactoryState Mode
|
||||
{
|
||||
get => (StateModes)this.bytes[1];
|
||||
get => (FactoryState)this.bytes[1];
|
||||
set => this.bytes[1] = (byte)value;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -7,9 +7,10 @@
|
||||
private byte[] bitsFromByte11;
|
||||
|
||||
public SetMetrologyParameters() : base(18, MetrologyParameters)
|
||||
=> this.bitsFromByte11 = new byte[8];
|
||||
|
||||
public byte PamLength => this.bytes[1];
|
||||
{
|
||||
this.bytes[1] = 0x10;
|
||||
this.bitsFromByte11 = new byte[8];
|
||||
}
|
||||
|
||||
public int Vpp
|
||||
{
|
||||
@@ -115,7 +116,6 @@
|
||||
public override byte[] ToByteArray()
|
||||
{
|
||||
this.bytes[12] = this.bitsFromByte11.GetByteLE();
|
||||
this.bytes[1] = 0x10;
|
||||
|
||||
return base.ToByteArray();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace Common.Hardware.WaterMeter.eRegister.Features
|
||||
{
|
||||
public enum StateModes : byte
|
||||
public enum FactoryState : byte
|
||||
{
|
||||
Production = 0,
|
||||
Shipment = 1,
|
||||
|
||||
+25
-12
@@ -1,5 +1,7 @@
|
||||
namespace Common.Hardware.WaterMeter.eRegister.Models
|
||||
{
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class EregisterAvailableParametersParser : List<byte>
|
||||
@@ -10,27 +12,38 @@
|
||||
var available = default(bool);
|
||||
var cmdLength = default(int);
|
||||
var index = default(int);
|
||||
var cmdIX = default(int);
|
||||
var cmd = default(byte);
|
||||
|
||||
while (bytesLength > index)
|
||||
while (bytesLength > cmdIX)
|
||||
{
|
||||
var cmd = bytes[index++];
|
||||
_ = EregisterAvailableParametersParser.cmdLengths.TryGetValue(cmd, out cmdLength);
|
||||
cmd = bytes[cmdIX];
|
||||
_ = cmdLengths.TryGetValue(cmd, out cmdLength);
|
||||
_ = cmdAvailableAfterSeal.TryGetValue(cmd, out available);
|
||||
|
||||
if (cmd == Pam.SetPowerLevel && bytes[cmdIX + 1] > 127)
|
||||
{
|
||||
available = false;
|
||||
}
|
||||
|
||||
if (available)
|
||||
{
|
||||
index = cmdIX + 1;
|
||||
|
||||
this.Add(cmd);
|
||||
}
|
||||
|
||||
for (var i = 0; i < cmdLength; i++)
|
||||
{
|
||||
if (available)
|
||||
for (var i = 0; i < cmdLength; i++)
|
||||
{
|
||||
this.Add(bytes[index]);
|
||||
this.Add(bytes[index++]);
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
cmdIX += cmdLength + 1;
|
||||
}
|
||||
|
||||
if (this.IndexOf(Pam.ProvidePin) == 0)
|
||||
{
|
||||
this.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +74,7 @@
|
||||
{ 33, true },
|
||||
{ 48, false },
|
||||
{ 49, false },
|
||||
{ 50, true },
|
||||
{ 50, false },
|
||||
{ 51, true },
|
||||
{ 52, true },
|
||||
{ 53, true },
|
||||
@@ -119,7 +132,7 @@
|
||||
{ 73, 7 },
|
||||
{ 80, 9 },
|
||||
{ 108, 16 },
|
||||
{ 146, 16 },
|
||||
{ 146, 17 },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+14
-15
@@ -251,18 +251,18 @@
|
||||
ResponseAddress = this.ResponseAddress,
|
||||
Frequency = this.Frequency,
|
||||
EncryptionKey = this.EncryptionKey.GetEncryptionKey(),
|
||||
//ChangeWakeUp = new ChangeWakeUp
|
||||
//{
|
||||
// WakeUpMode = WakeUpMode.StayAwake
|
||||
//},
|
||||
//ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
|
||||
//{
|
||||
// N = 1
|
||||
//},
|
||||
//ChangeTransmissionInterval = new ChangeTransmissionInterval
|
||||
//{
|
||||
// Seconds = 1
|
||||
//}
|
||||
ChangeWakeUp = new ChangeWakeUp
|
||||
{
|
||||
WakeUpMode = WakeUpMode.StayAwake
|
||||
},
|
||||
ChangeNumberOfLatWindows = new ChangeNumberOfLatWindows
|
||||
{
|
||||
N = 1
|
||||
},
|
||||
ChangeTransmissionInterval = new ChangeTransmissionInterval
|
||||
{
|
||||
Seconds = 1
|
||||
},
|
||||
ChangeRadioId = new ChangeRadioId
|
||||
{
|
||||
Address = this.ResponseAddress
|
||||
@@ -289,7 +289,7 @@
|
||||
{
|
||||
return features;
|
||||
}
|
||||
|
||||
|
||||
features.ChangeRadioId = new ChangeRadioId(this.ResponseAddress);
|
||||
features.ChangeMeterId = new ChangeMeterId(this.MeterId);
|
||||
features.ChangeMeterReading = new ChangeMeterReading(this.DisplayVolume);
|
||||
@@ -313,10 +313,9 @@
|
||||
},
|
||||
ChangeState = new ChangeState
|
||||
{
|
||||
Mode = StateModes.Shipment
|
||||
Mode = FactoryState.Shipment
|
||||
}
|
||||
};
|
||||
|
||||
features.DeactivateAlarms = new DeactivateAlarms
|
||||
{
|
||||
Backflow = this.Alarm_Backflow,
|
||||
|
||||
@@ -21,27 +21,20 @@
|
||||
{
|
||||
var mainWindow = new MainWindow();
|
||||
var args = e.Args;
|
||||
var argsLength = args?.Length ?? 0;
|
||||
|
||||
if (args?.Length > 0)
|
||||
if (argsLength > 0)
|
||||
{
|
||||
var source = $"Pages/{args[0]}.xaml";
|
||||
var sourceUri = new Uri(source, UriKind.RelativeOrAbsolute);
|
||||
var data = default(object);
|
||||
|
||||
if (args?.Length > 1)
|
||||
if (argsLength > 1)
|
||||
{
|
||||
mainWindow.Navigated += (_, eargs) =>
|
||||
{
|
||||
if (eargs.Content is Page page)
|
||||
{
|
||||
if (int.TryParse($"{args[1]}", out var sharedId))
|
||||
{
|
||||
page.Tag = sharedId;
|
||||
}
|
||||
}
|
||||
};
|
||||
data = args[1];
|
||||
}
|
||||
|
||||
mainWindow.NavigationService.Navigate(sourceUri, args[1]);
|
||||
mainWindow.NavigationService.Navigate(sourceUri, data);
|
||||
}
|
||||
|
||||
AppHost.ConfigureServices(services =>
|
||||
|
||||
@@ -117,10 +117,21 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Controls\Clock.xaml.cs">
|
||||
<DependentUpon>Clock.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\GridLayout.xaml.cs">
|
||||
<DependentUpon>GridLayout.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\MainMenu.xaml.cs">
|
||||
<DependentUpon>MainMenu.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Infrastructure\BooleanToBorderConverter.cs" />
|
||||
<Compile Include="Models\AuftragDbContext.cs" />
|
||||
<Compile Include="Models\Eregister_Shared.cs" />
|
||||
<Compile Include="Models\HttpContext.cs" />
|
||||
<Compile Include="Models\P2000_Shared.cs" />
|
||||
<Compile Include="Models\SIRTFactoryModel.cs" />
|
||||
<Compile Include="Pages\EregisterFinalize.xaml.cs">
|
||||
<DependentUpon>EregisterFinalize.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -157,20 +168,26 @@
|
||||
<Compile Include="ViewModels\HomeViewModel.cs" />
|
||||
<Compile Include="ViewModels\KvpViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainMenuViewModel.cs" />
|
||||
<Compile Include="ViewModels\MainMenuVM.cs" />
|
||||
<Compile Include="ViewModels\MainWindowVM.cs" />
|
||||
<Compile Include="ViewModels\SettingsViewModel.cs" />
|
||||
<Compile Include="ViewModels\SIRTBroadcasterVM.cs" />
|
||||
<Compile Include="ViewModels\SIRTConnectionVM.cs" />
|
||||
<Compile Include="Views\MainMenuView.xaml.cs">
|
||||
<DependentUpon>MainMenuView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SIRTBroadcasters.xaml.cs">
|
||||
<Compile Include="Controls\SIRTBroadcasters.xaml.cs">
|
||||
<DependentUpon>SIRTBroadcasters.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Controls\Clock.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Controls\GridLayout.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Controls\MainMenu.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Pages\EregisterFinalize.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@@ -187,9 +204,6 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Data\AuftragDbContext.cs" />
|
||||
<Compile Include="Data\Eregister_Shared.cs" />
|
||||
<Compile Include="Data\P2000_Shared.cs" />
|
||||
<Compile Include="Infrastructure\AppHost.cs" />
|
||||
<Compile Include="Infrastructure\Appsettings.cs" />
|
||||
<Compile Include="Infrastructure\ViewModel[T].cs" />
|
||||
@@ -219,11 +233,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\MainMenuView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SIRTBroadcasters.xaml">
|
||||
<Page Include="Controls\SIRTBroadcasters.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<Label x:Class="Common.UI.Controls.Clock"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Style="{DynamicResource ClockStyle}">
|
||||
<Label.Resources>
|
||||
<Style x:Key="ClockStyle" TargetType="{x:Type Label}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Top"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Label}">
|
||||
<Border BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="true"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Path Fill="{TemplateBinding Foreground}"
|
||||
Grid.Column="0"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="16">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M8.515 1.019A7 7 0 0 0 8 1V0a8 8 0 0 1 .589.022zm2.004.45a7 7 0 0 0-.985-.299l.219-.976q.576.129 1.126.342zm1.37.71a7 7 0 0 0-.439-.27l.493-.87a8 8 0 0 1 .979.654l-.615.789a7 7 0 0 0-.418-.302zm1.834 1.79a7 7 0 0 0-.653-.796l.724-.69q.406.429.747.91zm.744 1.352a7 7 0 0 0-.214-.468l.893-.45a8 8 0 0 1 .45 1.088l-.95.313a7 7 0 0 0-.179-.483m.53 2.507a7 7 0 0 0-.1-1.025l.985-.17q.1.58.116 1.17zm-.131 1.538q.05-.254.081-.51l.993.123a8 8 0 0 1-.23 1.155l-.964-.267q.069-.247.12-.501m-.952 2.379q.276-.436.486-.908l.914.405q-.24.54-.555 1.038zm-.964 1.205q.183-.183.35-.378l.758.653a8 8 0 0 1-.401.432z" />
|
||||
<PathGeometry Figures="M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0z" />
|
||||
<PathGeometry Figures="M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<ContentPresenter Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Label.Resources>
|
||||
</Label>
|
||||
@@ -0,0 +1,93 @@
|
||||
namespace Common.UI.Controls
|
||||
{
|
||||
using System;
|
||||
using System.Timers;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class Clock : Label
|
||||
{
|
||||
const string DEFAULT_FORMAT = "hh\\:mm\\:ss";
|
||||
|
||||
public static readonly DependencyProperty TimerProperty = DependencyProperty.Register(
|
||||
name: nameof(Timer)
|
||||
, propertyType: typeof(Timer)
|
||||
, ownerType: typeof(Clock)
|
||||
, typeMetadata: new FrameworkPropertyMetadata(TimerPropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty FormatProperty = DependencyProperty.Register(
|
||||
name: nameof(Format)
|
||||
, propertyType: typeof(string)
|
||||
, ownerType: typeof(Clock)
|
||||
, typeMetadata: new FrameworkPropertyMetadata(DEFAULT_FORMAT));
|
||||
|
||||
public Clock() => this.InitializeComponent();
|
||||
|
||||
public Timer Timer
|
||||
{
|
||||
get => GetValue(TimerProperty) as Timer;
|
||||
set => SetValue(TimerProperty, value);
|
||||
}
|
||||
|
||||
public string Format
|
||||
{
|
||||
get => GetValue(FormatProperty) as string;
|
||||
set => SetValue(FormatProperty, value);
|
||||
}
|
||||
|
||||
private DateTime? startTime;
|
||||
private void Timer_Elapsed(Object sender, ElapsedEventArgs args)
|
||||
{
|
||||
App.InvokeAsync(() =>
|
||||
{
|
||||
if (this.startTime is null)
|
||||
{
|
||||
this.Opacity = 1;
|
||||
this.startTime = args.SignalTime;
|
||||
}
|
||||
|
||||
var timespan = args.SignalTime - this.startTime.Value;
|
||||
this.Content = timespan.ToString(this.Format ?? DEFAULT_FORMAT);
|
||||
});
|
||||
}
|
||||
|
||||
private void BindTimer(object value)
|
||||
{
|
||||
App.InvokeAsync(() =>
|
||||
{
|
||||
if (value is Timer timer)
|
||||
{
|
||||
timer.Elapsed += this.Timer_Elapsed;
|
||||
}
|
||||
|
||||
this.startTime = null;
|
||||
this.Opacity = 0.3;
|
||||
this.Content = new TimeSpan().ToString(this.Format ?? DEFAULT_FORMAT);
|
||||
});
|
||||
}
|
||||
|
||||
private void UnbindTimer(object value)
|
||||
{
|
||||
App.InvokeAsync(() =>
|
||||
{
|
||||
if (value is Timer timer)
|
||||
{
|
||||
timer.Elapsed -= this.Timer_Elapsed;
|
||||
}
|
||||
|
||||
this.startTime = null;
|
||||
this.Opacity = 0.3;
|
||||
this.Content = new TimeSpan().ToString(this.Format ?? DEFAULT_FORMAT);
|
||||
});
|
||||
}
|
||||
|
||||
private static void TimerPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (dependencyObject is Clock clock)
|
||||
{
|
||||
clock.UnbindTimer(args.OldValue);
|
||||
clock.BindTimer(args.NewValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,279 @@
|
||||
<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:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels">
|
||||
<Grid.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterTaskVM}" >
|
||||
<Border Background="{Binding Label, Converter={StaticResource TaskStateToBG}}"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
MinWidth="150"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Grid Grid.Row="0" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="20" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Content="{Binding Address}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsEncrypted, Converter={StaticResource BooleanToVisibility}}"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M0 8a4 4 0 0 1 7.465-2H14a.5.5 0 0 1 .354.146l1.5 1.5a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0L13 9.207l-.646.647a.5.5 0 0 1-.708 0L11 9.207l-.646.647a.5.5 0 0 1-.708 0L9 9.207l-.646.647A.5.5 0 0 1 8 10h-.535A4 4 0 0 1 0 8m4-3a3 3 0 1 0 2.712 4.285A.5.5 0 0 1 7.163 9h.63l.853-.854a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.646-.647a.5.5 0 0 1 .708 0l.646.647.793-.793-1-1h-6.63a.5.5 0 0 1-.451-.285A3 3 0 0 0 4 5" />
|
||||
<PathGeometry Figures="M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="2"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsSealed, Converter={StaticResource BooleanToVisibility}}"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2m3 6V3a3 3 0 0 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2M5 8h6a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
</Grid>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z" />
|
||||
<PathGeometry Figures="M5.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m-3-8.5a1 1 0 0 1 1-1c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1 6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1-1-1" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding RSSI}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0m6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Name}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3.854 2.146a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 3.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 7.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterHeaderVM}" >
|
||||
<Border Background="#FFF0F0F0"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
MinWidth="150"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2, 0, 0, 0"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.3 1.3 0 0 0-.37.265.3.3 0 0 0-.057.09V14l.002.008.016.033a.6.6 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.6.6 0 0 0 .146-.15l.015-.033L12 14v-.004a.3.3 0 0 0-.057-.09 1.3 1.3 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465s-2.462-.172-3.34-.465c-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SlotNr}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5 8 5.961 14.154 3.5zM15 4.239l-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding PoNr}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3 4.5a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SerialNr}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Frequency}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:GridItem}" >
|
||||
<Border BorderBrush="Gray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
MinHeight="20"
|
||||
MinWidth="150"
|
||||
Padding="10, 5">
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Grid.Resources>
|
||||
</Grid>
|
||||
|
||||
+3
-6
@@ -1,14 +1,11 @@
|
||||
<Menu x:Class="Common.UI.Views.MainMenuView"
|
||||
<Menu x:Class="Common.UI.Controls.MainMenu"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ViewModels="clr-namespace:Common.UI.ViewModels">
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels">
|
||||
<Menu.DataContext>
|
||||
<ViewModels:MainMenuViewModel />
|
||||
<VM:MainMenuVM />
|
||||
</Menu.DataContext>
|
||||
<MenuItem Header="Home" Command="{Binding NavigateCommand}" CommandParameter="Pages/Home.xaml" />
|
||||
<MenuItem Header="Settings" Command="{Binding NavigateCommand}" CommandParameter="Pages/Settings.xaml" />
|
||||
<MenuItem Header="Eregister">
|
||||
<MenuItem Header="Manual Programming" Command="{Binding NavigateCommand}" CommandParameter="Pages/Eregister.xaml" />
|
||||
<MenuItem Header="Inspection Initialization" Command="{Binding NavigateCommand}" CommandParameter="Pages/EregisterInitialize.xaml" />
|
||||
<MenuItem Header="Inspection Finalization" Command="{Binding NavigateCommand}" CommandParameter="Pages/EregisterFinalize.xaml" />
|
||||
</MenuItem>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Common.UI.Controls
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class MainMenu : Menu
|
||||
{
|
||||
public MainMenu() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
+2
-7
@@ -13,7 +13,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border BorderBrush="LightGray"
|
||||
<Border BorderBrush="Gray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
@@ -50,7 +50,7 @@
|
||||
Width="100" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border BorderBrush="LightGray"
|
||||
<Border BorderBrush="Gray"
|
||||
BorderThickness="0, 0, 0, 1"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
@@ -87,11 +87,6 @@
|
||||
IsEnabled="{Binding DisconnectEnabled}"
|
||||
Margin="0, 5, 5, 0"
|
||||
Padding="10, 3" />
|
||||
<Button Content="Remove"
|
||||
Command="{Binding RemoveCommand}"
|
||||
Grid.Column="6"
|
||||
Margin="0, 5, 5, 0"
|
||||
Padding="10, 3" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
}
|
||||
|
||||
internal virtual void ViewModel_Loaded()
|
||||
internal virtual void ViewModel_Loaded(object data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.NavigationService.LoadCompleted += NavigationService_LoadCompleted;
|
||||
this.NavigationService.LoadCompleted += this.NavigationService_LoadCompleted;
|
||||
}
|
||||
|
||||
private void NavigationService_LoadCompleted(object sender, NavigationEventArgs args)
|
||||
{
|
||||
if (args.Content is Page page)
|
||||
{
|
||||
if (page.DataContext is ViewModel viewModel)
|
||||
if (page.DataContext is ViewModel vm)
|
||||
{
|
||||
App.InvokeAsync(viewModel.ViewModel_Loaded);
|
||||
App.InvokeAsync(() => vm.ViewModel_Loaded(args.ExtraData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+20
-2
@@ -1,4 +1,4 @@
|
||||
namespace Common.UI.Data
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
@@ -8,6 +8,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
internal class AuftragDbContext
|
||||
{
|
||||
@@ -22,7 +24,7 @@
|
||||
|
||||
internal class P2000Shared
|
||||
{
|
||||
internal static P2000_Shared LoadPendingActions(int psno)
|
||||
internal static P2000_Shared LoadPendingAction(int psno)
|
||||
=> sqlConnection.LoadPendingActions(psno);
|
||||
}
|
||||
|
||||
@@ -99,5 +101,21 @@
|
||||
|
||||
return xmlDeserialized as EregisterProgrammingParametersList ?? new EregisterProgrammingParametersList();
|
||||
}
|
||||
|
||||
internal static EregisterProgrammingParametersList LoadEregisterProgrammingParametersList(int sharedId, string psno)
|
||||
{
|
||||
if (sharedId <= 0 && int.TryParse($"{Appsettings.Get("PSNR")}", out var psnr))
|
||||
{
|
||||
var pendingAction = P2000Shared.LoadPendingAction(psnr);
|
||||
sharedId = pendingAction?.Id ?? 0;
|
||||
}
|
||||
|
||||
if (sharedId <= 0)
|
||||
{
|
||||
return new EregisterProgrammingParametersList();
|
||||
}
|
||||
|
||||
return LoadEregisterProgrammingParametersListForSharedId(sharedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Common.UI.Data
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
public class HttpContext
|
||||
{
|
||||
private static readonly HttpClient httpClient = new HttpClient();
|
||||
|
||||
internal static async Task<string> GetEncryptionKeyAsync(string urlFormat, int serienNr)
|
||||
{
|
||||
var encryptionKey = default(string);
|
||||
|
||||
using (var httpResponeMessage = await httpClient.GetAsync(string.Format(urlFormat, serienNr)))
|
||||
{
|
||||
if (httpResponeMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await httpResponeMessage.Content?.ReadAsStringAsync();
|
||||
encryptionKey = content?.Trim('"');
|
||||
}
|
||||
}
|
||||
|
||||
return encryptionKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Common.UI.Data
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using LaaPackages.SqlClient;
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
namespace Common.UI.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
using Common.Hardware.SIRT;
|
||||
|
||||
using NLog;
|
||||
|
||||
public class SIRTFactoryModel
|
||||
{
|
||||
private readonly SIRTFactory sirtFactory;
|
||||
private readonly ILogger logger;
|
||||
|
||||
public SIRTFactoryModel(SIRTFactory sirtFactory, ILogger logger)
|
||||
{
|
||||
this.logger = logger;
|
||||
this.sirtFactory = sirtFactory;
|
||||
this.sirtFactory.Logging += this.SirtFactory_Logging;
|
||||
}
|
||||
|
||||
internal Action<SIRTTask> EnqueueAction => this.sirtFactory.EnqueueTask;
|
||||
|
||||
internal void Initialize(string portNamesString, Action<SIRTBroadcaster> connecting)
|
||||
{
|
||||
var portNames = portNamesString
|
||||
?.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
?? Array.Empty<string>();
|
||||
|
||||
foreach (var portName in portNames)
|
||||
{
|
||||
this.sirtFactory.ConnectSIRT(portName, connecting);
|
||||
}
|
||||
}
|
||||
|
||||
private void SirtFactory_Logging(string content)
|
||||
=> this.logger.Debug(content);
|
||||
|
||||
internal void DisconnectAll() => this.sirtFactory.CloseConnections();
|
||||
|
||||
public static implicit operator SIRTFactory (SIRTFactoryModel model) => model?.sirtFactory;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Page 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:Views="clr-namespace:Common.UI.Views"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2" x:Class="Common.UI.Pages.Eregister"
|
||||
WindowTitle="UI / Eregister test environment"
|
||||
Title="Eregister">
|
||||
@@ -457,7 +457,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Views:MainMenuView Grid.Row="0" />
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<Border BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 0, 1"
|
||||
Grid.Row="1">
|
||||
|
||||
@@ -20,244 +20,9 @@
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Controls:GridLayout Background="WhiteSmoke" ItemsSource="{Binding ProgrammingTasks}">
|
||||
<Controls:GridLayout.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterTaskVM}" >
|
||||
<Border Background="{Binding Label, Converter={StaticResource TaskStateToBG}}"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Address}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z" />
|
||||
<PathGeometry Figures="M5.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m-3-8.5a1 1 0 0 1 1-1c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1 6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1-1-1" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding RSSI}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0m6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Name}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3.854 2.146a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 3.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 7.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterHeaderVM}" >
|
||||
<Border Background="WhiteSmoke"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2, 0, 0, 0"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.3 1.3 0 0 0-.37.265.3.3 0 0 0-.057.09V14l.002.008.016.033a.6.6 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.6.6 0 0 0 .146-.15l.015-.033L12 14v-.004a.3.3 0 0 0-.057-.09 1.3 1.3 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465s-2.462-.172-3.34-.465c-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SlotNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5 8 5.961 14.154 3.5zM15 4.239l-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding PoNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3 4.5a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SerialNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Frequency}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:GridItem}" >
|
||||
<Border BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
MinHeight="20"
|
||||
Padding="10, 5">
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Controls:GridLayout.Resources>
|
||||
</Controls:GridLayout>
|
||||
<Controls:GridLayout Background="#FFF0F0F0" ItemsSource="{Binding ProgrammingTasks}" />
|
||||
</ScrollViewer>
|
||||
<Border BorderBrush="LightGray"
|
||||
<Border BorderBrush="#FFF0F0F0"
|
||||
BorderThickness="0, 1, 0, 0"
|
||||
Grid.Row="2" >
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
namespace Common.UI.Pages
|
||||
{
|
||||
using Common.UI.ViewModels;
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EregisterFinalize : Page
|
||||
{
|
||||
public EregisterFinalize()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.Loaded += EregisterInitialize_Loaded;
|
||||
}
|
||||
|
||||
private void EregisterInitialize_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is EregisterFinalizeVM eregisterInitializeVM)
|
||||
{
|
||||
if (this.Tag is int sharedId)
|
||||
{
|
||||
eregisterInitializeVM.StartProgramming(sharedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
public EregisterFinalize() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,250 +14,15 @@
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<V:SIRTBroadcasters Grid.Row="0" />
|
||||
<V:SIRTBroadcasters Background="#FFF0F0F0" Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalScrollBarVisibility="Disabled"
|
||||
VerticalAlignment="Stretch"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Controls:GridLayout Background="WhiteSmoke" ItemsSource="{Binding ProgrammingTasks}">
|
||||
<Controls:GridLayout.Resources>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterTaskVM}" >
|
||||
<Border Background="{Binding Label, Converter={StaticResource TaskStateToBG}}"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM6 8a2 2 0 1 1 2.5 1.937V15.5a.5.5 0 0 1-1 0V9.937A2 2 0 0 1 6 8" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Address}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<GeometryGroup>
|
||||
<PathGeometry Figures="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z" />
|
||||
<PathGeometry Figures="M5.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m-3-8.5a1 1 0 0 1 1-1c5.523 0 10 4.477 10 10a1 1 0 1 1-2 0 8 8 0 0 0-8-8 1 1 0 0 1-1-1m0 4a1 1 0 0 1 1-1 6 6 0 0 1 6 6 1 1 0 1 1-2 0 4 4 0 0 0-4-4 1 1 0 0 1-1-1" />
|
||||
</GeometryGroup>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding RSSI}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0m6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Name}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3.854 2.146a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 3.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 7.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{Binding Label, Converter={StaticResource TaskStateToFG}}"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:EregisterHeaderVM}" >
|
||||
<Border Background="WhiteSmoke"
|
||||
BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
Padding="10, 5">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="20" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2, 0, 0, 0"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry FillRule="EvenOdd" Figures="M8 1a3 3 0 1 0 0 6 3 3 0 0 0 0-6M4 4a4 4 0 1 1 4.5 3.969V13.5a.5.5 0 0 1-1 0V7.97A4 4 0 0 1 4 3.999zm2.493 8.574a.5.5 0 0 1-.411.575c-.712.118-1.28.295-1.655.493a1.3 1.3 0 0 0-.37.265.3.3 0 0 0-.057.09V14l.002.008.016.033a.6.6 0 0 0 .145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.6.6 0 0 0 .146-.15l.015-.033L12 14v-.004a.3.3 0 0 0-.057-.09 1.3 1.3 0 0 0-.37-.264c-.376-.198-.943-.375-1.655-.493a.5.5 0 1 1 .164-.986c.77.127 1.452.328 1.957.594C12.5 13 13 13.4 13 14c0 .426-.26.752-.544.977-.29.228-.68.413-1.116.558-.878.293-2.059.465-3.34.465s-2.462-.172-3.34-.465c-.436-.145-.826-.33-1.116-.558C3.26 14.752 3 14.426 3 14c0-.599.5-1 .961-1.243.505-.266 1.187-.467 1.957-.594a.5.5 0 0 1 .575.411" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SlotNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5 8 5.961 14.154 3.5zM15 4.239l-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding PoNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Height="12"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="12">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3 4.5a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0zm2 0a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm3 0a.5.5 0 0 1 1 0v7a.5.5 0 0 1-1 0z" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding SerialNr}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
<Path Fill="DarkSlateGray"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
Height="13"
|
||||
HorizontalAlignment="Left"
|
||||
Stretch="Uniform"
|
||||
VerticalAlignment="Center"
|
||||
Width="13">
|
||||
<Path.Data>
|
||||
<PathGeometry Figures="M3.05 3.05a7 7 0 0 0 0 9.9.5.5 0 0 1-.707.707 8 8 0 0 1 0-11.314.5.5 0 0 1 .707.707m2.122 2.122a4 4 0 0 0 0 5.656.5.5 0 1 1-.708.708 5 5 0 0 1 0-7.072.5.5 0 0 1 .708.708m5.656-.708a.5.5 0 0 1 .708 0 5 5 0 0 1 0 7.072.5.5 0 1 1-.708-.708 4 4 0 0 0 0-5.656.5.5 0 0 1 0-.708m2.122-2.12a.5.5 0 0 1 .707 0 8 8 0 0 1 0 11.313.5.5 0 0 1-.707-.707 7 7 0 0 0 0-9.9.5.5 0 0 1 0-.707zM10 8a2 2 0 1 1-4 0 2 2 0 0 1 4 0" />
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Label Content="{Binding Frequency}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type VM:GridItem}" >
|
||||
<Border BorderBrush="LightGray"
|
||||
BorderThickness="0, 0, 1, 1"
|
||||
Margin="0"
|
||||
MinHeight="20"
|
||||
Padding="10, 5">
|
||||
<Label Content="{Binding Label}"
|
||||
FontFamily="Consolas"
|
||||
FontWeight="Bold"
|
||||
Foreground="DarkSlateGray"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Controls:GridLayout.Resources>
|
||||
</Controls:GridLayout>
|
||||
<Controls:GridLayout Background="#FFF0F0F0" ItemsSource="{Binding ProgrammingTasks}" />
|
||||
</ScrollViewer>
|
||||
<Border BorderBrush="LightGray"
|
||||
<Border BorderBrush="Gray"
|
||||
BorderThickness="0, 1, 0, 0"
|
||||
Grid.Row="2" >
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
namespace Common.UI.Pages
|
||||
{
|
||||
using Common.UI.ViewModels;
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class EregisterInitialize : Page
|
||||
{
|
||||
public EregisterInitialize()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.Loaded += EregisterInitialize_Loaded;
|
||||
}
|
||||
|
||||
private void EregisterInitialize_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.DataContext is EregisterInitializeVM eregisterInitializeVM)
|
||||
{
|
||||
if (this.Tag is int sharedId)
|
||||
{
|
||||
eregisterInitializeVM.StartProgramming(sharedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
public EregisterInitialize() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<Page x:Class="Common.UI.Pages.Home"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ViewModels="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:Views="clr-namespace:Common.UI.Views"
|
||||
xmlns:VM="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
WindowTitle="UI / Home"
|
||||
Title="Home">
|
||||
<Page.DataContext>
|
||||
<ViewModels:HomeViewModel />
|
||||
<VM:HomeViewModel />
|
||||
</Page.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Views:MainMenuView Grid.Row="0" />
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<Label Content="{Binding Id}" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ViewModels="clr-namespace:Common.UI.ViewModels"
|
||||
xmlns:Views="clr-namespace:Common.UI.Views"
|
||||
xmlns:Controls="clr-namespace:Common.UI.Controls"
|
||||
WindowTitle="UI / Settings"
|
||||
Title="Settings">
|
||||
<Page.DataContext>
|
||||
@@ -13,7 +13,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Views:MainMenuView Grid.Row="0" />
|
||||
<Controls:MainMenu Grid.Row="0" />
|
||||
<Label Content="{Binding Id}" Grid.Row="1" />
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -1,39 +1,15 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
internal class EregisterFinalizeVM : EregisterInitializeVM
|
||||
{
|
||||
protected override async Task StartProgrammingAsync(EregisterProgrammingParametersList parametersList)
|
||||
{
|
||||
var programmingTasksEnumerable = this.eregisterFactory.LoadInspectionFinalizationTasks(parametersList);
|
||||
|
||||
this.LoadUIComponenets(programmingTasksEnumerable);
|
||||
|
||||
await Task.Delay(3000);
|
||||
|
||||
this.TimeElapsed = null;
|
||||
this.timestamp = DateTime.Now;
|
||||
this.timer.Start();
|
||||
this.programmingTask = this.eregisterFactory
|
||||
.StartProgrammingAsync(this.cancellationToken)
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
this.timer.Stop();
|
||||
|
||||
this.StartEnabled = true;
|
||||
this.StopEnabled = false;
|
||||
})
|
||||
.ContinueWith(async _ =>
|
||||
{
|
||||
await Task.Delay(1_000);
|
||||
|
||||
this.sirtFactory.CloseConnections();
|
||||
// this.InvokeAsync(App.Current.Shutdown);
|
||||
});
|
||||
}
|
||||
protected override Task PrepareProgrammingAsync(Func<EregisterProgrammingParametersList, IEnumerable<IEnumerable<EregisterTask>>> taskSource = null)
|
||||
=> base.PrepareProgrammingAsync(this.eregisterFactory.LoadInspectionFinalizationTasks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
using Common.UI.Data;
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Models;
|
||||
|
||||
using NLog;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
private readonly ILogger logger;
|
||||
protected readonly System.Timers.Timer timer;
|
||||
protected readonly SIRTFactory sirtFactory;
|
||||
protected readonly EregisterBatch eregisterFactory;
|
||||
protected readonly EregisterFactory eregisterFactory;
|
||||
|
||||
private CancellationTokenSource cancellationTokenSource;
|
||||
protected CancellationToken cancellationToken;
|
||||
@@ -42,9 +42,9 @@
|
||||
this.logger = AppHost.GetService<ILogger>();
|
||||
this.sirtFactory = AppHost.GetService<SIRTFactory>();
|
||||
this.sirtFactory.Logging += x => this.logger.Debug(x);
|
||||
this.eregisterFactory = new EregisterBatch(this.sirtFactory);
|
||||
this.eregisterFactory = new EregisterFactory(this.sirtFactory);
|
||||
this.ProgrammingTasks = new ObservableCollection<EregisterTaskVM>();
|
||||
this.StartProgrammingCommand = new Command(this.LoadProgrammingTasks);
|
||||
this.StartProgrammingCommand = new Command(this.StartProgrammingCommandHandler);
|
||||
this.StopProgrammingCommand = new Command(this.StopProgrammingCommandHandler);
|
||||
this.StartEnabled = true;
|
||||
}
|
||||
@@ -81,132 +81,44 @@
|
||||
set => this.Set(vm => vm.programmingTasks = value);
|
||||
}
|
||||
|
||||
internal void StartProgramming(int sharedId)
|
||||
internal override void ViewModel_Loaded(object data)
|
||||
{
|
||||
this.sharedId = sharedId;
|
||||
|
||||
this.LoadProgrammingTasks();
|
||||
}
|
||||
|
||||
protected void LoadUIComponenets(IEnumerable<IEnumerable<EregisterTask>> programmingTasksEnumerable)
|
||||
{
|
||||
var col = 0;
|
||||
var row = 0;
|
||||
var tasks = new List<GridItem>();
|
||||
|
||||
#region Headers
|
||||
col = 0;
|
||||
row = 0;
|
||||
|
||||
foreach (var programmingTasks in programmingTasksEnumerable)
|
||||
if (!int.TryParse($"{data}", out this.sharedId))
|
||||
{
|
||||
var firstOrDefault = programmingTasks.FirstOrDefault();
|
||||
|
||||
tasks.Add(new EregisterHeaderVM
|
||||
if (int.TryParse($"{Appsettings.Get("PSNR")}", out var psnr))
|
||||
{
|
||||
Column = col++,
|
||||
Frequency = $"{firstOrDefault?.Frequency ?? 0}MHz",
|
||||
PoNr = firstOrDefault?.PoNr ?? 0,
|
||||
Row = row,
|
||||
SerialNr = firstOrDefault?.SerialNr ?? 0,
|
||||
SlotNr = firstOrDefault?.SlotNr ?? 0
|
||||
});
|
||||
}
|
||||
#endregion Headers
|
||||
|
||||
#region Tasks
|
||||
col = 0;
|
||||
row = 1;
|
||||
|
||||
foreach (var programmingTasks in programmingTasksEnumerable)
|
||||
{
|
||||
foreach (var programmingTask in programmingTasks)
|
||||
{
|
||||
tasks.Add(new EregisterTaskVM(programmingTask, col, row++));
|
||||
this.sharedId = AuftragDbContext
|
||||
.P2000Shared
|
||||
.LoadPendingAction(psnr)
|
||||
?.Id ?? 0;
|
||||
}
|
||||
|
||||
col += 1;
|
||||
row = 1;
|
||||
}
|
||||
#endregion Tasks
|
||||
|
||||
this.ProgrammingTasks = tasks;
|
||||
Task.Run(async () => await this.PrepareProgrammingAsync(this.eregisterFactory.LoadInspectionInitializationTasks));
|
||||
}
|
||||
|
||||
protected virtual async Task StartProgrammingAsync(EregisterProgrammingParametersList parametersList)
|
||||
{
|
||||
var programmingTasksEnumerable = this.eregisterFactory.LoadInspectionInitializationTasks(parametersList);
|
||||
|
||||
this.LoadUIComponenets(programmingTasksEnumerable);
|
||||
|
||||
await Task.Delay(3000);
|
||||
|
||||
this.TimeElapsed = null;
|
||||
this.timestamp = DateTime.Now;
|
||||
this.timer.Start();
|
||||
this.programmingTask = this.eregisterFactory
|
||||
.StartProgrammingAsync(this.cancellationToken)
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
this.timer.Stop();
|
||||
|
||||
this.StartEnabled = true;
|
||||
this.StopEnabled = false;
|
||||
})
|
||||
.ContinueWith(async _ =>
|
||||
{
|
||||
await Task.Delay(1_000);
|
||||
|
||||
this.sirtFactory.CloseConnections();
|
||||
// this.InvokeAsync(App.Current.Shutdown);
|
||||
});
|
||||
}
|
||||
|
||||
private void LoadProgrammingTasks()
|
||||
private void StartProgrammingCommandHandler()
|
||||
{
|
||||
this.StartEnabled = false;
|
||||
this.StopEnabled = true;
|
||||
|
||||
this.TimeElapsed = null;
|
||||
this.timestamp = DateTime.Now;
|
||||
this.cancellationTokenSource = new CancellationTokenSource();
|
||||
this.cancellationToken = this.cancellationTokenSource.Token;
|
||||
|
||||
Task.Run(async () =>
|
||||
this.programmingTask = Task.Run(async () =>
|
||||
{
|
||||
var parametersList = default(EregisterProgrammingParametersList);
|
||||
await this.PrepareProgrammingAsync();
|
||||
await this.eregisterFactory.StartProgrammingAsync(this.cancellationToken);
|
||||
})
|
||||
.ContinueWith(_ =>
|
||||
{
|
||||
this.timer.Stop();
|
||||
|
||||
if (this.sharedId <= 0 && int.TryParse($"{Appsettings.Get("PSNR")}", out var psnr))
|
||||
{
|
||||
var pendingAction = AuftragDbContext.P2000Shared.LoadPendingActions(psnr);
|
||||
this.sharedId = pendingAction?.Id ?? 0;
|
||||
}
|
||||
this.StartEnabled = true;
|
||||
this.StopEnabled = false;
|
||||
});
|
||||
|
||||
var actions = AuftragDbContext.Eregister_Shared.LoadActions(this.sharedId);
|
||||
parametersList = AuftragDbContext.LoadEregisterProgrammingParametersListForSharedId(this.sharedId);
|
||||
|
||||
var uriFormat = Appsettings.Get("EncryptionKeisUrl");
|
||||
var httpClient = new HttpClient();
|
||||
|
||||
foreach (var epp in parametersList)
|
||||
{
|
||||
var finalAddress = actions.FirstOrDefault(x => x.SerialNr == epp.SerienNr).FinalAddress;
|
||||
var tempAddress = actions.FirstOrDefault(x => x.SerialNr == epp.SerienNr).TempAddress;
|
||||
|
||||
epp.Adresse = finalAddress;
|
||||
epp.TempAdresse = tempAddress;
|
||||
|
||||
using (var httpResponeMessage = await httpClient.GetAsync(string.Format(uriFormat, epp.SerienNr)))
|
||||
{
|
||||
if (httpResponeMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await httpResponeMessage.Content?.ReadAsStringAsync();
|
||||
epp.EncryptionKey = content?.Trim('"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await this.StartProgrammingAsync(parametersList);
|
||||
|
||||
}, this.cancellationToken);
|
||||
this.timer.Start();
|
||||
}
|
||||
|
||||
private void StopProgrammingCommandHandler()
|
||||
@@ -234,5 +146,76 @@
|
||||
|
||||
this.TimeElapsed = stamp.ToString("mm\\:ss");
|
||||
}
|
||||
|
||||
protected virtual async Task PrepareProgrammingAsync(Func<EregisterProgrammingParametersList, IEnumerable<IEnumerable<EregisterTask>>> taskSource = null)
|
||||
{
|
||||
var actions = AuftragDbContext.Eregister_Shared.LoadActions(this.sharedId);
|
||||
var parametersList = AuftragDbContext.LoadEregisterProgrammingParametersListForSharedId(this.sharedId);
|
||||
|
||||
var uriFormat = Appsettings.Get("EncryptionKeisUrl");
|
||||
var httpClient = new HttpClient();
|
||||
|
||||
foreach (var epp in parametersList)
|
||||
{
|
||||
var finalAddress = actions.FirstOrDefault(x => x.SerialNr == epp.SerienNr).FinalAddress;
|
||||
var tempAddress = actions.FirstOrDefault(x => x.SerialNr == epp.SerienNr).TempAddress;
|
||||
|
||||
epp.Adresse = finalAddress;
|
||||
epp.TempAdresse = tempAddress;
|
||||
|
||||
using (var httpResponeMessage = await httpClient.GetAsync(string.Format(uriFormat, epp.SerienNr)))
|
||||
{
|
||||
if (httpResponeMessage.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await httpResponeMessage.Content?.ReadAsStringAsync();
|
||||
epp.EncryptionKey = content?.Trim('"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (taskSource != null)
|
||||
{
|
||||
|
||||
var programmingTasksEnumerable = taskSource(parametersList);
|
||||
|
||||
var col = 0;
|
||||
var row = 0;
|
||||
var tasks = new List<GridItem>();
|
||||
|
||||
col = 0;
|
||||
row = 0;
|
||||
|
||||
foreach (var programmingTasks in programmingTasksEnumerable)
|
||||
{
|
||||
var firstOrDefault = programmingTasks.FirstOrDefault();
|
||||
|
||||
tasks.Add(new EregisterHeaderVM
|
||||
{
|
||||
Column = col++,
|
||||
Frequency = $"{firstOrDefault?.Frequency ?? 0}MHz",
|
||||
PoNr = firstOrDefault?.PoNr ?? 0,
|
||||
Row = row,
|
||||
SerialNr = firstOrDefault?.SerialNr ?? 0,
|
||||
SlotNr = firstOrDefault?.SlotNr ?? 0
|
||||
});
|
||||
}
|
||||
|
||||
col = 0;
|
||||
row = 1;
|
||||
|
||||
foreach (var programmingTasks in programmingTasksEnumerable)
|
||||
{
|
||||
foreach (var programmingTask in programmingTasks)
|
||||
{
|
||||
tasks.Add(new EregisterTaskVM(programmingTask, col, row++));
|
||||
}
|
||||
|
||||
col += 1;
|
||||
row = 1;
|
||||
}
|
||||
|
||||
this.ProgrammingTasks = tasks;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.Hardware.SIRT;
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
|
||||
internal class EregisterTaskVM : GridItem
|
||||
{
|
||||
private readonly EregisterTask task;
|
||||
@@ -38,6 +38,20 @@
|
||||
set => this.Set(() => this.rssi = value);
|
||||
}
|
||||
|
||||
private bool isEncrypted;
|
||||
public bool IsEncrypted
|
||||
{
|
||||
get => this.isEncrypted;
|
||||
set => this.Set(() => this.isEncrypted = value);
|
||||
}
|
||||
|
||||
private bool isSealed;
|
||||
public bool IsSealed
|
||||
{
|
||||
get => this.isSealed;
|
||||
set => this.Set(() => this.isSealed = value);
|
||||
}
|
||||
|
||||
private void UpdateState(EregisterTask task)
|
||||
=> this.InvokeAsync(() =>
|
||||
{
|
||||
@@ -45,6 +59,8 @@
|
||||
this.Label = task.Label;
|
||||
this.Address = task.RequestAddress;
|
||||
this.RSSI = task.RSSI;
|
||||
this.IsEncrypted = task.IsEncrypted;
|
||||
this.IsSealed = task.Mode == FactoryState.Shipment;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
using Common.Hardware.WaterMeter.eRegister;
|
||||
using Common.Hardware.WaterMeter.eRegister.Features;
|
||||
using Common.Hardware.WaterMeter.eRegister.Models;
|
||||
using Common.UI.Data;
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Models;
|
||||
|
||||
@@ -120,7 +119,7 @@
|
||||
|
||||
public ObservableCollection<KvpViewModel> EregisterProperties { get; }
|
||||
|
||||
internal override void ViewModel_Loaded()
|
||||
internal override void ViewModel_Loaded(object _)
|
||||
{
|
||||
this.UpdateComports();
|
||||
|
||||
@@ -139,12 +138,15 @@
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(this.COMPort))
|
||||
{
|
||||
this.broadcaster = this.sirtFactory.ConnectSIRT(this.COMPort);
|
||||
this.broadcaster.Activated += this.Broadcaster_Activated;
|
||||
this.broadcaster.Connected += this.Broadcaster_Connected;
|
||||
this.broadcaster.Disconnected += this.Broadcaster_Disconnected;
|
||||
this.broadcaster.Logging += this.Broadcaster_Log;
|
||||
this.broadcaster.MessageReceived += this.GetAvailableAddresses;
|
||||
this.sirtFactory.ConnectSIRT(this.COMPort, broadcaster =>
|
||||
{
|
||||
this.broadcaster = broadcaster;
|
||||
this.broadcaster.Activated += this.Broadcaster_Activated;
|
||||
this.broadcaster.Connected += this.Broadcaster_Connected;
|
||||
this.broadcaster.Disconnected += this.Broadcaster_Disconnected;
|
||||
this.broadcaster.Logging += this.Broadcaster_Log;
|
||||
this.broadcaster.MessageReceived += this.GetAvailableAddresses;
|
||||
});
|
||||
|
||||
this.IsConnected = false;
|
||||
this.IsConnectEnabled = false;
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Common.UI.ViewModels
|
||||
{
|
||||
using Common.UI.Infrastructure;
|
||||
using Common.UI.Infrastructure.Contracts;
|
||||
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
internal class MainMenuVM : ViewModel<MainMenuVM>
|
||||
{
|
||||
private readonly INavigation navigation;
|
||||
|
||||
public MainMenuVM() : base()
|
||||
{
|
||||
this.navigation = AppHost.GetService<INavigation>();
|
||||
this.NavigateCommand = new Command<string>(this.NavigateCommandHandler);
|
||||
}
|
||||
|
||||
public ICommand NavigateCommand { get; }
|
||||
|
||||
private void NavigateCommandHandler(string uri)
|
||||
=> this.navigation.Navigate(new Uri(uri, UriKind.RelativeOrAbsolute));
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -79,14 +78,23 @@
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(this.PortName))
|
||||
{
|
||||
var connection = this.broadcaster.ConnectSIRT(this.PortName);
|
||||
var connectionVM = new SIRTConnectionVM(connection);
|
||||
connectionVM.Removed += this.RemoveSIRTConnectionVM;
|
||||
this.Connections.Add(connectionVM);
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.broadcaster.ConnectSIRT(this.PortName, broadcaster =>
|
||||
{
|
||||
var broadcasterVM = new SIRTConnectionVM(broadcaster);
|
||||
broadcasterVM.Removed += this.RemoveSIRTConnectionVM;
|
||||
|
||||
this.ClearEnabled = true;
|
||||
this.PortName = default(string);
|
||||
this.UpdatePortNames();
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.Connections.Add(broadcasterVM);
|
||||
});
|
||||
});
|
||||
|
||||
this.ClearEnabled = true;
|
||||
this.PortName = default(string);
|
||||
this.UpdatePortNames();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +105,7 @@
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.broadcaster.CloseConnections();
|
||||
this.broadcaster.RemoveConnections();
|
||||
this.InvokeAsync(this.Connections.Clear);
|
||||
this.UpdatePortNames();
|
||||
});
|
||||
@@ -125,29 +133,34 @@
|
||||
|
||||
private void AddSIRTs()
|
||||
{
|
||||
var portNames = Appsettings
|
||||
.Get("SIRTComPorts")
|
||||
?.Split(new[] { ';', ',', ' ' })
|
||||
?.Select(x => x?.Trim())
|
||||
?.ToArray() ?? new string[0];
|
||||
|
||||
portNames = SerialPort
|
||||
.GetPortNames()
|
||||
.Intersect(portNames)
|
||||
.ToArray();
|
||||
|
||||
Task.Run(async () =>
|
||||
{
|
||||
var portNames = Appsettings
|
||||
.Get("SIRTComPorts")
|
||||
?.Split(new[] { ';', ',', ' ' })
|
||||
?.Select(x => x?.Trim())
|
||||
?.ToArray() ?? new string[0];
|
||||
|
||||
portNames = SerialPort
|
||||
.GetPortNames()
|
||||
.Intersect(portNames)
|
||||
.ToArray();
|
||||
|
||||
foreach (var portName in portNames)
|
||||
{
|
||||
this.InvokeAsync(() =>
|
||||
this.broadcaster.ConnectSIRT(portName, broadcaster =>
|
||||
{
|
||||
var connection = this.broadcaster.ConnectSIRT(portName);
|
||||
var sirtVM = new SIRTConnectionVM(connection);
|
||||
this.Connections.Add(sirtVM);
|
||||
this.ClearEnabled = true;
|
||||
var broadcasterVM = new SIRTConnectionVM(broadcaster);
|
||||
broadcasterVM.Removed += this.RemoveSIRTConnectionVM;
|
||||
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.Connections.Add(broadcasterVM);
|
||||
});
|
||||
});
|
||||
|
||||
this.ClearEnabled = true;
|
||||
|
||||
await Task.Delay(500);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,8 +81,10 @@
|
||||
|
||||
public ICommand RemoveCommand { get; }
|
||||
|
||||
private void RemoveCommand_Handler()
|
||||
=> this.Removed?.Invoke(this);
|
||||
private void RemoveCommand_Handler()
|
||||
{
|
||||
this.Removed?.Invoke(this);
|
||||
}
|
||||
|
||||
private void DisconnectCommand_Handler()
|
||||
{
|
||||
@@ -91,11 +93,7 @@
|
||||
this.RemoveEnabled = false;
|
||||
this.IsRunning = null;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.connection.Close();
|
||||
this.UpdateState(this.connection);
|
||||
});
|
||||
Task.Run((Action)this.connection.Close);
|
||||
}
|
||||
|
||||
private void ReconnectCommand_Handler()
|
||||
@@ -108,7 +106,6 @@
|
||||
Task.Run(() =>
|
||||
{
|
||||
this.connection.Close();
|
||||
this.UpdateState(this.connection);
|
||||
this.connection.Open();
|
||||
});
|
||||
}
|
||||
@@ -142,9 +139,12 @@
|
||||
|
||||
private void UpdateState(SIRTBroadcaster connection)
|
||||
{
|
||||
this.PortName = connection.COMPort;
|
||||
this.HexId = connection.HexId;
|
||||
this.Frequency = $"{connection.Frequency}MHz";
|
||||
this.InvokeAsync(() =>
|
||||
{
|
||||
this.PortName = connection.COMPort;
|
||||
this.HexId = connection.HexId;
|
||||
this.Frequency = $"{connection.Frequency}MHz";
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace Common.UI.Views
|
||||
{
|
||||
using System.Windows.Controls;
|
||||
|
||||
public partial class MainMenuView : Menu
|
||||
{
|
||||
public MainMenuView() => this.InitializeComponent();
|
||||
}
|
||||
}
|
||||
+4
@@ -5,5 +5,9 @@
|
||||
public interface IStandardRequirementRepository<T> : IRepository<T>
|
||||
{
|
||||
T FirstOrDefaultByPO(String ponr);
|
||||
|
||||
void Approve(int id, string name);
|
||||
|
||||
void Unapprove(int id);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -16,12 +16,16 @@
|
||||
|
||||
[Display(Name = "Bearbeiter", Description = "Name des Bearbeiters. Nicht änderbar!")]
|
||||
[Required]
|
||||
public String ApprovalName { get; set; }
|
||||
public String CreatedBy { get; set; }
|
||||
|
||||
[Display(Name = "Kommentar", Description = "Kommentar über die änderungen.")]
|
||||
public String ApprovalComment { get; set; }
|
||||
public String Comment { get; set; }
|
||||
|
||||
[Display(Name = "ist zur Produktion freigegeben", Description = "Ist zur Produktion freigegeben.")]
|
||||
public Boolean IsActive { get; set; }
|
||||
|
||||
public string ApprovedBy { get; set; }
|
||||
|
||||
public DateTime? ApprovedDate { get; set; }
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -214,21 +214,25 @@
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
public DateTime? ApprovedDate { get; set; }
|
||||
|
||||
public String ApprovedBy { get; set; }
|
||||
|
||||
[Display(Name = nameof(UITranslations.Requirements_ApprovalName_Name)
|
||||
, Description = nameof(UITranslations.Requirements_ApprovalName_Description)
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
[Required(ErrorMessageResourceName = nameof(UITranslations.Requirements_ApprovalName_IsRequired)
|
||||
, ErrorMessageResourceType = typeof(UITranslations))]
|
||||
public String ApprovalName { get; set; }
|
||||
public String CreatedBy { get; set; }
|
||||
|
||||
[Display(Name = nameof(UITranslations.Requirements_ApprovalComment_Name)
|
||||
, Description = nameof(UITranslations.Requirements_ApprovalComment_Description)
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
[Required(ErrorMessageResourceName = nameof(UITranslations.Requirements_ApprovalComment_IsRequired)
|
||||
, ErrorMessageResourceType = typeof(UITranslations))]
|
||||
public String ApprovalComment
|
||||
public String Comment
|
||||
{
|
||||
get => this.comment ?? this.StandardRequirement?.ApprovalComment;
|
||||
get => this.comment ?? this.StandardRequirement?.Comment;
|
||||
set => this.comment = value;
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -107,19 +107,23 @@
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
public DateTime Timestamp { get; set; }
|
||||
|
||||
public DateTime? ApprovedDate { get; set; }
|
||||
|
||||
public String ApprovedBy { get; set; }
|
||||
|
||||
[Display(Name = nameof(UITranslations.Requirements_ApprovalName_Name)
|
||||
, Description = nameof(UITranslations.Requirements_ApprovalName_Description)
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
[Required(ErrorMessageResourceName = nameof(UITranslations.Requirements_ApprovalName_IsRequired)
|
||||
, ErrorMessageResourceType = typeof(UITranslations))]
|
||||
public String ApprovalName { get; set; }
|
||||
public String CreatedBy { get; set; }
|
||||
|
||||
[Display(Name = nameof(UITranslations.Requirements_ApprovalComment_Name)
|
||||
, Description = nameof(UITranslations.Requirements_ApprovalComment_Description)
|
||||
, ResourceType = typeof(UITranslations))]
|
||||
[Required(ErrorMessageResourceName = nameof(UITranslations.Requirements_ApprovalComment_IsRequired)
|
||||
, ErrorMessageResourceType = typeof(UITranslations))]
|
||||
public String ApprovalComment { get; set; }
|
||||
public String Comment { get; set; }
|
||||
|
||||
[Display(Name = nameof(UITranslations.Requirements_IsActive_Name)
|
||||
, Description = nameof(UITranslations.Requirements_IsActive_Description)
|
||||
|
||||
+26
-14
@@ -66,8 +66,8 @@
|
||||
, @{nameof(model.QuiescentCurrent_uA)}
|
||||
, @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, GETUTCDATE()
|
||||
, @{nameof(model.ApprovalName)}
|
||||
, @{nameof(model.ApprovalComment)}
|
||||
, @{nameof(model.CreatedBy)}
|
||||
, @{nameof(model.Comment)}
|
||||
, @{nameof(model.IsActive)})")
|
||||
.SetParameter(nameof(model.StandardId), model.StandardId)
|
||||
.SetParameter(nameof(model.StandardVersion), model.StandardVersion)
|
||||
@@ -86,8 +86,8 @@
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.ApprovalName), model.ApprovalName)
|
||||
.SetParameter(nameof(model.ApprovalComment), model.ApprovalComment)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.ExecuteScalar(x => x.GetValue<Int32>(0));
|
||||
|
||||
@@ -134,6 +134,8 @@
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
@@ -181,6 +183,8 @@
|
||||
, [Special].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Special].[Timestamp]
|
||||
, [Special].[CreatedBy]
|
||||
, [Special].[ApprovedBy]
|
||||
, [Special].[ApprovedDate]
|
||||
, [Special].[Comment]
|
||||
, [Special].[IsActive]
|
||||
FROM [Cordonel_Special_Requirements] AS [Special]
|
||||
@@ -252,6 +256,8 @@
|
||||
, [Latest].[EstimatedProductionBatteryLoadPercent]
|
||||
, [Latest].[Timestamp]
|
||||
, [Latest].[CreatedBy]
|
||||
, [Latest].[ApprovedBy]
|
||||
, [Latest].[ApprovedDate]
|
||||
, [Latest].[Comment]
|
||||
, [Latest].[IsActive]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
@@ -287,8 +293,8 @@
|
||||
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
|
||||
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, [Timestamp] = @{nameof(model.Timestamp)}
|
||||
, [CreatedBy] = @{nameof(model.ApprovalName)}
|
||||
, [Comment] = @{nameof(model.ApprovalComment)}
|
||||
, [CreatedBy] = @{nameof(model.CreatedBy)}
|
||||
, [Comment] = @{nameof(model.Comment)}
|
||||
, [IsActive] = @{nameof(model.IsActive)}
|
||||
WHERE [Id] = @{nameof(model.Id)}
|
||||
AND [Version] = (SELECT MAX([Version])
|
||||
@@ -307,8 +313,8 @@
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.ApprovalName), model.ApprovalName)
|
||||
.SetParameter(nameof(model.ApprovalComment), model.ApprovalComment)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.SetParameter(nameof(model.Id), model.Id)
|
||||
.ExecuteNonQuery();
|
||||
@@ -326,6 +332,8 @@
|
||||
, [Version]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Special_Requirements]
|
||||
@@ -339,9 +347,11 @@
|
||||
Id = x.GetValue<Int32>(0),
|
||||
Version = x.GetValue<Int32>(1),
|
||||
Timestamp = x.GetValue<DateTime>(2),
|
||||
ApprovalName = x.GetValue<String>(3),
|
||||
ApprovalComment = x.GetValue<String>(4),
|
||||
IsActive = x.GetValue<Boolean>(5),
|
||||
CreatedBy = x.GetValue<String>(3),
|
||||
ApprovedBy = x.GetValue<String>(4),
|
||||
ApprovedDate = x.GetValue<DateTime?>(5),
|
||||
Comment = x.GetValue<String>(6),
|
||||
IsActive = x.GetValue<Boolean>(7),
|
||||
});
|
||||
|
||||
private CordonelSpecialRequirement ParseSpecialRequirement(SqlReader reader)
|
||||
@@ -369,9 +379,11 @@
|
||||
QuiescentCurrent_uA = reader.GetValue<Double?>(19),
|
||||
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(20),
|
||||
Timestamp = reader.GetValue<DateTime>(21),
|
||||
ApprovalName = reader.GetValue<String>(22),
|
||||
ApprovalComment = reader.GetValue<String>(23),
|
||||
IsActive = reader.GetValue<Boolean>(24)
|
||||
CreatedBy = reader.GetValue<String>(22),
|
||||
ApprovedBy = reader.GetValue<String>(23),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(24),
|
||||
Comment = reader.GetValue<String>(25),
|
||||
IsActive = reader.GetValue<Boolean>(26)
|
||||
};
|
||||
|
||||
private CordonelStandardRequirement StandardRequirement(Int32? standardId)
|
||||
|
||||
+58
-10
@@ -22,6 +22,25 @@
|
||||
public CordonelStandardRequirement Add(CordonelStandardRequirement _)
|
||||
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be created.");
|
||||
|
||||
public void Approve(int requirementId, string approval)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Standard_Requirements
|
||||
SET ApprovedBy = @{nameof(approval)}
|
||||
, ApprovedDate = GETDATE()
|
||||
FROM Cordonel_Standard_Requirements AS stdup
|
||||
JOIN (SELECT TOP 1 std.Id, std.Version
|
||||
FROM Cordonel_Standard_Requirements AS std
|
||||
WHERE std.Id = @{nameof(requirementId)}
|
||||
AND std.CreatedBy <> @{nameof(approval)}
|
||||
ORDER BY std.Version DESC) AS idv
|
||||
ON stdup.Id = idv.Id
|
||||
AND stdup.Version = idv.Version
|
||||
WHERE stdup.IsActive = 1")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.SetParameter(nameof(approval), approval)
|
||||
.ExecuteNonQuery();
|
||||
|
||||
public CordonelStandardRequirement Delete(Object id)
|
||||
=> throw new NotImplementedException($"{nameof(CordonelStandardRequirement)} could not be deleted");
|
||||
|
||||
@@ -49,6 +68,8 @@
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
@@ -90,6 +111,8 @@
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM [Cordonel_Standard_Requirements]
|
||||
@@ -132,6 +155,8 @@
|
||||
, [STD].[EstimatedProductionBatteryLoadPercent]
|
||||
, [STD].[Timestamp]
|
||||
, [STD].[CreatedBy]
|
||||
, [STD].[ApprovedBy]
|
||||
, [STD].[ApprovedDate]
|
||||
, [STD].[Comment]
|
||||
, [STD].[IsActive]
|
||||
FROM [Cordonel_Standard_Requirements] AS [STD]
|
||||
@@ -172,6 +197,8 @@
|
||||
, [EstimatedProductionBatteryLoadPercent]
|
||||
, [Timestamp]
|
||||
, [CreatedBy]
|
||||
, [ApprovedBy]
|
||||
, [ApprovedDate]
|
||||
, [Comment]
|
||||
, [IsActive]
|
||||
FROM (SELECT *, RANK() OVER (PARTITION BY [Id]
|
||||
@@ -203,8 +230,8 @@
|
||||
, [QuiescentCurrent_uA] = @{nameof(model.QuiescentCurrent_uA)}
|
||||
, [EstimatedProductionBatteryLoadPercent] = @{nameof(model.EstimatedProductionBatteryLoadPercent)}
|
||||
, [Timestamp] = @{nameof(model.Timestamp)}
|
||||
, [CreatedBy] = @{nameof(model.ApprovalName)}
|
||||
, [Comment] = @{nameof(model.ApprovalComment)}
|
||||
, [CreatedBy] = @{nameof(model.CreatedBy)}
|
||||
, [Comment] = @{nameof(model.Comment)}
|
||||
, [IsActive] = @{nameof(model.IsActive)}
|
||||
WHERE [Id] = @{nameof(model.Id)}
|
||||
AND [Version] = (SELECT MAX([Version])
|
||||
@@ -223,8 +250,8 @@
|
||||
.SetParameter(nameof(model.QuiescentCurrent_uA), model.QuiescentCurrent_uA)
|
||||
.SetParameter(nameof(model.EstimatedProductionBatteryLoadPercent), model.EstimatedProductionBatteryLoadPercent)
|
||||
.SetParameter(nameof(model.Timestamp), model.Timestamp)
|
||||
.SetParameter(nameof(model.ApprovalName), model.ApprovalName)
|
||||
.SetParameter(nameof(model.ApprovalComment), model.ApprovalComment)
|
||||
.SetParameter(nameof(model.CreatedBy), model.CreatedBy)
|
||||
.SetParameter(nameof(model.Comment), model.Comment)
|
||||
.SetParameter(nameof(model.IsActive), model.IsActive)
|
||||
.SetParameter(nameof(model.Id), model.Id)
|
||||
.ExecuteNonQuery();
|
||||
@@ -257,9 +284,11 @@
|
||||
QuiescentCurrent_uA = reader.GetValue<Double?>(16),
|
||||
EstimatedProductionBatteryLoadPercent = reader.GetValue<Double?>(17),
|
||||
Timestamp = reader.GetValue<DateTime>(18),
|
||||
ApprovalName = reader.GetValue<String>(19),
|
||||
ApprovalComment = reader.GetValue<String>(20),
|
||||
IsActive = reader.GetValue<Boolean>(21),
|
||||
CreatedBy = reader.GetValue<String>(19),
|
||||
ApprovedBy = reader.GetValue<String>(20),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(21),
|
||||
Comment = reader.GetValue<String>(22),
|
||||
IsActive = reader.GetValue<Boolean>(23),
|
||||
};
|
||||
|
||||
private IEnumerable<CordonelRequirementsChange> History(Int32 id, Int32 nr)
|
||||
@@ -282,9 +311,28 @@
|
||||
Id = reader.GetValue<Int32>(0),
|
||||
Version = reader.GetValue<Int32>(1),
|
||||
Timestamp = reader.GetValue<DateTime>(2),
|
||||
ApprovalName = reader.GetValue<String>(3),
|
||||
ApprovalComment = reader.GetValue<String>(4),
|
||||
IsActive = reader.GetValue<Boolean>(5),
|
||||
CreatedBy = reader.GetValue<String>(3),
|
||||
ApprovedBy = reader.GetValue<String>(4),
|
||||
ApprovedDate = reader.GetValue<DateTime?>(5),
|
||||
Comment = reader.GetValue<String>(6),
|
||||
IsActive = reader.GetValue<Boolean>(7),
|
||||
});
|
||||
|
||||
public void Unapprove(int requirementId)
|
||||
=> this.sqlConnection
|
||||
.CreateCommand($@"
|
||||
UPDATE Cordonel_Standard_Requirements
|
||||
SET ApprovedBy = NULL
|
||||
, ApprovedDate = NULL
|
||||
FROM Cordonel_Standard_Requirements AS stdup
|
||||
JOIN (SELECT TOP 1 std.Id, std.Version
|
||||
FROM Cordonel_Standard_Requirements AS std
|
||||
WHERE std.Id = @{nameof(requirementId)}
|
||||
ORDER BY std.Version DESC) AS idv
|
||||
ON stdup.Id = idv.Id
|
||||
AND stdup.Version = idv.Version
|
||||
WHERE stdup.IsActive = 1")
|
||||
.SetParameter(nameof(requirementId), requirementId)
|
||||
.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1014,6 +1014,10 @@
|
||||
{
|
||||
this.ThrowSentinelException(nameof(TryGetUniqueProductionData), $"{nameof(CordonelProductionData)} mehrdeutig - ({productionDataArray.Length}) Datensätze gefunden für PcbId: {pcbId}");
|
||||
}
|
||||
else if (productionData.StatusFertigung != 30)
|
||||
{
|
||||
this.ThrowSentinelException(nameof(TryGetUniqueProductionData), $"{nameof(productionData.StatusFertigung)} != 30");
|
||||
}
|
||||
|
||||
productionData = productionDataArray[0];
|
||||
}
|
||||
|
||||
@@ -60,5 +60,22 @@ namespace LaaProduction.Personalization
|
||||
WEB_Shipment,
|
||||
WEB_Wildcard,
|
||||
WEB_Passwords,
|
||||
|
||||
//// Standard requirements
|
||||
//// - Edit
|
||||
//// - Approve
|
||||
//WEB_Std_Requirements_Edit,
|
||||
//WEB_Std_Requirements_Approve,
|
||||
|
||||
//// Special requirements
|
||||
//// - Create
|
||||
//// - Edit
|
||||
//// - Approve
|
||||
//WEB_Spl_Requirements_Create,
|
||||
//WEB_Spl_Requirements_Edit,
|
||||
//WEB_Spl_Requirements_Approve,
|
||||
|
||||
//// Full requirements control
|
||||
WEB_Requirements_Approve,
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
{
|
||||
using LaaProduction.Data.Cordonel;
|
||||
using LaaProduction.Data.Cordonel.Models;
|
||||
using LaaProduction.Personalization;
|
||||
using LaaProductionWeb.App_Infrastructure;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Http;
|
||||
|
||||
[RoutePrefix(RoutePrefixes.API_CORDONEL_STANDARDREQUIREMENTS)]
|
||||
@@ -18,7 +20,11 @@
|
||||
[HttpGet]
|
||||
[Route]
|
||||
public IHttpActionResult Get()
|
||||
=> this.Json(this.cordonels.StandardRequirements);
|
||||
{
|
||||
var standardRequirements = this.cordonels.StandardRequirements.ToList();
|
||||
|
||||
return this.Json(standardRequirements);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
@@ -83,5 +89,27 @@
|
||||
|
||||
return this.Json(result);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Route("Approve/{id}")]
|
||||
[AuthorizeBearer]
|
||||
[AllowedRoles(EmployeesRoles.WEB_Approvals)]
|
||||
public IHttpActionResult Approve([FromUri] int id)
|
||||
{
|
||||
this.cordonels.StandardRequirements.Approve(id, this.User.FullName());
|
||||
|
||||
return this.Ok(id);
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Route("Unapprove/{id}")]
|
||||
[AuthorizeBearer]
|
||||
[AllowedRoles(EmployeesRoles.WEB_Approvals)]
|
||||
public IHttpActionResult Unapprove([FromUri] int id)
|
||||
{
|
||||
this.cordonels.StandardRequirements.Unapprove(id);
|
||||
|
||||
return this.Ok(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,10 @@ td .field-validation-error {
|
||||
|
||||
.tr-hover:hover {
|
||||
cursor: pointer;
|
||||
background: var(--bs-light);
|
||||
}
|
||||
|
||||
.tr-hover:hover > * {
|
||||
background-color: aliceblue !important;
|
||||
}
|
||||
|
||||
.form-floating-popover {
|
||||
|
||||
@@ -122,28 +122,22 @@
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="httpContext"> usualy <see cref="HttpContextBase"/> implementation.</param>
|
||||
public static void SetUrlReferer(this HttpContextBase httpContext)
|
||||
public static void SetUrlReferer(this HttpContextBase httpContext, string urlReferer = null)
|
||||
{
|
||||
var currentUrl = httpContext
|
||||
.Request
|
||||
.Url
|
||||
.AbsolutePath
|
||||
.Trim('/');
|
||||
var exludeUrl = new[]
|
||||
if (string.IsNullOrWhiteSpace(urlReferer))
|
||||
{
|
||||
"Index",
|
||||
"Logout",
|
||||
//"Create",
|
||||
//"Update",
|
||||
//"Delete",
|
||||
};
|
||||
var requestUrl = httpContext.Request.Url;
|
||||
var requestPath = requestUrl.AbsolutePath.Trim('/');
|
||||
var exludeUrl = new[] { "Index", "Logout" };
|
||||
|
||||
if (currentUrl != "LaaProductionWeb" && exludeUrl.All(x => !currentUrl.Contains(x)))
|
||||
if (requestPath != "LaaProductionWeb" && exludeUrl.All(x => !requestPath.Contains(x)))
|
||||
{
|
||||
httpContext.Response.Cookies.Add(new HttpCookie(URL_REFERER, $"{requestUrl}"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
httpContext
|
||||
.Response
|
||||
.Cookies
|
||||
.Add(new HttpCookie(URL_REFERER, $"{httpContext.Request.Url}"));
|
||||
httpContext.Response.Cookies.Add(new HttpCookie(URL_REFERER, urlReferer));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class HttpUpdateRequirementAttribute : ActionFilterAttribute
|
||||
{
|
||||
public override void OnResultExecuting(ResultExecutingContext filterContext)
|
||||
{
|
||||
var httpContext = filterContext.HttpContext;
|
||||
var requestUrl = httpContext?.Request?.Url?.ToString() ?? string.Empty;
|
||||
var ix = requestUrl.LastIndexOf('/');
|
||||
var id = string.Empty;
|
||||
|
||||
if (ix > 0)
|
||||
{
|
||||
id = requestUrl.Substring(ix + 1);
|
||||
requestUrl = requestUrl.Substring(0, ix);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
ix = requestUrl.LastIndexOf('/');
|
||||
requestUrl = requestUrl.Substring(0, ix);
|
||||
|
||||
httpContext.SetUrlReferer($"{requestUrl}#{id}");
|
||||
}
|
||||
}
|
||||
|
||||
base.OnResultExecuting(filterContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
namespace LaaProductionWeb.App_Infrastructure
|
||||
{
|
||||
using System.Web.Mvc;
|
||||
|
||||
public class HttpUpdateStandardRequirementAttribute : ActionFilterAttribute
|
||||
{
|
||||
public override void OnResultExecuting(ResultExecutingContext filterContext)
|
||||
{
|
||||
var httpContext = filterContext.HttpContext;
|
||||
var request = httpContext.Request;
|
||||
var requestUrl = request.Url.ToString();
|
||||
var pathReferer = request.UrlReferrer
|
||||
?.LocalPath
|
||||
?.Trim('/')
|
||||
?? string.Empty;
|
||||
|
||||
if (!pathReferer.EndsWith("StandardRequirements"))
|
||||
{
|
||||
var ix = requestUrl.LastIndexOf('/');
|
||||
var id = requestUrl.Substring(ix + 1);
|
||||
requestUrl = requestUrl.Substring(0, ix);
|
||||
ix = requestUrl.LastIndexOf('/');
|
||||
requestUrl = requestUrl.Substring(0, ix);
|
||||
filterContext.Result = new RedirectResult($"{requestUrl}#{id}");
|
||||
|
||||
filterContext.Result.ExecuteResult(filterContext.Controller.ControllerContext);
|
||||
}
|
||||
|
||||
base.OnResultExecuting(filterContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@
|
||||
return this.PartialView(new CordonelSpecialRequirement
|
||||
{
|
||||
Timestamp = DateTime.Now,
|
||||
ApprovalName = this.User.FullName()
|
||||
CreatedBy = this.User.FullName()
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
var requirement = new CordonelSpecialRequirement
|
||||
{
|
||||
Timestamp = DateTime.UtcNow,
|
||||
ApprovalName = this.User.FullName()
|
||||
CreatedBy = this.User.FullName()
|
||||
};
|
||||
|
||||
requirement.StandardRequirement = this.http
|
||||
@@ -144,12 +144,13 @@
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("SpecialRequirements/Update/{id}/{nr}")]
|
||||
[HttpUpdateRequirement]
|
||||
[Route("SpecialRequirements/Update/{id}")]
|
||||
public ActionResult Update(String id, String nr)
|
||||
{
|
||||
var requirement = this.http
|
||||
.Get<CordonelSpecialRequirement>(x => x
|
||||
.SetPath(RoutePrefixes.API_CORDONEL_SPECIALREQUIREMENTS.ToURL($"{id}/{nr}")))
|
||||
.SetPath(RoutePrefixes.API_CORDONEL_SPECIALREQUIREMENTS.ToURL($"{id}")))
|
||||
.Value;
|
||||
|
||||
if (requirement is null)
|
||||
@@ -157,10 +158,19 @@
|
||||
return this.PartialView(nameof(Create), new CordonelSpecialRequirement());
|
||||
}
|
||||
|
||||
var user = this.User.FullName();
|
||||
this.ViewData["CanApprove"]
|
||||
= !string.IsNullOrWhiteSpace(requirement?.CreatedBy)
|
||||
&& string.IsNullOrWhiteSpace(requirement?.ApprovedBy)
|
||||
&& requirement.CreatedBy != user;
|
||||
this.ViewData["CanUnapprove"] = requirement.ApprovedBy == user;
|
||||
|
||||
return this.PartialView(requirement);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HttpUpdateRequirement]
|
||||
[Route("SpecialRequirements/Update")]
|
||||
public ActionResult Update(CordonelSpecialRequirement model)
|
||||
{
|
||||
if (this.ModelState.IsValid)
|
||||
@@ -176,6 +186,13 @@
|
||||
return this.PartialView(nameof(Create), new CordonelSpecialRequirement());
|
||||
}
|
||||
|
||||
var user = this.User.FullName();
|
||||
this.ViewData["CanApprove"]
|
||||
= !string.IsNullOrWhiteSpace(requirement?.CreatedBy)
|
||||
&& string.IsNullOrWhiteSpace(requirement?.ApprovedBy)
|
||||
&& requirement.CreatedBy != user;
|
||||
this.ViewData["CanUnapprove"] = requirement.ApprovedBy == user;
|
||||
|
||||
model = requirement;
|
||||
}
|
||||
|
||||
@@ -201,5 +218,27 @@
|
||||
|
||||
return this.PartialView(requirements);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("SpecialRequirements/Approve/{id}")]
|
||||
public ActionResult Approve(string id)
|
||||
{
|
||||
var response = this.http
|
||||
.SetBearer(this.bearer)
|
||||
.Put(x => x.SetPath(RoutePrefixes.API_CORDONEL_SPECIALREQUIREMENTS.ToURL($"Approve/{id}")));
|
||||
|
||||
return this.Redirect(this.HttpContext.GetUrlReferer());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("SpecialRequirements/Unapprove/{id}/")]
|
||||
public ActionResult Unapprove(string id)
|
||||
{
|
||||
var response = this.http
|
||||
.SetBearer(this.bearer)
|
||||
.Put(x => x.SetPath(RoutePrefixes.API_CORDONEL_SPECIALREQUIREMENTS.ToURL($"Unapprove/{id}")));
|
||||
|
||||
return this.Redirect(this.HttpContext.GetUrlReferer());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,20 +28,28 @@
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpUpdateStandardRequirement]
|
||||
[HttpUpdateRequirement]
|
||||
public ActionResult Update(String id)
|
||||
{
|
||||
var requirement = this.http
|
||||
.Get<CordonelStandardRequirement>(x => x.SetPath(RoutePrefixes.API_CORDONEL_STANDARDREQUIREMENTS.ToURL($"{id}")))
|
||||
.Value ?? new CordonelStandardRequirement();
|
||||
requirement.ApprovalName = this.User.FullName();
|
||||
|
||||
var user = this.User.FullName();
|
||||
this.ViewData["CanApprove"]
|
||||
= !string.IsNullOrWhiteSpace(requirement?.CreatedBy)
|
||||
&& string.IsNullOrWhiteSpace(requirement?.ApprovedBy)
|
||||
&& requirement.CreatedBy != user;
|
||||
this.ViewData["CanUnapprove"] = requirement.ApprovedBy == user;
|
||||
|
||||
requirement.CreatedBy = this.User.FullName();
|
||||
requirement.Timestamp = DateTime.UtcNow;
|
||||
|
||||
return this.PartialView(requirement);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HttpUpdateStandardRequirement]
|
||||
[HttpUpdateRequirement]
|
||||
public ActionResult Update(CordonelStandardRequirement model)
|
||||
{
|
||||
var requirement = this.http
|
||||
@@ -50,6 +58,13 @@
|
||||
.SetJsonBody(model))
|
||||
.Value ?? model;
|
||||
|
||||
var user = this.User.FullName();
|
||||
this.ViewData["CanApprove"]
|
||||
= !string.IsNullOrWhiteSpace(requirement?.CreatedBy)
|
||||
&& string.IsNullOrWhiteSpace(requirement?.ApprovedBy)
|
||||
&& requirement.CreatedBy != user;
|
||||
this.ViewData["CanUnapprove"] = requirement.ApprovedBy == user;
|
||||
|
||||
return this.PartialView(requirement);
|
||||
}
|
||||
|
||||
@@ -60,7 +75,7 @@
|
||||
var requirement = this.http
|
||||
.Get<CordonelStandardRequirement>(x => x.SetPath(RoutePrefixes.API_CORDONEL_STANDARDREQUIREMENTS.ToURL($"{id}/{nr}")))
|
||||
.Value ?? new CordonelStandardRequirement();
|
||||
requirement.ApprovalName = this.User.FullName();
|
||||
requirement.CreatedBy = this.User.FullName();
|
||||
requirement.Timestamp = DateTime.UtcNow;
|
||||
|
||||
return this.PartialView(nameof(Update), requirement);
|
||||
@@ -75,5 +90,27 @@
|
||||
|
||||
return this.PartialView(requirement);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("StandardRequirements/Approve/{id}")]
|
||||
public ActionResult Approve(string id)
|
||||
{
|
||||
var response = this.http
|
||||
.SetBearer(this.bearer)
|
||||
.Put<object>(x => x.SetPath(RoutePrefixes.API_CORDONEL_STANDARDREQUIREMENTS.ToURL($"Approve/{id}")));
|
||||
|
||||
return this.Redirect(this.HttpContext.GetUrlReferer());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("StandardRequirements/Unapprove/{id}/")]
|
||||
public ActionResult Unapprove(string id)
|
||||
{
|
||||
var response = this.http
|
||||
.SetBearer(this.bearer)
|
||||
.Put(x => x.SetPath(RoutePrefixes.API_CORDONEL_STANDARDREQUIREMENTS.ToURL($"Unapprove/{id}")));
|
||||
|
||||
return this.Redirect(this.HttpContext.GetUrlReferer());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@
|
||||
<Compile Include="App_Infrastructure\HttpExtensions.cs" />
|
||||
<Compile Include="App_Infrastructure\HttpLaaProductionConnection.cs" />
|
||||
<Compile Include="App_Infrastructure\HttpMeterProcessStateConnection.cs" />
|
||||
<Compile Include="App_Infrastructure\HttpUpdateStandardRequirementAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\HttpUpdateRequirementAttribute.cs" />
|
||||
<Compile Include="App_Infrastructure\Languages.cs" />
|
||||
<Compile Include="App_Infrastructure\MvcController.cs" />
|
||||
<Compile Include="App_Infrastructure\RazorExtensions.cs" />
|
||||
|
||||
@@ -37,15 +37,22 @@
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.MaxStorageMonthsBigOrders)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.QuiescentCurrent_uA)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.EstimatedProductionBatteryLoadPercent)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.CreatedBy)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.Timestamp)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovalName)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovalComment)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovedBy)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovedDate)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.Comment)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (Model != null && Model.Any())
|
||||
{
|
||||
Html.RenderPartial("SpecialRequirements", Model);
|
||||
foreach (var x in this.Model)
|
||||
{
|
||||
<tr id="@x.Id" class="tr-hover" onclick="location.hash = @x.Id">
|
||||
@Html.Partial("TrContent", x)
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -65,112 +72,129 @@
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
function autocompletePO (e) {
|
||||
const value = `${e.target.value}`;
|
||||
fetch(`@this.Url.Action("ProductionOrders", "SpecialRequirements")/${value}`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.getElementById('ProductionOrders')
|
||||
.innerHTML = text);
|
||||
}
|
||||
let modal = document.querySelector('div[id="modal"]');
|
||||
modal.addEventListener('hidden.bs.modal', () => {
|
||||
location.hash = '';
|
||||
});
|
||||
|
||||
function loadModalContent(text, show) {
|
||||
let modal = document.getElementById('modal');
|
||||
function autocompletePO (e) {
|
||||
const value = `${e.target.value}`;
|
||||
fetch(`@this.Url.Action("ProductionOrders", "SpecialRequirements")/${value}`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.getElementById('ProductionOrders')
|
||||
.innerHTML = text);
|
||||
}
|
||||
|
||||
let content = modal.querySelector('.modal-content');
|
||||
content.innerHTML = text;
|
||||
function loadModalContent(text, show) {
|
||||
let content = modal.querySelector('.modal-content');
|
||||
content.innerHTML = text;
|
||||
|
||||
let form = content.querySelector('form[id="create"]');
|
||||
if (form) {
|
||||
form.onsubmit = submitCreateSpecialRequirement;
|
||||
} else {
|
||||
form = content.querySelector('form[id="update"]');
|
||||
let form = content.querySelector('form[id="create"]');
|
||||
if (form) {
|
||||
form.onsubmit = submitUpdateSpecialRequirement;
|
||||
form.onsubmit = submitCreateSpecialRequirement;
|
||||
} else {
|
||||
form = content.querySelector('form[id="update"]');
|
||||
if (form) {
|
||||
form.onsubmit = submitUpdateSpecialRequirement;
|
||||
}
|
||||
}
|
||||
|
||||
let productionOrderNr = content.querySelector('#ProductionOrderNr');
|
||||
productionOrderNr.oninput = autocompletePO;
|
||||
|
||||
if (show) {
|
||||
let trigger = document.getElementById('modal_toggler');
|
||||
trigger.click();
|
||||
}
|
||||
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
_ = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
return new bootstrap.Popover(popoverTriggerEl)
|
||||
});
|
||||
}
|
||||
|
||||
function updatePO(ponr) {
|
||||
let ponrMenu = document.getElementById('ProductionOrders');
|
||||
ponrMenu.classList.remove('show');
|
||||
let ponrin = document.getElementById('ProductionOrderNr');
|
||||
ponrin.value = ponr;
|
||||
const form = document.querySelector('form');
|
||||
|
||||
fetch(`@this.Url.Action("UpdatePO", "SpecialRequirements")`, { method: 'POST', body: new FormData(form) })
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, false))
|
||||
.then(() => fetch(`@this.Url.Action("Pcbids", "SpecialRequirements")/${ponr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.getElementById('PcbId')
|
||||
.innerHTML = text));
|
||||
}
|
||||
|
||||
function createSpecialRequirement() {
|
||||
fetch(`@this.Url.Action("Create", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, true));
|
||||
}
|
||||
|
||||
function submitCreateSpecialRequirement(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
fetch(`@this.Url.Action("Create", "SpecialRequirements")`, { method: 'POST', body: new FormData(e.target) })
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
loadModalContent(text, false);
|
||||
})
|
||||
.then(() => {
|
||||
fetch(`@this.Url.Action("SpecialRequirements", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
document.querySelector('tbody').innerHTML = text;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadSpecialRequirement(id, nr) {
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")/${id}/${nr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, true));
|
||||
}
|
||||
|
||||
function submitUpdateSpecialRequirement(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")`, { method: 'POST', body: new FormData(e.target) })
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
loadModalContent(text, false);
|
||||
fetch(`@this.Url.Action("SpecialRequirements", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.querySelector('tbody')
|
||||
.innerHTML = text);
|
||||
});
|
||||
}
|
||||
|
||||
function loadStandardRequirementVersion(id, nr) {
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")/${id}/${nr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, false));
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
let id = location.hash.substring(1);
|
||||
if (id) {
|
||||
loadSpecialRequirement(id);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (location.hash) {
|
||||
let id = location.hash.substring(1);
|
||||
if (id) {
|
||||
loadSpecialRequirement(id);
|
||||
}
|
||||
}
|
||||
|
||||
let productionOrderNr = content.querySelector('#ProductionOrderNr');
|
||||
productionOrderNr.oninput = autocompletePO;
|
||||
|
||||
if (show) {
|
||||
let trigger = document.getElementById('modal_toggler');
|
||||
trigger.click();
|
||||
}
|
||||
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
return new bootstrap.Popover(popoverTriggerEl)
|
||||
});
|
||||
}
|
||||
|
||||
function updatePO(ponr) {
|
||||
let ponrMenu = document.getElementById('ProductionOrders');
|
||||
ponrMenu.classList.remove('show');
|
||||
let ponrin = document.getElementById('ProductionOrderNr');
|
||||
ponrin.value = ponr;
|
||||
const form = document.querySelector('form');
|
||||
|
||||
fetch(`@this.Url.Action("UpdatePO", "SpecialRequirements")`, { method: 'POST', body: new FormData(form) })
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, false))
|
||||
.then(() => fetch(`@this.Url.Action("Pcbids", "SpecialRequirements")/${ponr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.getElementById('PcbId')
|
||||
.innerHTML = text));
|
||||
}
|
||||
|
||||
function createSpecialRequirement() {
|
||||
fetch(`@this.Url.Action("Create", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, true));
|
||||
}
|
||||
|
||||
function submitCreateSpecialRequirement(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
fetch(`@this.Url.Action("Create", "SpecialRequirements")`, { method: 'POST', body: new FormData(e.target) })
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
loadModalContent(text, false);
|
||||
})
|
||||
.then(() => {
|
||||
fetch(`@this.Url.Action("SpecialRequirements", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
document.querySelector('tbody').innerHTML = text;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateSpecialRequirement(id, nr) {
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")/${id}/${nr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, true));
|
||||
}
|
||||
|
||||
function submitUpdateSpecialRequirement(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")`, { method: 'POST', body: new FormData(e.target) })
|
||||
.then(response => response.text())
|
||||
.then(text => {
|
||||
loadModalContent(text, false);
|
||||
fetch(`@this.Url.Action("SpecialRequirements", "SpecialRequirements")`)
|
||||
.then(response => response.text())
|
||||
.then(text => document
|
||||
.querySelector('tbody')
|
||||
.innerHTML = text);
|
||||
});
|
||||
}
|
||||
|
||||
function loadStandardRequirementVersion(id, nr) {
|
||||
fetch(`@this.Url.Action("Update", "SpecialRequirements")/${id}/${nr}`)
|
||||
.then(response => response.text())
|
||||
.then(text => loadModalContent(text, false));
|
||||
}
|
||||
</script>
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<th class="text-nowrap small p-2">@($"{Model.Id}.{Model.Version}")</th>
|
||||
<td class="text-nowrap small p-2">@($"{Model.StandardId}.{Model.StandardVersion}")</td>
|
||||
<td class="text-nowrap small p-2">@Model.Region</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Region | @Model.Key</td>
|
||||
<td class="text-nowrap small p-2">@Model.MeterSize</td>
|
||||
<td class="text-nowrap small p-2">@Model.ProductionOrderNr</td>
|
||||
<td class="text-nowrap small p-2">@Model.PcbId</td>
|
||||
@@ -51,6 +51,8 @@
|
||||
<td class="text-nowrap small p-2 text-end">@Model.MaxStorageMonthsBigOrders</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.QuiescentCurrent_uA</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.EstimatedProductionBatteryLoadPercent</td>
|
||||
<td class="text-nowrap small p-2">@Model.Timestamp.ToString("dd-MM-yyyy HH:mm")</td>
|
||||
<td class="text-nowrap small p-2">@Model.ApprovalName</td>
|
||||
<td class="text-nowrap small p-2">@Model.ApprovalComment</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.CreatedBy</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Timestamp.ToString("dd-MM-yyyy HH:mm")</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.ApprovedBy</td>
|
||||
<td class="text-nowrap small px-2 py-1">@(Model.ApprovedDate?.ToString("dd-MM-yyyy HH:mm"))</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Comment</td>
|
||||
@@ -31,9 +31,11 @@
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.MaxStorageMonthsBigOrders)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.QuiescentCurrent_uA)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.EstimatedProductionBatteryLoadPercent)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.CreatedBy)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.Timestamp)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovalName)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovalComment)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovedBy)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.ApprovedDate)</th>
|
||||
<th class="text-smallcaps small p-2">@Html.DisplayNameFor(_ => model.Comment)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -41,7 +43,8 @@
|
||||
{
|
||||
foreach (var x in this.Model)
|
||||
{
|
||||
<tr id="@x.Id" class="tr-hover" onclick="loadStandardRequirement('@x.Id')">
|
||||
<!--onclick="loadStandardRequirement('x.Id')"-->
|
||||
<tr id="@x.Id" class="tr-hover" onclick="location.hash = @x.Id">
|
||||
@Html.Partial("TrContent", x)
|
||||
</tr>
|
||||
}
|
||||
@@ -64,10 +67,18 @@
|
||||
|
||||
@section scripts {
|
||||
<script>
|
||||
let modal = document.querySelector('div[id="modal"]');
|
||||
modal.addEventListener('hidden.bs.modal', () => {
|
||||
location.hash = '';
|
||||
});
|
||||
|
||||
function response2Text(response) {
|
||||
return response.text();
|
||||
}
|
||||
|
||||
function reloadStandardRequirementRow(id) {
|
||||
fetch(`@this.Url.Action("TrContent", "StandardRequirements")/${id}`)
|
||||
.then(response => response.text())
|
||||
.then(response2Text)
|
||||
.then(function handleContent(text) {
|
||||
let tr = document.querySelector(`tr[id="${id}"]`);
|
||||
if (tr) {
|
||||
@@ -77,12 +88,13 @@
|
||||
}
|
||||
|
||||
function setModalInnerHTML (innerHTML) {
|
||||
let modal = document.getElementById('modal');
|
||||
let content = modal.querySelector('.modal-content');
|
||||
content.innerHTML = innerHTML;
|
||||
|
||||
let form = content.querySelector('form');
|
||||
form.onsubmit = submitStandardRequirement;
|
||||
if (form) {
|
||||
form.onsubmit = submitStandardRequirement;
|
||||
}
|
||||
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
_ = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
@@ -97,7 +109,7 @@
|
||||
e.stopPropagation();
|
||||
|
||||
fetch(`@this.Url.Action("Update", "StandardRequirements")`, { method: 'POST', body: new FormData(e.target) })
|
||||
.then(response => response.text())
|
||||
.then(response2Text)
|
||||
.then(function contentHandler(text) {
|
||||
let form = setModalInnerHTML(text);
|
||||
let inputId = form.querySelector('input[name=@nameof(LaaProduction.Data.Cordonel.Models.CordonelStandardRequirement.Id)]');
|
||||
@@ -109,9 +121,9 @@
|
||||
|
||||
function loadStandardRequirement(id) {
|
||||
fetch(`@this.Url.Action("Update", "StandardRequirements")/${id}`)
|
||||
.then(response => response.text())
|
||||
.then(response2Text)
|
||||
.then(function handleContent(text) {
|
||||
let form = setModalInnerHTML(text);
|
||||
let _ = setModalInnerHTML(text);
|
||||
let trigger = document.getElementById('modal_toggler');
|
||||
trigger.click();
|
||||
});
|
||||
@@ -123,12 +135,17 @@
|
||||
.then(setModalInnerHTML);
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
let id = location.hash.substring(1);
|
||||
if (id) {
|
||||
loadStandardRequirement(id);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (location.hash) {
|
||||
let id = location.hash.substring(1);
|
||||
if (id) {
|
||||
document
|
||||
.querySelector(`tr[id="${id}"]`)
|
||||
.click();
|
||||
loadStandardRequirement(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@model LaaProduction.Data.Cordonel.Models.CordonelStandardRequirement
|
||||
|
||||
<th class="text-nowrap small p-2">@($"{Model.Id}.{Model.Version}")</th>
|
||||
<td class="text-nowrap small p-2">@Model.Region</td>
|
||||
<td class="text-nowrap small p-2">@Model.MeterSize</td>
|
||||
<th class="text-nowrap small px-2 py-1">@($"{Model.Id}.{Model.Version}")</th>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Region | @Model.ProductGroup</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.MeterSize</td>
|
||||
|
||||
<td class="text-nowrap small p-2 text-center">
|
||||
<td class="text-nowrap small px-2 py-1 text-center">
|
||||
@if (Model.IsActive)
|
||||
{
|
||||
<i class="bi bi-bold bi-check text-success"></i>
|
||||
@@ -15,10 +15,10 @@
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-nowrap small p-2">@Model.FwVersion</td>
|
||||
<td class="text-nowrap small p-2">@Model.LutCrc</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.FwVersion</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.LutCrc</td>
|
||||
|
||||
<td class="text-nowrap small p-2 text-center">
|
||||
<td class="text-nowrap small px-2 py-1 text-center">
|
||||
@if (Model.SkipCalibration == true)
|
||||
{
|
||||
<i class="bi bi-bold bi-check text-success"></i>
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-nowrap small p-2 text-center">
|
||||
<td class="text-nowrap small px-2 py-1 text-center">
|
||||
@if (Model.SkipRadioCheck == true)
|
||||
{
|
||||
<i class="bi bi-bold bi-check text-success"></i>
|
||||
@@ -40,14 +40,16 @@
|
||||
}
|
||||
</td>
|
||||
|
||||
<td class="text-nowrap small p-2 text-end">@Model.RequiredLifeTimeYearsAssembly</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.RequiredLifeTimeYearsShipping</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.MaxDrainedBatteryLoadPercentAssembly</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.MaxDrainedBatteryLoadPercentShipping</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.MaxStorageMonths</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.MaxStorageMonthsBigOrders</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.QuiescentCurrent_uA</td>
|
||||
<td class="text-nowrap small p-2 text-end">@Model.EstimatedProductionBatteryLoadPercent</td>
|
||||
<td class="text-nowrap small p-2">@Model.Timestamp.ToString("dd-MM-yyyy HH:mm")</td>
|
||||
<td class="text-nowrap small p-2">@Model.ApprovalName</td>
|
||||
<td class="text-nowrap small p-2">@Model.ApprovalComment</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.RequiredLifeTimeYearsAssembly</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.RequiredLifeTimeYearsShipping</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.MaxDrainedBatteryLoadPercentAssembly</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.MaxDrainedBatteryLoadPercentShipping</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.MaxStorageMonths</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.MaxStorageMonthsBigOrders</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.QuiescentCurrent_uA</td>
|
||||
<td class="text-nowrap small px-2 py-1 text-end">@Model.EstimatedProductionBatteryLoadPercent</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.CreatedBy</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Timestamp.ToString("dd-MM-yyyy HH:mm")</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.ApprovedBy</td>
|
||||
<td class="text-nowrap small px-2 py-1">@(Model.ApprovedDate?.ToString("dd-MM-yyyy HH:mm"))</td>
|
||||
<td class="text-nowrap small px-2 py-1">@Model.Comment</td>
|
||||
@@ -60,10 +60,10 @@
|
||||
@Html.ValidationMessageFor(x => x.MeterSize, null, new { @class = "small text-danger" })
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
@Html.TextBoxFor(x => x.ApprovalName, new { @class = "form-control bg-light", placeholder = "...", @readonly = "readonly", autocomplete = "off" })
|
||||
@Html.LabelFor(x => x.ApprovalName)
|
||||
@Html.PopoverFor(x => x.ApprovalName)
|
||||
@Html.ValidationMessageFor(x => x.ApprovalName, null, new { @class = "small text-danger" })
|
||||
@Html.TextBoxFor(x => x.CreatedBy, new { @class = "form-control bg-light", placeholder = "...", @readonly = "readonly", autocomplete = "off" })
|
||||
@Html.LabelFor(x => x.CreatedBy)
|
||||
@Html.PopoverFor(x => x.CreatedBy)
|
||||
@Html.ValidationMessageFor(x => x.CreatedBy, null, new { @class = "small text-danger" })
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
@Html.TextBoxFor(x => x.Timestamp, new { @class = "form-control bg-light", placeholder = "...", @readonly = "readonly", autocomplete = "off" })
|
||||
@@ -138,8 +138,8 @@
|
||||
}
|
||||
- @($"{change.Timestamp:dd-MM-yyyy HH:mm}")
|
||||
</p>
|
||||
<p class="mb-0 small">@change.ApprovalComment</p>
|
||||
<p class="mb-2 small">@change.ApprovalName</p>
|
||||
<p class="mb-0 small">@change.Comment</p>
|
||||
<p class="mb-2 small">@change.CreatedBy</p>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -218,15 +218,27 @@
|
||||
id="ApprovalComment"
|
||||
name="ApprovalComment"
|
||||
style="height: 100px;"></textarea>
|
||||
@Html.LabelFor(x => x.ApprovalComment, $"Versionskommentar: {Model.ApprovalComment}")
|
||||
@Html.PopoverFor(x => x.ApprovalComment, top: 5)
|
||||
@Html.ValidationMessageFor(x => x.ApprovalComment, null, new { @class = "small text-danger" })
|
||||
@Html.LabelFor(x => x.Comment, $"Versionskommentar: {Model.Comment}")
|
||||
@Html.PopoverFor(x => x.Comment, top: 5)
|
||||
@Html.ValidationMessageFor(x => x.Comment, null, new { @class = "small text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer border-0 px-0 pb-0">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">@UITranslations.Btn_Close</button>
|
||||
<button type="submit" class="btn btn-success">@UITranslations.Btn_Save</button>
|
||||
@if (this.ViewData["CanApprove"] is bool canApprove && canApprove)
|
||||
{
|
||||
<a href="~/StandardRequirements/Approve/@this.Model.Id" class="btn btn-primary">
|
||||
<i class="bi bi-check"></i> Approve
|
||||
</a>
|
||||
}
|
||||
else if (this.ViewData["CanUnapprove"] is bool canUnapprove && canUnapprove)
|
||||
{
|
||||
<a href="~/StandardRequirements/Unapprove/@this.Model.Id" class="btn btn-danger">
|
||||
<i class="bi bi-x"></i> Approve
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -6,8 +6,8 @@
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="APIURL" value="http://sla12iis01.emea.sensus.net" />
|
||||
<!--<add key="APIURL" value="http://localhost:52822" />-->
|
||||
<!--<add key="APIURL" value="http://sla12iis01.emea.sensus.net" />-->
|
||||
<add key="APIURL" value="http://localhost:52822" />
|
||||
<add key="APIPrefix" value="/LaaProductionWeb" />
|
||||
<add key="ConnectionString" value="Server=SLASQL01.emea.sensus.net; Database=Auftrag; User ID=sa; Password=sqlserver;" />
|
||||
<add key="LoginTimeout" value="30" />
|
||||
|
||||
Reference in New Issue
Block a user