DeliveryAdminWindow: Add weight filter
All checks were successful
Test / Run tests (push) Successful in 2m58s
All checks were successful
Test / Run tests (push) Successful in 2m58s
This commit is contained in:
@ -124,6 +124,7 @@ namespace Elwig.Services {
|
||||
var filterNotCult = new List<string>();
|
||||
var filterDate = new List<(string?, string?)>();
|
||||
var filterTime = new List<(string?, string?)>();
|
||||
int filterWeightGt = 0, filterWeightLt = 0;
|
||||
int filterYearGt = 0, filterYearLt = 0;
|
||||
double filterKmwGt = 0, filterKmwLt = 0;
|
||||
double filterOeGt = 0, filterOeLt = 0;
|
||||
@ -250,6 +251,15 @@ namespace Elwig.Services {
|
||||
filterZwst.Add(b.ZwstId);
|
||||
filter.RemoveAt(i--);
|
||||
filterNames.Add($"Zweigstelle {b.Name}");
|
||||
} else if ((e.StartsWith('>') || e.StartsWith('<')) && e.EndsWith("kg")) {
|
||||
if (int.TryParse(e[1..^2], out var num)) {
|
||||
switch (e[0]) {
|
||||
case '>': filterWeightGt = num; break;
|
||||
case '<': filterWeightLt = num; break;
|
||||
}
|
||||
filter.RemoveAt(i--);
|
||||
}
|
||||
if (e.Length == 3) filter.RemoveAt(i--);
|
||||
} else if (e.StartsWith('>') || e.StartsWith('<')) {
|
||||
if (double.TryParse(e[1..], out var num)) {
|
||||
switch ((e[0], num)) {
|
||||
@ -347,6 +357,8 @@ namespace Elwig.Services {
|
||||
}
|
||||
}
|
||||
|
||||
if (filterWeightGt > 0) prd = prd.And(p => p.Delivery.Parts.Sum(p => p.Weight) >= filterWeightGt);
|
||||
if (filterWeightLt > 0) prd = prd.And(p => p.Delivery.Parts.Sum(p => p.Weight) <= filterWeightLt);
|
||||
if (filterYearGt > 0) prd = prd.And(p => p.Year >= filterYearGt);
|
||||
if (filterYearLt > 0) prd = prd.And(p => p.Year < filterYearLt);
|
||||
if (filterMgNr.Count > 0) prd = prd.And(p => filterMgNr.Contains(p.Delivery.MgNr));
|
||||
@ -376,6 +388,13 @@ namespace Elwig.Services {
|
||||
if (filterOeGt > 0) prd = prd.And(p => p.Kmw * (4.54 + 0.022 * p.Kmw) >= filterOeGt);
|
||||
if (filterOeLt > 0) prd = prd.And(p => p.Kmw * (4.54 + 0.022 * p.Kmw) < filterOeLt);
|
||||
|
||||
if (filterWeightGt > 0 && filterWeightLt > 0) {
|
||||
filterNames.Insert(0, $"{filterWeightGt:N0}–{filterWeightLt:N0} kg");
|
||||
} else if (filterWeightGt > 0) {
|
||||
filterNames.Insert(0, $"ab {filterWeightGt:N0} kg");
|
||||
} else if (filterWeightLt > 0) {
|
||||
filterNames.Insert(0, $"unter {filterWeightLt:N0} kg");
|
||||
}
|
||||
if (filterYearGt > 0 && filterYearLt > 0) {
|
||||
filterNames.Insert(0, $"{filterYearGt}–{filterYearLt - 1}");
|
||||
} else if (filterYearGt > 0) {
|
||||
|
@ -176,6 +176,7 @@
|
||||
<Bold>Zweigstelle</Bold>: z.B. musterort, ...<LineBreak/>
|
||||
<Bold>Attribut</Bold>: z.B. kabinett, !kabinett (alle außer kabinett), ...<LineBreak/>
|
||||
<Bold>Bewirtschaftung</Bold>: z.B. bio, !kip (alle außer KIP), ...<LineBreak/>
|
||||
<Bold>Gewicht</Bold>: z.B. <500kg, >6000kg, ... (gilt für Gewicht der gesamten Lieferung)<LineBreak/>
|
||||
<Bold>Datum</Bold>: z.B. 1.9., 15.9.-10.10., -15.10.2020, ...<LineBreak/>
|
||||
<Bold>Uhrzeit</Bold>: z.B. 06:00-08:00, 18:00-, ...<LineBreak/>
|
||||
<Bold>Handwiegung</Bold>: handw[iegung], !Handw[iegung] (alle ohne Handwiegung)<LineBreak/>
|
||||
|
Reference in New Issue
Block a user