Add from-to-search to DeliveryAdminWindow
This commit is contained in:
@ -23,6 +23,7 @@ namespace Elwig.Helpers {
|
|||||||
public static readonly Regex SerialRegex = GeneratedSerialRegex();
|
public static readonly Regex SerialRegex = GeneratedSerialRegex();
|
||||||
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();
|
||||||
|
|
||||||
[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();
|
||||||
@ -33,6 +34,9 @@ namespace Elwig.Helpers {
|
|||||||
[GeneratedRegex(@"^(0?[1-9]|[12][0-9]|3[01])\.(0?[1-9]|1[0-2])\.$", RegexOptions.Compiled)]
|
[GeneratedRegex(@"^(0?[1-9]|[12][0-9]|3[01])\.(0?[1-9]|1[0-2])\.$", RegexOptions.Compiled)]
|
||||||
private static partial Regex GeneratedPartialDateRegex();
|
private static partial Regex GeneratedPartialDateRegex();
|
||||||
|
|
||||||
|
[GeneratedRegex(@"^([0-9]+([\.,][0-9]+)?)?-([0-9]+([\.,][0-9]+)?)?$", RegexOptions.Compiled)]
|
||||||
|
private static partial Regex GeneratedFromToRegex();
|
||||||
|
|
||||||
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,
|
||||||
|
@ -207,6 +207,29 @@ namespace Elwig.Windows {
|
|||||||
filter.RemoveAt(i--);
|
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)) {
|
||||||
|
var parts = e.Split("-");
|
||||||
|
double? from = (parts[0].Length > 0) ? double.Parse(parts[0].Replace(".", ",")) : null;
|
||||||
|
double? to = (parts[1].Length > 0) ? double.Parse(parts[1].Replace(".", ",")) : null;
|
||||||
|
switch ((from, to)) {
|
||||||
|
case (<= 30, <= 30):
|
||||||
|
case (<= 30, null):
|
||||||
|
case (null, <= 30):
|
||||||
|
filterKmwGt = from ?? 0;
|
||||||
|
filterKmwLt = to ?? 0;
|
||||||
|
break;
|
||||||
|
case (>= 1900, >= 1900):
|
||||||
|
case (>= 1900, null):
|
||||||
|
case (null, >= 1900):
|
||||||
|
filterYearGt = (int)(from ?? 0);
|
||||||
|
filterYearLt = (int)(to ?? -1) + 1;
|
||||||
|
break;
|
||||||
|
case (_, _):
|
||||||
|
filterOeGt = from ?? 0;
|
||||||
|
filterOeLt = to ?? 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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--);
|
||||||
@ -279,7 +302,7 @@ namespace Elwig.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (n > 0 && n <= 200) {
|
if (n > 0 && (n <= 200 || TodayOnlyInput.IsChecked == true)) {
|
||||||
var parts = (await deliveryParts.ToListAsync());
|
var parts = (await deliveryParts.ToListAsync());
|
||||||
var groups = parts
|
var groups = parts
|
||||||
.GroupBy(p => string.Join("/", p.Attributes.Select(a => a.Name)))
|
.GroupBy(p => string.Join("/", p.Attributes.Select(a => a.Name)))
|
||||||
|
Reference in New Issue
Block a user