Shipment - hide/show - serials scan and serials list.
HeReport - date filter from to date. Protocol - denyed upload of files when order has failed tests.
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
|
||||
IEnumerable<TestStatus> LoadTestStatus(int orderId);
|
||||
|
||||
bool OrderCompleted(int orderNr);
|
||||
|
||||
int SaveFile(Stream fileStream, int clientId, int orderId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,19 +63,21 @@
|
||||
{
|
||||
var dateTokens = property
|
||||
.Like
|
||||
.Split(new[] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(x => DateTimeOffset.TryParse($"{x}", new CultureInfo("de"), DateTimeStyles.None, out DateTimeOffset date)
|
||||
? (DateTimeOffset?)date.AddHours(-date.Hour)
|
||||
.Split(new[] { '-' })
|
||||
.Select(x => DateTimeOffset.TryParse($"{x}".Trim(), new CultureInfo("de"), DateTimeStyles.None, out DateTimeOffset date)
|
||||
? (DateTimeOffset?)date
|
||||
: null)
|
||||
.ToArray();
|
||||
|
||||
if (dateTokens.Length >= 1)
|
||||
{
|
||||
var propertyValue = dateTokens[0];
|
||||
var date1 = dateTokens.FirstOrDefault();
|
||||
|
||||
if (propertyValue != null)
|
||||
if (date1 != null)
|
||||
{
|
||||
var date = date1.Value;
|
||||
var propertyName = $"{property.Property}_{property.Index}_From";
|
||||
var propertyValue = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
|
||||
|
||||
sqlExpression.Add($"{property.Column} >= @{propertyName}", propertyName, propertyValue);
|
||||
}
|
||||
@@ -83,11 +85,13 @@
|
||||
|
||||
if (dateTokens.Length >= 2)
|
||||
{
|
||||
var propertyValue = dateTokens[1];
|
||||
var date2 = dateTokens.LastOrDefault();
|
||||
|
||||
if (propertyValue != null)
|
||||
if (date2 != null)
|
||||
{
|
||||
var date = date2.Value.AddDays(1);
|
||||
var propertyName = $"{property.Property}_{property.Index}_To";
|
||||
var propertyValue = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
|
||||
|
||||
sqlExpression.Add($"{property.Column} <= @{propertyName}", propertyName, propertyValue);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
public class ProtocolService : IProtocolService
|
||||
{
|
||||
@@ -162,6 +163,37 @@
|
||||
RadioTest = reader.GetValue<bool?>(5),
|
||||
});
|
||||
|
||||
public bool OrderCompleted(int orderId)
|
||||
{
|
||||
var sumResults = this.dbContext.AsEnumerable($@"
|
||||
SELECT CAST(CASE WHEN ISNULL([CPT].[CordonelPressureTest_Valid], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ CAST(CASE WHEN ISNULL([DP].[Dicht], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
+ ISNULL(MAX([APS].[StatusFertigung]) - 30, 0)
|
||||
+ CAST(CASE WHEN ISNULL([CRRH].[Result], 1) = 1 THEN 0 ELSE 1 END AS INT)
|
||||
FROM [AuftragPositionSerienNr] AS [APS]
|
||||
LEFT JOIN [Genesis_Meter] AS [GM] ON [GM].[Seriennummer] = [APS].[SerienNr]
|
||||
LEFT JOIN [MapPcbIdToSerialNumber] AS [PCB] ON [PCB].[MapPcbIdToSerialNumber_SerialNumber] = [GM].[Seriennummer]
|
||||
LEFT JOIN [Cordonel_Radio_RSSI_History] AS [CRRH] ON [CRRH].[RadioAdress] = [GM].[Adresse] - 10000000000
|
||||
AND [CRRH].[IsLast] = 1
|
||||
AND [CRRH].[Result] = 1
|
||||
LEFT JOIN [Druckpruefung] AS [DP] ON [DP].[FabNr] = [PCB].[MapPcbIdToSerialNumber_PcbId]
|
||||
AND [DP].[Dicht] = 1
|
||||
LEFT JOIN [Cordonel_PressureTest] AS [CPT] ON [CPT].[CordonelPressureTest_PcbId] = [PCB].[MapPcbIdToSerialNumber_PcbId]
|
||||
AND [CPT].[CordonelPressureTest_Valid] = 1
|
||||
WHERE [APS].[AuftragNr] = @{nameof(orderId)}
|
||||
GROUP BY [APS].[PositionNr]
|
||||
, [APS].[SerienNr]
|
||||
, [APS].[KundeneigeneSerienNr]
|
||||
, [CPT].[CordonelPressureTest_Valid]
|
||||
, [DP].[Dicht]
|
||||
, [CRRH].[Result]",
|
||||
parameters => parameters.Add(nameof(orderId), orderId),
|
||||
reader => reader.GetValue<int>(0))
|
||||
.Sum(x => x);
|
||||
|
||||
return sumResults == 0;
|
||||
}
|
||||
|
||||
public int SaveFile(Stream fileStream, int clientId, int orderId)
|
||||
{
|
||||
var fileName = $"{clientId}_{orderId}.pdf";
|
||||
|
||||
Reference in New Issue
Block a user