DeliveryAdminWindow filter time
This commit is contained in:
@ -24,6 +24,7 @@ namespace Elwig.Helpers {
|
|||||||
public static readonly Regex TcpRegex = GeneratedTcpRegex();
|
public static readonly Regex TcpRegex = GeneratedTcpRegex();
|
||||||
public static readonly Regex PartialDateRegex = GeneratedPartialDateRegex();
|
public static readonly Regex PartialDateRegex = GeneratedPartialDateRegex();
|
||||||
public static readonly Regex FromToRegex = GeneratedFromToRegex();
|
public static readonly Regex FromToRegex = GeneratedFromToRegex();
|
||||||
|
public static readonly Regex FromToTimeRegex = GeneratedFromToTimeRegex();
|
||||||
|
|
||||||
[GeneratedRegex("^serial://([A-Za-z0-9]+):([0-9]+)(,([5-9]),([NOEMSnoems]),(0|1|1\\.5|2|))?$", RegexOptions.Compiled)]
|
[GeneratedRegex("^serial://([A-Za-z0-9]+):([0-9]+)(,([5-9]),([NOEMSnoems]),(0|1|1\\.5|2|))?$", RegexOptions.Compiled)]
|
||||||
private static partial Regex GeneratedSerialRegex();
|
private static partial Regex GeneratedSerialRegex();
|
||||||
@ -37,6 +38,9 @@ namespace Elwig.Helpers {
|
|||||||
[GeneratedRegex(@"^([0-9]+([\.,][0-9]+)?)?-([0-9]+([\.,][0-9]+)?)?$", RegexOptions.Compiled)]
|
[GeneratedRegex(@"^([0-9]+([\.,][0-9]+)?)?-([0-9]+([\.,][0-9]+)?)?$", RegexOptions.Compiled)]
|
||||||
private static partial Regex GeneratedFromToRegex();
|
private static partial Regex GeneratedFromToRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^([0-9]{1,2}:[0-9]{2})?-([0-9]{1,2}:[0-9]{2})?$", RegexOptions.Compiled)]
|
||||||
|
private static partial Regex GeneratedFromToTimeRegex();
|
||||||
|
|
||||||
private static readonly ushort[] Crc16ModbusTable = {
|
private static readonly ushort[] Crc16ModbusTable = {
|
||||||
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,
|
||||||
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
|
0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,
|
||||||
|
@ -170,6 +170,8 @@ namespace Elwig.Windows {
|
|||||||
var filterMgNr = new List<int>();
|
var filterMgNr = new List<int>();
|
||||||
var filterDate = new List<string>();
|
var filterDate = new List<string>();
|
||||||
var filterPartDate = new List<string>();
|
var filterPartDate = new List<string>();
|
||||||
|
string? filterTimeGt = null;
|
||||||
|
string? filterTimeLt = null;
|
||||||
int filterYearGt = 0;
|
int filterYearGt = 0;
|
||||||
int filterYearLt = 0;
|
int filterYearLt = 0;
|
||||||
double filterKmwGt = 0;
|
double filterKmwGt = 0;
|
||||||
@ -205,6 +207,12 @@ namespace Elwig.Windows {
|
|||||||
case ('<', _): filterOeLt = num; break;
|
case ('<', _): filterOeLt = num; break;
|
||||||
}
|
}
|
||||||
filter.RemoveAt(i--);
|
filter.RemoveAt(i--);
|
||||||
|
} else if (TimeOnly.TryParse(e[1..], out var time)) {
|
||||||
|
switch ((e[0], time)) {
|
||||||
|
case ('>', _): filterTimeGt = $"{time:HH:mm}"; break;
|
||||||
|
case ('<', _): filterTimeLt = $"{time:HH:mm}"; break;
|
||||||
|
}
|
||||||
|
filter.RemoveAt(i--);
|
||||||
}
|
}
|
||||||
if (e.Length == 1) filter.RemoveAt(i--);
|
if (e.Length == 1) filter.RemoveAt(i--);
|
||||||
} else if (e.Length > 1 && Utils.FromToRegex.IsMatch(e)) {
|
} else if (e.Length > 1 && Utils.FromToRegex.IsMatch(e)) {
|
||||||
@ -230,6 +238,11 @@ namespace Elwig.Windows {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
filter.RemoveAt(i--);
|
filter.RemoveAt(i--);
|
||||||
|
} else if (e.Length > 1 && Utils.FromToTimeRegex.IsMatch(e)) {
|
||||||
|
var parts = e.Split("-");
|
||||||
|
filterTimeGt = TimeOnly.TryParse(parts[0], out var from) ? $"{from:HH:mm}" : null;
|
||||||
|
filterTimeLt = TimeOnly.TryParse(parts[1], out var to) ? $"{to:HH:mm}" : null;
|
||||||
|
filter.RemoveAt(i--);
|
||||||
} else if (DateOnly.TryParse(e, out var date)) {
|
} else if (DateOnly.TryParse(e, out var date)) {
|
||||||
filterDate.Add($"{date:yyyy-MM-dd}");
|
filterDate.Add($"{date:yyyy-MM-dd}");
|
||||||
filter.RemoveAt(i--);
|
filter.RemoveAt(i--);
|
||||||
@ -247,6 +260,8 @@ namespace Elwig.Windows {
|
|||||||
if (filterPartDate.Count > 0) deliveryQuery = deliveryQuery.Where(d => filterPartDate.Contains(d.DateString.Substring(4)));
|
if (filterPartDate.Count > 0) deliveryQuery = deliveryQuery.Where(d => filterPartDate.Contains(d.DateString.Substring(4)));
|
||||||
if (filterYearGt > 0) deliveryQuery = deliveryQuery.Where(d => d.Year >= filterYearGt);
|
if (filterYearGt > 0) deliveryQuery = deliveryQuery.Where(d => d.Year >= filterYearGt);
|
||||||
if (filterYearLt > 0) deliveryQuery = deliveryQuery.Where(d => d.Year < filterYearLt);
|
if (filterYearLt > 0) deliveryQuery = deliveryQuery.Where(d => d.Year < filterYearLt);
|
||||||
|
if (filterTimeGt != null) deliveryQuery = deliveryQuery.Where(d => filterTimeGt.CompareTo(d.TimeString) <= 0);
|
||||||
|
if (filterTimeLt != null) deliveryQuery = deliveryQuery.Where(d => filterTimeLt.CompareTo(d.TimeString) > 0);
|
||||||
if (filterVar.Count > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => filterVar.Contains(p.SortId)));
|
if (filterVar.Count > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => filterVar.Contains(p.SortId)));
|
||||||
if (filterQual.Count > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => filterQual.Contains(p.QualId)));
|
if (filterQual.Count > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => filterQual.Contains(p.QualId)));
|
||||||
if (filterKmwGt > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => p.Kmw >= filterKmwGt));
|
if (filterKmwGt > 0) deliveryQuery = deliveryQuery.Where(d => d.Parts.Any(p => p.Kmw >= filterKmwGt));
|
||||||
|
Reference in New Issue
Block a user