diff --git a/Common/Ui/Common.UI.VFM/Common.UI.VFM.csproj b/Common/Ui/Common.UI.VFM/Common.UI.VFM.csproj
index e9b9066b..56097d95 100644
--- a/Common/Ui/Common.UI.VFM/Common.UI.VFM.csproj
+++ b/Common/Ui/Common.UI.VFM/Common.UI.VFM.csproj
@@ -25,6 +25,7 @@
prompt
4
false
+ IDE0003;IDE0049;
AnyCPU
@@ -59,6 +60,7 @@
Designer
+
diff --git a/Common/Ui/Common.UI.VFM/Converters/BooleanToVisibilityConverter.cs b/Common/Ui/Common.UI.VFM/Converters/BooleanToVisibilityConverter.cs
new file mode 100644
index 00000000..f2a3a80f
--- /dev/null
+++ b/Common/Ui/Common.UI.VFM/Converters/BooleanToVisibilityConverter.cs
@@ -0,0 +1,25 @@
+namespace Common.UI.VFM.Converters
+{
+ using System;
+ using System.Globalization;
+ using System.Windows;
+ using System.Windows.Data;
+
+ public class BooleanToVisibilityConverter : IValueConverter
+ {
+ public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ if (value is Boolean visible && visible)
+ {
+ return Visibility.Visible;
+ }
+
+ return Visibility.Collapsed;
+ }
+
+ public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Common/Ui/Common.UI.VFM/Models/OmniShipmentModel.cs b/Common/Ui/Common.UI.VFM/Models/OmniShipmentModel.cs
index 84d97ea0..688d9ac5 100644
--- a/Common/Ui/Common.UI.VFM/Models/OmniShipmentModel.cs
+++ b/Common/Ui/Common.UI.VFM/Models/OmniShipmentModel.cs
@@ -9,6 +9,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+ using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -20,7 +21,7 @@
private readonly IHttpClient http;
private readonly SQLConnection sql;
private readonly OmniConnection omni;
- private OmniValuesModel defaults;
+ private OmniValuesModel values;
public OmniShipmentModel(String portName, String sqlConnectionString, String labelsURL)
{
@@ -44,9 +45,20 @@
?? key.Name
, val => (Func)val.CreateDelegate(typeof(Func), this));
+ internal Boolean WasPrinted()
+ => this.sql
+ .CreateCommand($@"
+ SELECT COUNT(*)
+ FROM [OmniExport]
+ WHERE [CustomerSN] = @{nameof(this.CustId)}
+ AND [PCBAID] = @{nameof(this.MeterPcb)}")
+ .SetParameter(nameof(this.MeterPcb), this.MeterPcb)
+ .SetParameter(nameof(this.CustId), this.CustId)
+ .FirstOrDefault(x => x.GetValue(0)) == 1;
+
internal void Initialize()
{
- this.defaults = new OmniValuesModel();
+ this.values = new OmniValuesModel();
this.omni.UseUniPro(this.portName);
this.omni.StartRecording();
@@ -75,7 +87,7 @@
}
[Display(Name = "Produktionsauftragsdaten laden")]
- private ProcessResult LoadProductionOrderData()
+ internal ProcessResult LoadProductionOrderData()
{
var any = this.sql
.CreateCommand($@"
@@ -84,11 +96,13 @@
, [ap].[FertigungsauftragNr]
, [ap].[IdentNr]
, [ap].[Menge]
- , (SELECT COUNT([apsn].[KundeneigeneSerienNr])
- FROM [AuftragPositionSerienNr] AS [apsn]
- WHERE [apsn].[AuftragNr] = [ap].[AuftragNr]
- AND [apsn].[PositionNr] = [ap].[PositionNr]
- AND [apsn].[StatusFertigung] = 30) + 1
+ , (SELECT TOP 1 [x].[Nr]
+ FROM (SELECT [apsn].[SerienNr]
+ , ROW_NUMBER() OVER (PARTITION BY [apsn].[PositionNr] ORDER BY [apsn].[SerienNr]) AS [Nr]
+ FROM [AuftragPositionSerienNr] AS [apsn]
+ WHERE [apsn].[AuftragNr] = [ap].[AuftragNr]
+ AND [apsn].[PositionNr] = [ap].[PositionNr]) AS [x]
+ WHERE [x].[SerienNr] = [aps].[SerienNr])
AS [BoxNr]
, [aps].[SerienNr]
, [aps].[KundeneigeneSerienNr]
@@ -108,20 +122,20 @@
.SetParameter(nameof(this.CustId), this.CustId)
.FirstOrDefault(reader =>
{
- this.defaults.Orderno = reader.GetValue(0);
- this.defaults.Positionno = reader.GetValue(1);
- this.defaults.ProductionOrderno = reader.GetValue(2);
- this.defaults.OrderIdentno = reader.GetValue(3);
- this.defaults.Count = reader.GetValue(4);
- this.defaults.Boxno = reader.GetValue(5);
- this.defaults.Serialno = reader.GetValue(6);
- this.defaults.DbCustId = reader.GetValue(7);
- this.defaults.FactId = reader.GetValue(8);
- this.defaults.ProductionStatus = reader.GetValue(9);
- this.defaults.Partno = reader.GetValue(10);
- this.defaults.DescriptionL1 = reader.GetValue(11);
- this.defaults.DescriptionL2 = reader.GetValue(12);
- this.defaults.Variant = reader.GetValue(13);
+ this.values.Orderno = reader.GetValue(0);
+ this.values.Positionno = reader.GetValue(1);
+ this.values.ProductionOrderno = reader.GetValue(2);
+ this.values.OrderIdentno = reader.GetValue(3);
+ this.values.Count = reader.GetValue(4);
+ this.values.Boxno = reader.GetValue(5);
+ this.values.Serialno = reader.GetValue(6);
+ this.values.DbCustId = reader.GetValue(7);
+ this.values.FactId = reader.GetValue(8);
+ this.values.ProductionStatus = reader.GetValue(9);
+ this.values.Partno = reader.GetValue(10);
+ this.values.DescriptionL1 = reader.GetValue(11);
+ this.values.DescriptionL2 = reader.GetValue(12);
+ this.values.Variant = reader.GetValue(13);
return true;
});
@@ -131,7 +145,7 @@
return new ProcessResult
{
State = ProcessState.Warning,
- Message = $"{this.defaults.DescriptionL1} - {(this.defaults.Variant.StartsWith("R", StringComparison.InvariantCultureIgnoreCase) ? "SCHWARZE" : "GRAUE")} AUSFÜHRUNG!!!",
+ Message = $"{this.values.DescriptionL1} - {(this.values.Variant.StartsWith("R", StringComparison.InvariantCultureIgnoreCase) ? "SCHWARZE" : "GRAUE")} AUSFÜHRUNG!!!",
};
}
else
@@ -145,7 +159,7 @@
}
[Display(Name = "Prüfungsgebnisse laden")]
- private ProcessResult LoadProductionTestData()
+ internal ProcessResult LoadProductionTestData()
{
var testIdentNr = default(Int32);
var descriptionL1 = default(String);
@@ -162,6 +176,7 @@
, [TR].[Succeeded]
, [TR].[CrrfAfter]
, [TR].[Id]
+ , [TR].[ManifacturingTime]
, [OD].[IdentNr]
, [OD].[DescriptionL1]
FROM [OmniTestRuns] AS [TR]
@@ -178,26 +193,31 @@
.SetParameter(nameof(this.MeterPcb), this.MeterPcb)
.FirstOrDefault(reader =>
{
- this.defaults.MaxGPM = reader.GetValue(0);
- this.defaults.MaxACC = reader.GetValue(1);
- this.defaults.MidGPM = reader.GetValue(2);
- this.defaults.MidACC = reader.GetValue(3);
- this.defaults.MinGPM = reader.GetValue(4);
- this.defaults.MinACC = reader.GetValue(5);
- this.defaults.TestDate = reader.GetValue(6);
- this.defaults.Succeeded = reader.GetValue(7);
- this.defaults.CalibrationFactor = reader.GetValue(8);
- this.defaults.TestRunId = reader.GetValue(9);
+ this.values.MaxGPM = reader.GetValue(0);
+ this.values.MaxACC = reader.GetValue(1);
+ this.values.MidGPM = reader.GetValue(2);
+ this.values.MidACC = reader.GetValue(3);
+ this.values.MinGPM = reader.GetValue(4);
+ this.values.MinACC = reader.GetValue(5);
+ this.values.TestDate = reader.GetValue(6);
+ this.values.Succeeded = reader.GetValue(7);
+ this.values.CalibrationFactor = reader.GetValue(8);
+ this.values.TestRunId = reader.GetValue(9);
+ this.values.ManifacturingTime = new SystemTime
+ {
+ DateTime = reader.GetValue(10)
+ }
+ .SecondsSince;
- testIdentNr = reader.GetValue(10);
- descriptionL1 = reader.GetValue(11);
+ testIdentNr = reader.GetValue(11);
+ descriptionL1 = reader.GetValue(12);
return true;
});
if (any)
{
- if (!this.defaults.Succeeded)
+ if (!this.values.Succeeded)
{
return new ProcessResult
{
@@ -205,7 +225,7 @@
Message = $"{this.MeterPcb} - wurde nicht erfolgreich geprüft!",
};
}
- else if (this.defaults.OrderIdentno != testIdentNr)
+ else if (this.values.OrderIdentno != testIdentNr)
{
return new ProcessResult
{
@@ -230,9 +250,9 @@
}
[Display(Name = "Standardwerte laden")]
- private ProcessResult LoadDefaults()
+ internal ProcessResult LoadDefaultValues()
{
- var identno = this.defaults.OrderIdentno;
+ var identno = this.values.OrderIdentno;
var any = this.sql
.CreateCommand($@"
SELECT [d].[Size]
@@ -265,31 +285,31 @@
.SetParameter(nameof(identno), identno)
.FirstOrDefault(reader =>
{
- this.defaults.Size = reader.GetValue(0);
- this.defaults.Range = reader.GetValue(1);
- this.defaults.Direction = reader.GetValue(2);
- this.defaults.IntPart = reader.GetValue(3);
- this.defaults.Fraction = reader.GetValue(4);
- this.defaults.Crf = reader.GetValue(5);
- this.defaults.Ppr = reader.GetValue(6);
- this.defaults.MeterUnits = reader.GetValue(7);
- this.defaults.FlowUnits = reader.GetValue(8);
- this.defaults.FlowRate = reader.GetValue(9);
- this.defaults.PulseWeight = reader.GetValue(10);
- this.defaults.PulseWidth = reader.GetValue(11);
- this.defaults.PulseUpdate = reader.GetValue(12);
- this.defaults.AlarmPercistancePeriodDays = reader.GetValue(13);
- this.defaults.DataLogIntervalMinutes = reader.GetValue(14);
- this.defaults.NumberOfReadingDigits = reader.GetValue(15);
- this.defaults.OptionalUniDirFields = reader.GetValue(16);
- this.defaults.ReadingPreset = reader.GetValue(17);
- this.defaults.DeviceID = reader.GetValue(18);
- this.defaults.LeakAlarmGPM = reader.GetValue(19);
- this.defaults.LeakAlarmTime = reader.GetValue(20);
- this.defaults.HighFlowAlarmGPM = reader.GetValue(21);
- this.defaults.HighFlowAlarmTime = reader.GetValue(22);
- this.defaults.ReverseFlowAlarmGPM = reader.GetValue(23);
- this.defaults.ReverseFlowAlarmTime = reader.GetValue(24);
+ this.values.Size = reader.GetValue(0);
+ this.values.Range = reader.GetValue(1);
+ this.values.Direction = reader.GetValue(2);
+ this.values.IntPart = reader.GetValue(3);
+ this.values.Fraction = reader.GetValue(4);
+ this.values.Crf = reader.GetValue(5);
+ this.values.Ppr = reader.GetValue(6);
+ this.values.MeterUnits = reader.GetValue(7);
+ this.values.FlowUnits = reader.GetValue(8);
+ this.values.FlowRate = reader.GetValue(9);
+ this.values.PulseWeight = reader.GetValue(10);
+ this.values.PulseWidth = reader.GetValue(11);
+ this.values.PulseUpdate = reader.GetValue(12);
+ this.values.AlarmPercistancePeriodDays = reader.GetValue(13);
+ this.values.DataLogIntervalMinutes = reader.GetValue(14);
+ this.values.NumberOfReadingDigits = reader.GetValue(15);
+ this.values.OptionalUniDirFields = reader.GetValue(16);
+ this.values.ReadingPreset = reader.GetValue(17);
+ this.values.DeviceID = reader.GetValue(18);
+ this.values.LeakAlarmGPM = reader.GetValue(19);
+ this.values.LeakAlarmTime = reader.GetValue(20);
+ this.values.HighFlowAlarmGPM = reader.GetValue(21);
+ this.values.HighFlowAlarmTime = reader.GetValue(22);
+ this.values.ReverseFlowAlarmGPM = reader.GetValue(23);
+ this.values.ReverseFlowAlarmTime = reader.GetValue(24);
return true;
});
@@ -312,7 +332,7 @@
}
[Display(Name = "Zählerzustand ablesen")]
- private ProcessResult LoadMeterState()
+ internal ProcessResult LoadMeterState()
{
var systemParameters = this.omni.ViewSystemParameters();
@@ -351,15 +371,9 @@
if (manifacturingTime == 0)
{
- manifacturingTime = new SystemTime
- {
- DateTime = new DateTime(2023, 12, 1, 0, 0, 0)
- }
- .SecondsSince;
+ manifacturingTime = this.values.ManifacturingTime;
}
- this.defaults.ManifacturingTime = manifacturingTime;
-
var registerSettings = this.omni.ViewRegisterSettings();
if (!registerSettings.Completed)
@@ -393,18 +407,18 @@
};
}
- this.defaults.EheadPcb = eheadPcb.Value;
+ this.values.EheadPcb = eheadPcb.Value;
return new ProcessResult
{
State = ProcessState.Success,
- Message = $"E-Head-PCB: {this.defaults.EheadPcb}"
+ Message = $"E-Head-PCB: {this.values.EheadPcb}"
};
}
[Display(Name = "System Reboot")]
- private ProcessResult RebootMeter()
+ internal ProcessResult RebootMeter()
{
var systemReset = this.omni.Set(new SystemTime());
@@ -426,25 +440,25 @@
}
[Display(Name = "Registereinstellungen Schreiben")]
- private ProcessResult WriteRegisterSettings()
+ internal ProcessResult WriteRegisterSettings()
{
Thread.Sleep(5000);
var response = this.omni.Set(new RegisterSettings
{
- IntPart = this.defaults.IntPart,
- Fraction = (ushort)this.defaults.Fraction,
- Size = this.defaults.Size,
- Range = this.defaults.Range,
+ IntPart = this.values.IntPart,
+ Fraction = (ushort)this.values.Fraction,
+ Size = this.values.Size,
+ Range = this.values.Range,
VolumePerPulseUnit = 0x00,
- MeterUnits = this.defaults.MeterUnits,
- FlowUnits = this.defaults.FlowUnits,
- FlowRate = this.defaults.FlowRate,
- FactoryCorrection = (sbyte)(this.defaults.CalibrationFactor * 10),
+ MeterUnits = this.values.MeterUnits,
+ FlowUnits = this.values.FlowUnits,
+ FlowRate = this.values.FlowRate,
+ FactoryCorrection = (sbyte)(this.values.CalibrationFactor * 10),
FieldCorrection = 0x00,
- PulseWeight = this.defaults.PulseWeight,
- PulseWidth = this.defaults.PulseWidth,
- PulseUpdate = this.defaults.PulseUpdate,
+ PulseWeight = this.values.PulseWeight,
+ PulseWidth = this.values.PulseWidth,
+ PulseUpdate = this.values.PulseUpdate,
});
if (!response.Completed)
@@ -463,22 +477,22 @@
}
[Display(Name = "Konfigurationseinstellungen Schreiben")]
- private ProcessResult WriteConfigurationParameters()
+ internal ProcessResult WriteConfigurationParameters()
{
var response = this.omni.Set(new ConfigurationParametersSet
{
BuildInfo = this.MeterPcb.Trim(),
ProgrammableID = this.CustId.Trim(),
- FactoryID = this.defaults.FactId.ToString(),
- AlarmPercistancePeriodDays = this.defaults.AlarmPercistancePeriodDays,
- DataLogIntervalMinutes = (ushort)this.defaults.DataLogIntervalMinutes,
- ManifacturingTime = this.defaults.ManifacturingTime,
- NumberOfReadingDigits = (sbyte)this.defaults.NumberOfReadingDigits,
- OptionalUniDirFields = (ushort)this.defaults.OptionalUniDirFields,
- ReadingPreset = this.defaults.ReadingPreset,
+ FactoryID = this.values.FactId.ToString(),
+ AlarmPercistancePeriodDays = this.values.AlarmPercistancePeriodDays,
+ DataLogIntervalMinutes = (ushort)this.values.DataLogIntervalMinutes,
+ ManifacturingTime = this.values.ManifacturingTime,
+ NumberOfReadingDigits = (sbyte)this.values.NumberOfReadingDigits,
+ OptionalUniDirFields = (ushort)this.values.OptionalUniDirFields,
+ ReadingPreset = this.values.ReadingPreset,
RebootCount = 0,
SystemTime = Epoch20000101.UTCNow,
- DeviceID = this.defaults.DeviceID
+ DeviceID = this.values.DeviceID
});
if (!response.Completed)
@@ -497,7 +511,7 @@
}
[Display(Name = "Alarme einrichten")]
- private ProcessResult SettingAlarms()
+ internal ProcessResult SettingAlarms()
{
var response = this.omni.ClearDisplay();
@@ -512,8 +526,8 @@
response = this.omni.Set(new LeakAlarm
{
- FlowRateGPM = this.defaults.LeakAlarmGPM,
- TimeLimit = (uint)this.defaults.LeakAlarmTime
+ FlowRateGPM = this.values.LeakAlarmGPM,
+ TimeLimit = (uint)this.values.LeakAlarmTime
});
if (!response.Completed)
@@ -527,8 +541,8 @@
response = this.omni.Set(new HighFlowAlarm
{
- FlowRateGPM = this.defaults.HighFlowAlarmGPM,
- TimeLimit = (uint)this.defaults.HighFlowAlarmTime
+ FlowRateGPM = this.values.HighFlowAlarmGPM,
+ TimeLimit = (uint)this.values.HighFlowAlarmTime
});
if (!response.Completed)
@@ -542,8 +556,8 @@
response = this.omni.Set(new ReverseFlowAlarm
{
- FlowRateGPM = this.defaults.ReverseFlowAlarmGPM,
- TimeLimit = (uint)this.defaults.ReverseFlowAlarmTime
+ FlowRateGPM = this.values.ReverseFlowAlarmGPM,
+ TimeLimit = (uint)this.values.ReverseFlowAlarmTime
});
if (!response.Completed)
@@ -605,7 +619,7 @@
}
[Display(Name = "OMNI versiegeln")]
- private ProcessResult SealMeter()
+ internal ProcessResult SealMeter()
{
var response = this.omni.FactorySeal(true);
@@ -687,7 +701,7 @@
};
}
- if (configuration.FactoryID.Value != this.defaults.FactId.ToString())
+ if (configuration.FactoryID.Value != this.values.FactId.ToString())
{
return new ProcessResult
{
@@ -704,25 +718,26 @@
}
[Display(Name = "Prüflabel drucken")]
- private ProcessResult PrintTestLabel()
+ internal ProcessResult PrintTestLabel()
{
var body = new StringBuilder();
+ var culture = new CultureInfo("en-US");
body.AppendLine($"PcbId = {this.MeterPcb};");
- body.AppendLine($"Orderno = {this.defaults.Orderno};");
- body.AppendLine($"Posno = {this.defaults.Positionno};");
- body.AppendLine($"TestDate = {this.defaults.TestDate:dd-MM-yyyy};");
- body.AppendLine($"Partno = {this.defaults.Partno};");
- body.AppendLine($"DescriptionL1 = {this.defaults.DescriptionL1};");
- body.AppendLine($"DescriptionL2 = {this.defaults.DescriptionL2};");
- body.AppendLine($"CustId = {this.defaults.DbCustId};");
- body.AppendLine($"FactId = {this.defaults.FactId};");
- body.AppendLine($"QmaxGPM = {this.defaults.MaxGPM:0.0};");
- body.AppendLine($"QmidGPM = {this.defaults.MidGPM:0.0};");
- body.AppendLine($"QminGPM = {this.defaults.MinGPM:0.0};");
- body.AppendLine($"QmaxACC = {this.defaults.MaxACC:0.0};");
- body.AppendLine($"QmidACC = {this.defaults.MidACC:0.0};");
- body.AppendLine($"QminACC = {this.defaults.MinACC:0.0};");
+ body.AppendLine($"Orderno = {this.values.Orderno};");
+ body.AppendLine($"Posno = {this.values.Positionno};");
+ body.AppendLine($"TestDate = {this.values.TestDate:dd-MM-yyyy};");
+ body.AppendLine($"Partno = {this.values.Partno};");
+ body.AppendLine($"DescriptionL1 = {this.values.DescriptionL1};");
+ body.AppendLine($"DescriptionL2 = {this.values.DescriptionL2};");
+ body.AppendLine($"CustId = {this.values.DbCustId};");
+ body.AppendLine($"FactId = {this.values.FactId};");
+ body.AppendLine($"QmaxGPM = {this.values.MaxGPM.ToString("0.0", culture)};");
+ body.AppendLine($"QmidGPM = {this.values.MidGPM.ToString("0.00", culture)};");
+ body.AppendLine($"QminGPM = {this.values.MinGPM.ToString("0.00", culture)};");
+ body.AppendLine($"QmaxACC = {this.values.MaxACC.ToString("0.0", culture)};");
+ body.AppendLine($"QmidACC = {this.values.MidACC.ToString("0.0", culture)};");
+ body.AppendLine($"QminACC = {this.values.MinACC.ToString("0.0", culture)};");
var response = this.http
.PostRequest("/aspx/api.aspx")
@@ -738,19 +753,19 @@
}
[Display(Name = "Kartonlabel drucken")]
- private ProcessResult PrintBoxLabel()
+ internal ProcessResult PrintBoxLabel()
{
var body = new StringBuilder();
- body.AppendLine($"CustId = {this.defaults.DbCustId};");
- body.AppendLine($"Title = OMNI+™ ({this.defaults.Variant}) Chamber");
- body.AppendLine($"DescriptionL1 = {this.defaults.DescriptionL1};");
- body.AppendLine($"DescriptionL2 = {this.defaults.DescriptionL2};");
- body.AppendLine($"Partno = {this.defaults.Partno};");
- body.AppendLine($"Orderno = {this.defaults.Orderno};");
+ body.AppendLine($"CustId = {this.values.DbCustId};");
+ body.AppendLine($"Title = OMNI+™ ({this.values.Variant}) Chamber");
+ body.AppendLine($"DescriptionL1 = {this.values.DescriptionL1};");
+ body.AppendLine($"DescriptionL2 = {this.values.DescriptionL2};");
+ body.AppendLine($"Partno = {this.values.Partno};");
+ body.AppendLine($"Orderno = {this.values.Orderno};");
body.AppendLine($"BoxDate = {DateTime.Now:dd-MM-yyyy};");
- body.AppendLine($"Boxno = {this.defaults.Boxno};");
- body.AppendLine($"Quantity = {this.defaults.Count};");
+ body.AppendLine($"Boxno = {this.values.Boxno};");
+ body.AppendLine($"Quantity = {this.values.Count};");
var response = this.http
.PostRequest("/aspx/api.aspx")
@@ -766,10 +781,10 @@
}
[Display(Name = "Daten Export")]
- private ProcessResult ExportData()
+ internal ProcessResult ExportData()
{
- var testRun = this.defaults.TestRunId;
- var serialno = this.defaults.Serialno;
+ var testRun = this.values.TestRunId;
+ var serialno = this.values.Serialno;
var prueffehlerInfo = $"{DateTime.Now:dd-MM-yyyy HH:mm:ss}";
var created = this.sql
@@ -805,14 +820,14 @@
, [tr].[Q10_Acc] - 100.0
, @{nameof(prueffehlerInfo)}
FROM [OmniTestRuns] AS [tr]
- WHERE [Id] = @{nameof(testRun)}")
+ WHERE [tr].[Id] = @{nameof(testRun)}")
.SetParameter(nameof(testRun), testRun)
.SetParameter(nameof(serialno), serialno)
.SetParameter(nameof(prueffehlerInfo), prueffehlerInfo)
.ExecuteNonQuery() == 1;
- var meterPcb = this.defaults.MeterPcb;
- var eheadPcb = this.defaults.EheadPcb;
+ var meterPcb = this.values.MeterPcb;
+ var eheadPcb = this.values.EheadPcb;
var exported = this.sql
.CreateCommand($@"
@@ -874,6 +889,39 @@
.SetParameter(nameof(eheadPcb), eheadPcb)
.ExecuteNonQuery() == 1;
+ var updated = this.sql
+ .CreateCommand($@"
+ UPDATE [AuftragPositionSerienNr]
+ SET [Pruefgangnr] = [y].[Pruefgang]
+ , [PruefgangDatum] = [y].[EndDate]
+ , [Wiederholungen] = [y].[Wiederholungen]
+ , [Einbauplatz] = [y].[SlotNr]
+ , [Bemerkung] = 'Inserted after omni export'
+ , [StatusFertigung] = 30
+ FROM [AuftragPositionSerienNr] AS [aps]
+ JOIN [OmniExport] AS [oe]
+ ON [oe].[ManufacturingSN] = [aps].[SerienNr]
+ JOIN (SELECT TOP 1
+ [Pruefgang]
+ , [EndDate]
+ , [Wiederholungen]
+ , [SlotNr]
+ , [BuildInfo]
+ FROM (SELECT ROW_NUMBER() OVER (PARTITION BY [BuildInfo] ORDER BY [Id]) AS [Wiederholungen]
+ , [BuildInfo]
+ , [Pruefgang]
+ , [EndDate]
+ , [SlotNr]
+ FROM [OmniTestRuns]
+ WHERE [BuildInfo] = @{nameof(this.MeterPcb)}
+ AND [Q1_TpId] IS NOT NULL)
+ AS [x]
+ ORDER BY [x].[Wiederholungen] DESC)
+ AS [y]
+ ON [oe].[PCBAID] = [y].[BuildInfo]")
+ .SetParameter(nameof(this.MeterPcb), this.MeterPcb)
+ .ExecuteNonQuery() == 1;
+
var state = ProcessState.Success;
var message = default(String);
@@ -889,6 +937,12 @@
message = "Prueffehler wurde nicht Exportiert.\n";
}
+ if (!updated)
+ {
+ state = ProcessState.Warning;
+ message = "APS wurde nicht Aktualisiert.\n";
+ }
+
return new ProcessResult
{
State = state,
diff --git a/Common/Ui/Common.UI.VFM/Models/OmniValuesModel.cs b/Common/Ui/Common.UI.VFM/Models/OmniValuesModel.cs
index 06176a0a..2435da85 100644
--- a/Common/Ui/Common.UI.VFM/Models/OmniValuesModel.cs
+++ b/Common/Ui/Common.UI.VFM/Models/OmniValuesModel.cs
@@ -108,6 +108,6 @@
public Int64 ReverseFlowAlarmTime { get; set; }
- public UInt32 ManifacturingTime { get; internal set; }
+ public UInt32 ManifacturingTime { get; set; }
}
}
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.VFM/ViewModels/ShipmnetViewModel.cs b/Common/Ui/Common.UI.VFM/ViewModels/ShipmnetViewModel.cs
index e2a9ccc9..1019308c 100644
--- a/Common/Ui/Common.UI.VFM/ViewModels/ShipmnetViewModel.cs
+++ b/Common/Ui/Common.UI.VFM/ViewModels/ShipmnetViewModel.cs
@@ -19,19 +19,36 @@
this.model = new OmniShipmentModel(this.PortName, this.SqlConnectionString, this.LabelServer);
this.ResetProcessState = new Command(this.ResetProcessStateHandler);
this.StartProcessing = new Command(this.StartProcessingHandler);
+ this.ReprintBoxLable = new Command(this.ReprintBoxLableHandler);
+ this.ReprintTestLable = new Command(this.ReprintTestLableHandler);
this.Processes = new ObservableCollection(this.LoadProcesses());
}
-
+
public String CustId
{
get => this.model.CustId;
- set => this.Set(() => this.model.CustId = value);
+ set => this.Set(() =>
+ {
+ this.model.CustId = value;
+ this.ReprintEnabled = !this.Proccessing && this.model.WasPrinted();
+ });
}
public String MeterPcb
{
get => this.model.MeterPcb;
- set => this.Set(() => this.model.MeterPcb = value);
+ set => this.Set(() =>
+ {
+ this.model.MeterPcb = value;
+ this.ReprintEnabled = !this.Proccessing && this.model.WasPrinted();
+ });
+ }
+
+ private Boolean reprintEnabled;
+ public Boolean ReprintEnabled
+ {
+ get => this.reprintEnabled;
+ set => this.Set(() => this.reprintEnabled = value);
}
private String message;
@@ -53,6 +70,10 @@
public ICommand StartProcessing { get; }
+ public ICommand ReprintBoxLable { get; }
+
+ public ICommand ReprintTestLable { get; }
+
public ObservableCollection Processes { get; }
private IEnumerable LoadProcesses()
@@ -63,6 +84,68 @@
}
}
+ private void ReprintBoxLableHandler()
+ {
+ if (!this.Proccessing)
+ {
+ Task.Factory
+ .StartNew(state =>
+ {
+ if (state is ShipmnetViewModel viewModel)
+ {
+ viewModel.model.LoadProductionOrderData();
+ viewModel.model.LoadProductionTestData();
+ viewModel.model.LoadDefaultValues();
+ viewModel.model.PrintBoxLabel();
+ }
+
+ }, this, CancellationToken.None)
+ .ContinueWith(task =>
+ {
+ if (task.AsyncState is ShipmnetViewModel viewModel)
+ {
+ if (task.Exception != null)
+ {
+ viewModel.Message = task.Exception.Message;
+ }
+
+ viewModel.Proccessing = false;
+ }
+ });
+ }
+ }
+
+ private void ReprintTestLableHandler()
+ {
+ if (!this.Proccessing)
+ {
+ Task.Factory
+ .StartNew(state =>
+ {
+ if (state is ShipmnetViewModel viewModel)
+ {
+ viewModel.model.LoadProductionOrderData();
+ viewModel.model.LoadProductionTestData();
+ viewModel.model.LoadDefaultValues();
+ viewModel.model.PrintTestLabel();
+ }
+
+ }, this, CancellationToken.None)
+ .ContinueWith(task =>
+ {
+ if (task.AsyncState is ShipmnetViewModel viewModel)
+ {
+ if (task.Exception != null)
+ {
+ viewModel.Message = task.Exception.Message;
+ }
+
+ viewModel.Proccessing = false;
+ }
+ });
+ }
+ }
+
private void ResetProcessStateHandler()
{
if (!this.resetted)
diff --git a/Common/Ui/Common.UI.VFM/Views/App.xaml b/Common/Ui/Common.UI.VFM/Views/App.xaml
index a3eb6e3e..0528552f 100644
--- a/Common/Ui/Common.UI.VFM/Views/App.xaml
+++ b/Common/Ui/Common.UI.VFM/Views/App.xaml
@@ -6,6 +6,7 @@
+
diff --git a/Common/Ui/Common.UI.VFM/Views/ShipmentView.xaml b/Common/Ui/Common.UI.VFM/Views/ShipmentView.xaml
index db32c8d3..c4ab5fce 100644
--- a/Common/Ui/Common.UI.VFM/Views/ShipmentView.xaml
+++ b/Common/Ui/Common.UI.VFM/Views/ShipmentView.xaml
@@ -120,22 +120,56 @@
Grid.ColumnSpan="2"
Grid.Row="8"
Margin="0, 6, 0, 0" >
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
+