HeReport - date input, from - to
Test protocol - legend, test state
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -9,8 +10,8 @@
|
||||
{
|
||||
var model = default(HeliumReportItem);
|
||||
|
||||
this.Add(model.Property(x => x.AuftragNr, this.Count));
|
||||
this.Add(model.Property(x => x.FertigungNr, this.Count));
|
||||
this.Add(model.Property(x => x.AuftragNr, this.Count));
|
||||
this.Add(model.Property(x => x.PositionNr, this.Count));
|
||||
this.Add(model.Property(x => x.SerialNr, this.Count));
|
||||
this.Add(model.Property(x => x.IdentNr, this.Count));
|
||||
@@ -25,9 +26,9 @@
|
||||
this.Add(model.Property(x => x.HeLakeRate, this.Count));
|
||||
this.Add(model.Property(x => x.HeTestPressure, this.Count));
|
||||
this.Add(model.Property(x => x.IsValid, this.Count));
|
||||
this.Add(model.Property(x => x.Text, this.Count));
|
||||
this.Add(model.Property(x => x.TestDate, this.Count, -1));
|
||||
this.Add(model.DateTime(x => x.TestDate, this.Count, -1));
|
||||
this.Add(model.Property(x => x.Tester, this.Count));
|
||||
this.Add(model.Property(x => x.Text, this.Count));
|
||||
}
|
||||
|
||||
internal SqlExpression OrderBy()
|
||||
@@ -55,15 +56,35 @@
|
||||
|
||||
foreach (var property in this)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(property.Like))
|
||||
if (property.Type == "date")
|
||||
{
|
||||
if (property.Von != default(DateTime))
|
||||
{
|
||||
var propertyName = $"{property.Property}_{property.Index}_Von";
|
||||
var propertyValue = $"{property.Column} >= @{propertyName}";
|
||||
|
||||
sqlExpression.Add($"{property.Column} >= @{propertyName}", propertyName, property.Von);
|
||||
}
|
||||
|
||||
if (property.Bis != default(DateTime))
|
||||
{
|
||||
var propertyName = $"{property.Property}_{property.Index}_Bis";
|
||||
var propertyValue = $"{property.Column} <= @{propertyName}";
|
||||
|
||||
sqlExpression.Add($"{property.Column} <= @{propertyName}", propertyName, property.Bis);
|
||||
}
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(property.Like))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
var propertyName = $"{property.Property}_{property.Index}";
|
||||
var propertyValue = $"%{property.Like}%";
|
||||
|
||||
var propertyName = $"{property.Property}_{property.Index}";
|
||||
var propertyValue = $"%{property.Like}%";
|
||||
|
||||
sqlExpression.Add($"{property.Column} LIKE @{propertyName}", propertyName, propertyValue);
|
||||
sqlExpression.Add($"{property.Column} LIKE @{propertyName}", propertyName, propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
return sqlExpression.BuildWhere(" AND ");
|
||||
@@ -82,7 +103,7 @@
|
||||
internal void Add(string expression)
|
||||
=> this.expressions.Add(expression);
|
||||
|
||||
internal void Add(string expression, string propertyName, string propertyValue)
|
||||
internal void Add(string expression, string propertyName, object propertyValue)
|
||||
{
|
||||
this.Parameters[propertyName] = propertyValue;
|
||||
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
namespace LaaProductionWeb.Services.Models
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
public class HeliumReportFilterProperty
|
||||
{
|
||||
public string Type { get; set; }
|
||||
|
||||
public string TypeName
|
||||
=> $"Filter[{this.Index}].{nameof(this.Type)}";
|
||||
|
||||
public int Index { get; set; }
|
||||
|
||||
public string IndexName
|
||||
@@ -13,10 +21,11 @@
|
||||
=> $"Filter[{this.Index}].{nameof(this.Property)}";
|
||||
|
||||
public string Column { get; set; }
|
||||
|
||||
public string ColumnName
|
||||
=> $"Filter[{this.Index}].{nameof(this.Column)}";
|
||||
|
||||
public string Like { get; set; }
|
||||
public virtual string Like { get; set; }
|
||||
|
||||
public string LikeName
|
||||
=> $"Filter[{this.Index}].{nameof(this.Like)}";
|
||||
@@ -28,5 +37,15 @@
|
||||
|
||||
public string OrderById
|
||||
=> $"Filter_{this.Index}_{nameof(this.OrderBy)}";
|
||||
|
||||
public DateTime Von { get; set; }
|
||||
|
||||
public string VonName
|
||||
=> $"Filter[{this.Index}].{nameof(this.Von)}";
|
||||
|
||||
public DateTime Bis { get; set; }
|
||||
|
||||
public string BisName
|
||||
=> $"Filter[{this.Index}].{nameof(this.Bis)}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,29 @@
|
||||
Property = memberInfo?.Name,
|
||||
OrderBy = orderBy,
|
||||
Index = index,
|
||||
Type = "text"
|
||||
};
|
||||
}
|
||||
public static HeliumReportFilterProperty DateTime(this HeliumReportItem model, Expression<Func<HeliumReportItem, object>> expression, int index, int orderBy = 0)
|
||||
{
|
||||
var memberInfo = default(MemberInfo);
|
||||
|
||||
if (expression.Body is MemberExpression memberExpression)
|
||||
{
|
||||
memberInfo = memberExpression.Member;
|
||||
}
|
||||
else if (expression.Body is UnaryExpression unaryExpression && unaryExpression.Operand is MemberExpression operandExpression)
|
||||
{
|
||||
memberInfo = operandExpression.Member;
|
||||
}
|
||||
|
||||
return new HeliumReportFilterProperty
|
||||
{
|
||||
Column = memberInfo?.GetCustomAttribute<ColumnAttribute>()?.Name,
|
||||
Property = memberInfo?.Name,
|
||||
OrderBy = orderBy,
|
||||
Index = index,
|
||||
Type = "date"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,5 +15,7 @@ namespace LaaProductionWeb.Services.Models
|
||||
public int? FileId { get; set; }
|
||||
|
||||
public string FileContent { get; set; }
|
||||
|
||||
public string Responsible { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -133,20 +133,15 @@
|
||||
, MAX([APS].[StatusFertigung]) AS [5Metrologicaltesting] -- 4
|
||||
, [CRRH].[Result] AS [6ConfigComparisonAndRadiotest] -- 5
|
||||
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
|
||||
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]
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class ReportService : IReportService
|
||||
{
|
||||
@@ -25,8 +26,8 @@
|
||||
var orderBy = model.Filter.OrderBy();
|
||||
|
||||
model.Items = this.dbContext.AsEnumerable($@"
|
||||
SELECT [POS].[AuftragNr] AS [AuftragNr] -- 0 Filter
|
||||
, [PT].[CordonelPressureTest_FertigungsAuftragsNr] AS [FertigungNr] -- 1 Filter
|
||||
SELECT [PT].[CordonelPressureTest_FertigungsAuftragsNr] AS [FertigungNr] -- 0 Filter
|
||||
, [POS].[AuftragNr] AS [AuftragNr] -- 1 Filter
|
||||
, [POS].[PositionNr] AS [PositionNr] -- 2 Filter
|
||||
, [PCB2SN].[MapPcbIdToSerialNumber_SerialNumber] AS [SerialNr] -- 3
|
||||
, [ID].[IdentNr] AS [IdentNr] -- 4 Filter
|
||||
@@ -41,8 +42,8 @@
|
||||
, [PT_HE].[CordonelPressureTestHe_LeakRate] AS [HeLakeRate] -- 13
|
||||
, [PT_HE].[CordonelPressureTestHe_TestPressure] AS [HeTestPressure] -- 14
|
||||
, [PT].[CordonelPressureTest_Valid] AS [IsValid] -- 15 Filter
|
||||
, [PT].[CordonelPressureTest_Text] AS [Text] -- 16 Filter
|
||||
, [PT].[CordonelPressureTest_Date] AS [TestDate] -- 17 Filter
|
||||
, [PT].[CordonelPressureTest_Date] AS [TestDate] -- 16 Filter
|
||||
, [PT].[CordonelPressureTest_Text] AS [Text] -- 17 Filter
|
||||
, [PT_HE].[CordonelPressureTestHe_TesterName] AS [Tester] -- 18
|
||||
FROM [Cordonel_PressureTest] AS [PT]
|
||||
JOIN [Cordonel_PressureTest_He] AS [PT_HE] ON [PT_HE].[CordonelPressureTestHe_TestID] = [PT].[CordonelPressureTest_Id]
|
||||
@@ -67,8 +68,8 @@
|
||||
},
|
||||
reader => new HeliumReportItem
|
||||
{
|
||||
AuftragNr = reader.GetValue<int>(0),
|
||||
FertigungNr = reader.GetValue<int>(1),
|
||||
FertigungNr = reader.GetValue<int>(0),
|
||||
AuftragNr = reader.GetValue<int>(1),
|
||||
PositionNr = reader.GetValue<short>(2),
|
||||
SerialNr = reader.GetValue<int>(3),
|
||||
IdentNr = reader.GetValue<int>(4),
|
||||
@@ -83,10 +84,11 @@
|
||||
HeLakeRate = reader.GetString(13),
|
||||
HeTestPressure = reader.GetString(14),
|
||||
IsValid = reader.GetValue<bool>(15),
|
||||
Text = reader.GetString(16),
|
||||
TestDate = reader.GetValue<DateTimeOffset>(17),
|
||||
TestDate = reader.GetValue<DateTimeOffset>(16),
|
||||
Text = reader.GetString(17),
|
||||
Tester = reader.GetString(18)
|
||||
});
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user