2" - R2, T2 - getested
This commit is contained in:
@@ -11,9 +11,11 @@
|
|||||||
{
|
{
|
||||||
public App()
|
public App()
|
||||||
{
|
{
|
||||||
ServiceProvider
|
//ServiceProvider
|
||||||
.ServiceCollection
|
// .ServiceCollection
|
||||||
.AddSingleton(new OmniContext(Appsettings.OmniDB, Appsettings.OutputDirectory));
|
// .AddSingleton(new OmniContext(Appsettings.OmniDB, Appsettings.OutputDirectory));
|
||||||
|
|
||||||
|
OmniContext.Create(Appsettings.OmniDB, Appsettings.OutputDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static event Action Exiting;
|
internal static event Action Exiting;
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
<DependentUpon>ItemsGrid.xaml</DependentUpon>
|
<DependentUpon>ItemsGrid.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Models\AppLogger.cs" />
|
<Compile Include="Models\AppLogger.cs" />
|
||||||
<Compile Include="Models\ServiceProvider.cs" />
|
|
||||||
<Compile Include="Models\Appsettings.cs" />
|
<Compile Include="Models\Appsettings.cs" />
|
||||||
<Compile Include="Models\CompilerServices.cs" />
|
<Compile Include="Models\CompilerServices.cs" />
|
||||||
<Compile Include="ViewModels\DefaultsHeaderRow.cs" />
|
<Compile Include="ViewModels\DefaultsHeaderRow.cs" />
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
namespace InspectionUI.Models
|
|
||||||
{
|
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
public interface IServiceCollection
|
|
||||||
{
|
|
||||||
IServiceCollection AddSingleton<T>(T instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ServiceProvider : IServiceProvider, IServiceCollection
|
|
||||||
{
|
|
||||||
private static readonly ServiceProvider serviceProvider = new ServiceProvider();
|
|
||||||
|
|
||||||
private readonly ConcurrentDictionary<Type, object> services;
|
|
||||||
|
|
||||||
private ServiceProvider()
|
|
||||||
{
|
|
||||||
this.services = new ConcurrentDictionary<Type, object>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IServiceCollection AddSingleton<T>(T instance)
|
|
||||||
{
|
|
||||||
services.AddOrUpdate(typeof(T), instance, (t, i) => instance);
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object GetService(Type serviceType)
|
|
||||||
{
|
|
||||||
return services.GetOrAdd(serviceType, default(object));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IServiceCollection ServiceCollection
|
|
||||||
{
|
|
||||||
get => serviceProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static T GetService<T>()
|
|
||||||
{
|
|
||||||
var serviceType = typeof(T);
|
|
||||||
var serviceInstance = default(T);
|
|
||||||
|
|
||||||
if (serviceProvider.GetService(serviceType) is T existingInstance)
|
|
||||||
{
|
|
||||||
serviceInstance = existingInstance;
|
|
||||||
}
|
|
||||||
else if (CreateInstance(serviceType) is T newInstance)
|
|
||||||
{
|
|
||||||
serviceInstance = newInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
return serviceInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static object CreateInstance(Type instanceType)
|
|
||||||
{
|
|
||||||
var instance = default(object);
|
|
||||||
var constructors = instanceType
|
|
||||||
.GetConstructors()
|
|
||||||
.OrderByDescending(x => x.GetParameters().Length);
|
|
||||||
|
|
||||||
foreach (var constructor in constructors)
|
|
||||||
{
|
|
||||||
var parameters = constructor.GetParameters();
|
|
||||||
var parametersLength = parameters.Length;
|
|
||||||
var createParameters = new object[parametersLength];
|
|
||||||
|
|
||||||
for (int i = 0; i < parametersLength; i++)
|
|
||||||
{
|
|
||||||
var parameterType = parameters[i].ParameterType;
|
|
||||||
var parameter = serviceProvider.GetService(parameterType);
|
|
||||||
|
|
||||||
if (parameter is null)
|
|
||||||
{
|
|
||||||
parameter = CreateInstance(parameterType);
|
|
||||||
}
|
|
||||||
|
|
||||||
createParameters[i] = parameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
instance = constructor.Invoke(createParameters);
|
|
||||||
|
|
||||||
if (instance != null)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,8 +13,8 @@
|
|||||||
this.Add(new ItemsGridHeaderVM());
|
this.Add(new ItemsGridHeaderVM());
|
||||||
this.Add(new ItemsGridHeaderVM());
|
this.Add(new ItemsGridHeaderVM());
|
||||||
|
|
||||||
var pruefpunkte = ServiceProvider
|
var pruefpunkte = OmniContext
|
||||||
.GetService<OmniContext>()
|
.Current
|
||||||
.Auftrag
|
.Auftrag
|
||||||
.Pruefpunkte
|
.Pruefpunkte
|
||||||
.Count;
|
.Count;
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
this.Add(new ItemsGridHeaderVM());
|
this.Add(new ItemsGridHeaderVM());
|
||||||
this.Add(new ItemsGridHeaderVM { Value = "0.0" });
|
this.Add(new ItemsGridHeaderVM { Value = "0.0" });
|
||||||
|
|
||||||
var pruefpunkte = ServiceProvider
|
var pruefpunkte = OmniContext
|
||||||
.GetService<OmniContext>()
|
.Current
|
||||||
.Auftrag
|
.Auftrag
|
||||||
.Pruefpunkte;
|
.Pruefpunkte;
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
this.Add(new ItemsGridHeaderVM { Value = "SerialNr", Width = ItemsGridHeaderVM.Star });
|
this.Add(new ItemsGridHeaderVM { Value = "SerialNr", Width = ItemsGridHeaderVM.Star });
|
||||||
this.Add(new ItemsGridHeaderVM { Value = "Crr.F. %", Width = ItemsGridHeaderVM.Auto });
|
this.Add(new ItemsGridHeaderVM { Value = "Crr.F. %", Width = ItemsGridHeaderVM.Auto });
|
||||||
|
|
||||||
var pruefpunkte = ServiceProvider
|
var pruefpunkte = OmniContext
|
||||||
.GetService<OmniContext>()
|
.Current
|
||||||
.Auftrag
|
.Auftrag
|
||||||
.Pruefpunkte;
|
.Pruefpunkte;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace InspectionUI.ViewModels
|
namespace InspectionUI.ViewModels
|
||||||
{
|
{
|
||||||
using InspectionUI.Models;
|
using OmniPlus;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
this.EnableButtons(false);
|
this.EnableButtons(false);
|
||||||
|
|
||||||
this.Errors = default(string);
|
this.Errors = default(string);
|
||||||
this.MetersPool = ServiceProvider.GetService<MetersPoolVM>();
|
this.MetersPool = new MetersPoolVM(OmniContext.Current);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(this.SuchNr))
|
if (!string.IsNullOrWhiteSpace(this.SuchNr))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
this.Add(new ItemsGridCellVM());
|
this.Add(new ItemsGridCellVM());
|
||||||
this.Add(new ItemsGridCellVM());
|
this.Add(new ItemsGridCellVM());
|
||||||
|
|
||||||
var pruefpunkte = ServiceProvider
|
var pruefpunkte = OmniContext
|
||||||
.GetService<OmniContext>()
|
.Current
|
||||||
.Auftrag
|
.Auftrag
|
||||||
.Pruefpunkte
|
.Pruefpunkte
|
||||||
.Count;
|
.Count;
|
||||||
@@ -72,11 +72,6 @@
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SaveMeterStateAsync(CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return this.StartNewTask(this.meter.SaveMeterState, cancellationToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task LoadTestRunAsync(CancellationToken cancellationToken)
|
public Task LoadTestRunAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return this.StartNewTask(this.meter.LoadTestRun, cancellationToken);
|
return this.StartNewTask(this.meter.LoadTestRun, cancellationToken);
|
||||||
@@ -84,10 +79,20 @@
|
|||||||
|
|
||||||
public Task InitializeInspectionAsync(bool keepCorrection, CancellationToken cancellationToken)
|
public Task InitializeInspectionAsync(bool keepCorrection, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
|
if (keepCorrection)
|
||||||
|
{
|
||||||
|
cancellationToken.Register(this.meter.FinishInspection);
|
||||||
|
}
|
||||||
|
|
||||||
this.uinr = 0;
|
this.uinr = 0;
|
||||||
|
|
||||||
void InitializeInspection()
|
void InitializeInspection()
|
||||||
{
|
{
|
||||||
|
if (!this.meter.IsConnected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.meter.InitializeForInspection(keepCorrection);
|
this.meter.InitializeForInspection(keepCorrection);
|
||||||
|
|
||||||
this.Set(this.meter.TestRun.CrrfBefore, "{0:0.0}", 3);
|
this.Set(this.meter.TestRun.CrrfBefore, "{0:0.0}", 3);
|
||||||
@@ -102,6 +107,11 @@
|
|||||||
|
|
||||||
void StartCalibration()
|
void StartCalibration()
|
||||||
{
|
{
|
||||||
|
if (!this.meter.IsConnected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.meter.StartCalibration((ushort)pp.Rotations, (ushort)pp.Duration);
|
this.meter.StartCalibration((ushort)pp.Rotations, (ushort)pp.Duration);
|
||||||
|
|
||||||
this.ShowRestTime(pp.Duration, this.uinr * 3 + 1);
|
this.ShowRestTime(pp.Duration, this.uinr * 3 + 1);
|
||||||
@@ -114,11 +124,17 @@
|
|||||||
{
|
{
|
||||||
void StopCalibration()
|
void StopCalibration()
|
||||||
{
|
{
|
||||||
|
if (!this.meter.IsConnected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var response = this.meter.StopCalibration(pp, refm3s);
|
var response = this.meter.StopCalibration(pp, refm3s);
|
||||||
|
|
||||||
var index = this.uinr * 3 + 1;
|
var index = this.uinr * 3 + 1;
|
||||||
|
|
||||||
this.Set(response.Item2, "{0}", index);
|
this.Set(response.Item2, "{0}", index);
|
||||||
this.Set(response.Item1, "{0:0.0000000000}", index + 1);
|
this.Set(response.Item1, "{0:0.0000000}", index + 1);
|
||||||
this.Set(response.Item3, "{0:0.00}", index + 2);
|
this.Set(response.Item3, "{0:0.00}", index + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +145,11 @@
|
|||||||
{
|
{
|
||||||
void FinishInspection()
|
void FinishInspection()
|
||||||
{
|
{
|
||||||
|
if (!this.meter.IsConnected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.meter.FinishInspection();
|
this.meter.FinishInspection();
|
||||||
|
|
||||||
var crrf = this.meter.TestRun.CrrfAfter;
|
var crrf = this.meter.TestRun.CrrfAfter;
|
||||||
|
|||||||
@@ -36,26 +36,24 @@
|
|||||||
|
|
||||||
public void LoadMeters()
|
public void LoadMeters()
|
||||||
{
|
{
|
||||||
this.referenceMeter = ServiceProvider.GetService<ReferenceMeterVM>();
|
this.referenceMeter = new ReferenceMeterVM(OmniContext.Current);
|
||||||
this.Add(this.referenceMeter);
|
this.Add(this.referenceMeter);
|
||||||
|
|
||||||
this.omniContext
|
this.omniContext.LoadMeters(Appsettings.COMPorts, Appsettings.PSNR);
|
||||||
.LoadMetersAsync(Appsettings.COMPorts, Appsettings.PSNR)
|
|
||||||
.ContinueWith(_ =>
|
|
||||||
{
|
|
||||||
foreach (var meter in this.omniContext.Meters)
|
foreach (var meter in this.omniContext.Meters)
|
||||||
{
|
{
|
||||||
this.Add(new MeterVM(meter));
|
this.Add(new MeterVM(meter));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.NotifyPropertyChanged();
|
this.NotifyPropertyChanged();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunInspection(bool keepCorrection = false, bool addCorrection = false)
|
public void RunInspection(bool keepCorrection = false)
|
||||||
{
|
{
|
||||||
|
// show reference meter seconds
|
||||||
|
// load meterVM in each task as state
|
||||||
this.cancellationTokenSource = new CancellationTokenSource();
|
this.cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
var cancellationToken = this.cancellationTokenSource.Token;
|
var cancellationToken = this.cancellationTokenSource.Token;
|
||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
var meters = this
|
var meters = this
|
||||||
@@ -70,13 +68,6 @@
|
|||||||
|
|
||||||
this.ContinueWhenAll(tasks);
|
this.ContinueWhenAll(tasks);
|
||||||
|
|
||||||
foreach (var meterVM in meters)
|
|
||||||
{
|
|
||||||
tasks.Add(meterVM.SaveMeterStateAsync(cancellationToken));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.ContinueWhenAll(tasks);
|
|
||||||
|
|
||||||
foreach (var meterVM in meters)
|
foreach (var meterVM in meters)
|
||||||
{
|
{
|
||||||
tasks.Add(meterVM.InitializeInspectionAsync(keepCorrection, cancellationToken));
|
tasks.Add(meterVM.InitializeInspectionAsync(keepCorrection, cancellationToken));
|
||||||
@@ -162,9 +153,9 @@
|
|||||||
{
|
{
|
||||||
this.DispatcherInvoke(() =>
|
this.DispatcherInvoke(() =>
|
||||||
{
|
{
|
||||||
this.Add(ServiceProvider.GetService<HeadersRowVM>());
|
this.Add(new HeadersRowVM());
|
||||||
this.Add(ServiceProvider.GetService<DefaultsHeaderRow>());
|
this.Add(new DefaultsHeaderRow());
|
||||||
this.Add(ServiceProvider.GetService<DefaultsRowVM>());
|
this.Add(new DefaultsRowVM());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,10 @@
|
|||||||
private int ppnr;
|
private int ppnr;
|
||||||
private bool cancel;
|
private bool cancel;
|
||||||
|
|
||||||
public ReferenceMeterVM(OmniContext omniContext, ExchangeConnection signarR) : base()
|
public ReferenceMeterVM(OmniContext omniContext) : base()
|
||||||
{
|
{
|
||||||
this.omniContext = omniContext;
|
this.omniContext = omniContext;
|
||||||
this.signarR = signarR;
|
this.signarR = new ExchangeConnection();
|
||||||
this.signarR.StateChanged += this.SignarR_StateChanged;
|
this.signarR.StateChanged += this.SignarR_StateChanged;
|
||||||
this.signarR.Connect(Appsettings.HubURL);
|
this.signarR.Connect(Appsettings.HubURL);
|
||||||
this.ppnr = 1;
|
this.ppnr = 1;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
private void StartFlow(OmniPruefpunkt pp)
|
private void StartFlow(OmniPruefpunkt pp)
|
||||||
{
|
{
|
||||||
var interval = 1000;
|
var interval = 1000;
|
||||||
var timeout = 5;// 00;
|
var timeout = 500;
|
||||||
var volume = default(double);
|
var volume = default(double);
|
||||||
var waitHandle = new ManualResetEventSlim();
|
var waitHandle = new ManualResetEventSlim();
|
||||||
var timer = new System.Timers.Timer
|
var timer = new System.Timers.Timer
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
private void StartRZ(OmniPruefpunkt pp)
|
private void StartRZ(OmniPruefpunkt pp)
|
||||||
{
|
{
|
||||||
var interval = 1000;
|
var interval = 1000;
|
||||||
var timeout = 6;// 0;
|
var timeout = 60;
|
||||||
var seconds = default(double);
|
var seconds = default(double);
|
||||||
var waitHandle = new ManualResetEventSlim();
|
var waitHandle = new ManualResetEventSlim();
|
||||||
var timer = new System.Timers.Timer
|
var timer = new System.Timers.Timer
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
internal double GetFlow()
|
internal double GetFlow()
|
||||||
{
|
{
|
||||||
var interval = 1000;
|
var interval = 1000;
|
||||||
var timeout = 6;// 0;
|
var timeout = 60;
|
||||||
var referenceV = 0D;
|
var referenceV = 0D;
|
||||||
var waitHandle = new ManualResetEventSlim();
|
var waitHandle = new ManualResetEventSlim();
|
||||||
var timer = new System.Timers.Timer
|
var timer = new System.Timers.Timer
|
||||||
@@ -193,14 +193,14 @@
|
|||||||
waitHandle.Wait(timeout * interval);
|
waitHandle.Wait(timeout * interval);
|
||||||
waitHandle.Reset();
|
waitHandle.Reset();
|
||||||
|
|
||||||
OmniPlusFormulas.OutDebugM3S(ref referenceV);
|
// OmniPlusFormulas.OutDebugM3S(ref referenceV);
|
||||||
|
|
||||||
this.signarR.StopReferenceMessurement -= ReceiveFlow;
|
this.signarR.StopReferenceMessurement -= ReceiveFlow;
|
||||||
timer.Elapsed -= TimerElapsed;
|
timer.Elapsed -= TimerElapsed;
|
||||||
|
|
||||||
waitHandle.Wait(1000);
|
waitHandle.Wait(1000);
|
||||||
|
|
||||||
this.Set(referenceV, "{0:0.0000000000}", this.ppnr + 1);
|
this.Set(referenceV, "{0:0.0000000}", this.ppnr + 1);
|
||||||
this.Set(referenceV == 0 ? 0 : 100, "{0:0.00}", this.ppnr + 2);
|
this.Set(referenceV == 0 ? 0 : 100, "{0:0.00}", this.ppnr + 2);
|
||||||
|
|
||||||
return referenceV;
|
return referenceV;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
const int PULSES_PER_ROTATION = 8;
|
const int PULSES_PER_ROTATION = 8;
|
||||||
|
|
||||||
var fractionPart = (double)fraction / FRACTION_FACTOR;
|
var fractionPart = (double)fraction / FRACTION_FACTOR;
|
||||||
var mlPlain = intPart + fractionPart;
|
|
||||||
var mlPulse = intPart + fractionPart;
|
var mlPulse = intPart + fractionPart;
|
||||||
var mlr = mlPulse * PULSES_PER_ROTATION;
|
var mlr = mlPulse * PULSES_PER_ROTATION;
|
||||||
|
|
||||||
@@ -114,15 +113,14 @@
|
|||||||
|
|
||||||
public static double MeterFlowM3S(double rotations, double mlr, double duration)
|
public static double MeterFlowM3S(double rotations, double mlr, double duration)
|
||||||
{
|
{
|
||||||
var seconds = duration * (1D / (short.MaxValue + 1));
|
var m3s = rotations * mlr / duration / 1000D / 1000D * 100;
|
||||||
var m3s = rotations * mlr / seconds / 1000D / 1000D * 100;
|
|
||||||
|
|
||||||
if (double.IsNaN(m3s) || double.IsInfinity(m3s))
|
if (double.IsNaN(m3s) || double.IsInfinity(m3s))
|
||||||
{
|
{
|
||||||
return default(double);
|
return default(double);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rotations * mlr / seconds / 1000D / 1000D * 100;
|
return m3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double MeterFlowM3S(this OmniPlusTestPoint point, OmniPlusTest test)
|
public static double MeterFlowM3S(this OmniPlusTestPoint point, OmniPlusTest test)
|
||||||
@@ -186,13 +184,5 @@
|
|||||||
|
|
||||||
return crrf;
|
return crrf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OutDebugM3S(ref double value)
|
|
||||||
{
|
|
||||||
if (true)
|
|
||||||
{
|
|
||||||
value = new Random().Next(95, 100) / 1005D;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,20 @@
|
|||||||
private readonly OmniDatabase database;
|
private readonly OmniDatabase database;
|
||||||
private readonly string outputDirectory;
|
private readonly string outputDirectory;
|
||||||
|
|
||||||
|
public static void Create(String omniDB, String outputDirectory)
|
||||||
|
{
|
||||||
|
Current = new OmniContext(omniDB, outputDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
private int runId;
|
private int runId;
|
||||||
|
|
||||||
public OmniContext(string connectionString, string outputDirectory)
|
private OmniContext(string connectionString, string outputDirectory)
|
||||||
{
|
{
|
||||||
this.outputDirectory = outputDirectory;
|
this.outputDirectory = outputDirectory;
|
||||||
this.database = new OmniDatabase(connectionString, outputDirectory);
|
this.database = new OmniDatabase(connectionString, outputDirectory);
|
||||||
this.meters = new ConcurrentDictionary<int, OmniMeter>();
|
this.meters = new ConcurrentDictionary<int, OmniMeter>();
|
||||||
|
|
||||||
Current = this;
|
//Current = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OmniAuftrag Auftrag { get; set; }
|
public OmniAuftrag Auftrag { get; set; }
|
||||||
@@ -77,36 +82,22 @@
|
|||||||
this.runId = this.database.GetNextRunId();
|
this.runId = this.database.GetNextRunId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task LoadMetersAsync(string portNames, string psnr)
|
public void LoadMeters(string portNames, string psnr)
|
||||||
{
|
{
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
|
|
||||||
var tasks = new List<Task>();
|
|
||||||
var slotNr = 1;
|
var slotNr = 1;
|
||||||
|
|
||||||
foreach (var portName in portNames.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var portName in portNames.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
var meter = new OmniMeter(psnr, slotNr, portName, this.outputDirectory);
|
var meter = new OmniMeter(psnr, slotNr, portName, this.outputDirectory);
|
||||||
|
|
||||||
this.meters.AddOrUpdate(slotNr, meter, (_, _1) => meter);
|
meter.ConnectIrda();
|
||||||
|
|
||||||
tasks.Add(Task.Factory.StartNew(() => meter.ConnectIrda()));
|
this.meters.AddOrUpdate(slotNr, meter, (_, _1) => meter);
|
||||||
|
|
||||||
slotNr++;
|
slotNr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.Factory.ContinueWhenAll(tasks.ToArray(), _tasks =>
|
|
||||||
{
|
|
||||||
foreach (var task in _tasks)
|
|
||||||
{
|
|
||||||
if (task.Exception != null)
|
|
||||||
{
|
|
||||||
// TODO: Add logging.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.Clear();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal int UpdateTestRun(IDictionary<string, object> parameters, int id, byte slotNr)
|
internal int UpdateTestRun(IDictionary<string, object> parameters, int id, byte slotNr)
|
||||||
@@ -114,6 +105,6 @@
|
|||||||
return this.database.UpdateTestRun(parameters, id, slotNr);
|
return this.database.UpdateTestRun(parameters, id, slotNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static OmniContext Current { get; private set; }
|
public static OmniContext Current { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,8 @@
|
|||||||
|
|
||||||
public OmniPruefgang TestRun { get; private set; }
|
public OmniPruefgang TestRun { get; private set; }
|
||||||
|
|
||||||
|
public Boolean IsConnected { get; set; }
|
||||||
|
|
||||||
public void ConnectIrda()
|
public void ConnectIrda()
|
||||||
{
|
{
|
||||||
if (this.connection is null)
|
if (this.connection is null)
|
||||||
@@ -64,6 +66,15 @@
|
|||||||
if (buildInfo.Status == Status.Completed)
|
if (buildInfo.Status == Status.Completed)
|
||||||
{
|
{
|
||||||
this.MeterNr = buildInfo.Value;
|
this.MeterNr = buildInfo.Value;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(this.MeterNr))
|
||||||
|
{
|
||||||
|
this.MeterNr = new string('.', 12);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.IsConnected = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -87,6 +98,11 @@
|
|||||||
this.WriteToLog();
|
this.WriteToLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveCorrection()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void InitializeForInspection(bool keepCorrection = false)
|
public void InitializeForInspection(bool keepCorrection = false)
|
||||||
{
|
{
|
||||||
var systemParameters = this.connection.ViewSystemParameters();
|
var systemParameters = this.connection.ViewSystemParameters();
|
||||||
@@ -231,11 +247,16 @@
|
|||||||
var response = this.connection.ViewChamberCalibration();
|
var response = this.connection.ViewChamberCalibration();
|
||||||
var rotations = response.Rotations;
|
var rotations = response.Rotations;
|
||||||
var duration = response.DurationSec;
|
var duration = response.DurationSec;
|
||||||
|
|
||||||
|
this.NotifyStateChanged(rotations);
|
||||||
|
this.NotifyStateChanged(duration);
|
||||||
|
|
||||||
var rs = $"{rotations}/{duration:0.0}";
|
var rs = $"{rotations}/{duration:0.0}";
|
||||||
var mlr = OmniPlusFormulas.MilliliterPerRotation(this.defaults.IntPart, (ushort)this.defaults.Fraction, this.defaults.Factor);
|
var mlr = OmniPlusFormulas.MilliliterPerRotation(this.defaults.IntPart, (ushort)this.defaults.Fraction, this.defaults.Factor);
|
||||||
var m3s = OmniPlusFormulas.MeterFlowM3S(rotations, mlr, duration);
|
var m3s = OmniPlusFormulas.MeterFlowM3S(rotations, mlr, duration);
|
||||||
|
|
||||||
OmniPlusFormulas.OutDebugM3S(ref m3s);
|
this.NotifyStateChanged(mlr);
|
||||||
|
this.NotifyStateChanged(m3s);
|
||||||
|
|
||||||
var acc = OmniPlusFormulas.AccuracyPercentage(m3s, refm3s);
|
var acc = OmniPlusFormulas.AccuracyPercentage(m3s, refm3s);
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Services", "L
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Personalization", "LaaProduction.Personalization\LaaProduction.Personalization.csproj", "{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Personalization", "LaaProduction.Personalization\LaaProduction.Personalization.csproj", "{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Shipment", "LaaProduction.Shipment\LaaProduction.Shipment.csproj", "{A487E02B-0E6C-4A98-84F6-4AF3E7B8E73B}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Search", "LaaProduction.Search\LaaProduction.Search.csproj", "{23C6F8CD-2A91-4444-A828-6A0B5B942520}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Search", "LaaProduction.Search\LaaProduction.Search.csproj", "{23C6F8CD-2A91-4444-A828-6A0B5B942520}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.SharedModels", "LaaProduction.SharedModels\LaaProduction.SharedModels.csproj", "{0BF77588-2684-459D-8C71-DBBC6B05E9EE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.SharedModels", "LaaProduction.SharedModels\LaaProduction.SharedModels.csproj", "{0BF77588-2684-459D-8C71-DBBC6B05E9EE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb", "LaaProductionWeb\LaaProductionWeb.csproj", "{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProductionWeb", "LaaProductionWeb\LaaProductionWeb.csproj", "{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laa", "Laa\Laa.csproj", "{30659754-5C51-448B-9902-1BF271BCFFA7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaProduction.Http", "LaaProduction.Http\LaaProduction.Http.csproj", "{EB19F145-1E59-47A4-957A-E287497227B9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -31,10 +29,6 @@ Global
|
|||||||
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
{4C17FD42-7002-431A-8D6E-C57DD7D7C2D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{A487E02B-0E6C-4A98-84F6-4AF3E7B8E73B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{A487E02B-0E6C-4A98-84F6-4AF3E7B8E73B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{A487E02B-0E6C-4A98-84F6-4AF3E7B8E73B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{A487E02B-0E6C-4A98-84F6-4AF3E7B8E73B}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{23C6F8CD-2A91-4444-A828-6A0B5B942520}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -47,10 +41,10 @@ Global
|
|||||||
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{DBBFBA08-138C-4115-85F6-FE6DA4E190AC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{30659754-5C51-448B-9902-1BF271BCFFA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{EB19F145-1E59-47A4-957A-E287497227B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{30659754-5C51-448B-9902-1BF271BCFFA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EB19F145-1E59-47A4-957A-E287497227B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{30659754-5C51-448B-9902-1BF271BCFFA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EB19F145-1E59-47A4-957A-E287497227B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{30659754-5C51-448B-9902-1BF271BCFFA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{EB19F145-1E59-47A4-957A-E287497227B9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user