Compare commits

...

10 Commits

Author SHA1 Message Date
5dc725620b Bump version to 0.11.1
All checks were successful
Test / Run tests (push) Successful in 2m2s
Deploy / Build and Deploy (push) Successful in 2m7s
2024-09-19 12:35:25 +02:00
27d8a5cfb6 DeliveryAncmtAdminWindow: Add more filters and tooltip for weight
All checks were successful
Test / Run tests (push) Successful in 1m47s
2024-09-19 11:56:45 +02:00
642fb3a625 DeliveryService: Small fixes 2024-09-19 11:54:57 +02:00
3f7cd2a6ff DeliveryAncmtAdminWindow: Focus MgNrInput when creating new ancmt
All checks were successful
Test / Run tests (push) Successful in 2m8s
2024-09-19 09:34:44 +02:00
21a1b11d68 AreaCom: Make YearFrom nullable
All checks were successful
Test / Run tests (push) Successful in 1m48s
2024-09-18 18:26:16 +02:00
d8beb03b96 Tests: Update dependencies
All checks were successful
Test / Run tests (push) Successful in 1m53s
2024-09-17 23:18:51 +02:00
eee90c784b Elwig: Update dependencies 2024-09-17 23:18:41 +02:00
74200083ab DeliveryAncmtAdminWindow: Mark cancelled schedules with Strikethrough
All checks were successful
Test / Run tests (push) Successful in 1m38s
2024-09-17 23:08:22 +02:00
871bc299bd Utils: Fix SplitName() for double names
All checks were successful
Test / Run tests (push) Successful in 1m46s
2024-09-17 19:18:43 +02:00
a18b58f438 DeliveryAncmtAdminWindow: Make delivery schedule list bigger
All checks were successful
Test / Run tests (push) Successful in 2m10s
2024-09-17 19:07:59 +02:00
17 changed files with 316 additions and 34 deletions

View File

@ -3,6 +3,32 @@ Changelog
=========
[v0.11.1][v0.11.1] (2024-09-19) {#v0.11.1}
------------------------------------------
### Neue Funktionen {#v0.11.1-features}
* Im Anmeldungen-Fenster (`DeliveryAncmtAdminWindow`) mehr Filter hinzugefügt; das Gewicht wird (wie im Lieferungen-Fenster) aufgeschlüsselt. (27d8a5cfb6)
### Behobene Fehler {#v0.11.1-bugfixes}
* Beim Export der BKI-Liste werden Namen von Rechnungsadressen _immer_ richtig getrennt. (871bc299bd)
* Flächenbindungen ohne Startsaison werden ohne Fehler gehandhabt. (21a1b11d68)
### Sonstiges {#v0.11.1-misc}
* Im Anmeldungen-Fenster (`DeliveryAncmtAdminWindow`)...
* die Liste der Lesepläne vergrößert. (a18b58f438)
* sind abgesagte Lesepläne durchgestrichen. (74200083ab)
* wird beim Erstellen das Feld für die MgNr direkt fokussiert. (3f7cd2a6ff)
* Abhängigkeiten aktualisiert. (eee90c784b, d8beb03b96)
* Kleinigkeiten in `DeliveryService`. (642fb3a625)
[v0.11.1]: https://git.necronda.net/winzer/elwig/releases/tag/v0.11.1
[v0.11.0][v0.11.0] (2024-09-16) {#v0.11.0}
------------------------------------------

View File

@ -206,7 +206,7 @@
<td class="text">@areaCom.GstNr.Replace(",", ", ").Replace("-", "")</td>
<td class="number">@($"{areaCom.Area:N0}")</td>
<td class="center">@areaCom.WineCult?.Name</td>
<td class="center">@(areaCom.YearTo == null ? $"ab {areaCom.YearFrom}" : $"{areaCom.YearFrom}{areaCom.YearTo}")</td>
<td class="center">@(areaCom.YearTo == null ? (areaCom.YearFrom == null ? "unbefristet" : $"ab {areaCom.YearFrom}") : (areaCom.YearFrom == null ? $"bis {areaCom.YearTo}" : $"{areaCom.YearFrom}{areaCom.YearTo}"))</td>
</tr>
lastContract = contractType.AreaComType.DisplayName;
}

View File

@ -7,7 +7,7 @@
<UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
<Version>0.11.0</Version>
<Version>0.11.1</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationManifest>app.manifest</ApplicationManifest>
@ -25,17 +25,17 @@
</Target>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.1" />
<PackageReference Include="LinqKit" Version="1.3.0" />
<PackageReference Include="MailKit" Version="4.7.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.32" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="6.0.33" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="RazorLight" Version="2.3.1" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.36" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.39" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
</ItemGroup>

View File

@ -9,7 +9,7 @@ namespace Elwig.Helpers {
public static class AppDbUpdater {
// Don't forget to update value in Tests/fetch-resources.bat!
public static readonly int RequiredSchemaVersion = 29;
public static readonly int RequiredSchemaVersion = 30;
private static int VersionOffset = 0;

View File

@ -565,7 +565,7 @@ namespace Elwig.Helpers.Export {
KgNr = kgnr,
GstNr = json["gstnr"]?.AsValue().GetValue<string>() ?? "-",
RdNr = rd?.RdNr,
YearFrom = json["year_from"]!.AsValue().GetValue<int>(),
YearFrom = json["year_from"]?.AsValue().GetValue<int>(),
YearTo = json["year_to"]?.AsValue().GetValue<int>(),
Comment = json["comment"]?.AsValue().GetValue<string>(),
}, newRd ? rd : null);

View File

@ -348,7 +348,7 @@ namespace Elwig.Helpers {
}
public static (string, string?) SplitName(string fullName, string? familyName) {
if (familyName == null || familyName == "") return (fullName, null);
if (string.IsNullOrWhiteSpace(familyName)) return (fullName, null);
var p0 = fullName.IndexOf(familyName, StringComparison.CurrentCultureIgnoreCase);
if (p0 == -1) return (fullName, null);
var p1 = fullName.IndexOf(" und ");
@ -362,8 +362,10 @@ namespace Elwig.Helpers {
var p3 = fullName.LastIndexOf(' ', p2 - 1);
return (fullName[0..p3], fullName[(p3 + 1)..^0]);
}
} else {
} else if (p0 + familyName.Length >= fullName.Length || fullName[p0 + familyName.Length] == ' ') {
return (familyName, fullName.Replace(familyName, "").Replace(" ", " ").Trim());
} else {
return (fullName, null);
}
}
@ -558,7 +560,7 @@ namespace Elwig.Helpers {
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments() => ActiveAreaCommitments(CurrentYear);
public static Expression<Func<AreaCom, bool>> ActiveAreaCommitments(int year) =>
c => (c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
c => (c.YearFrom == null || c.YearFrom <= year) && (c.YearTo == null || c.YearTo >= year);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query) => ActiveAreaCommitments(query, CurrentYear);
public static IQueryable<AreaCom> ActiveAreaCommitments(IQueryable<AreaCom> query, int year) =>

View File

@ -32,7 +32,7 @@ namespace Elwig.Models.Entities {
public int? RdNr { get; set; }
[Column("year_from")]
public int YearFrom { get; set; }
public int? YearFrom { get; set; }
[Column("year_to")]
public int? YearTo { get; set; }

View File

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Windows;
namespace Elwig.Models.Entities {
[Table("delivery_schedule"), PrimaryKey("Year", "DsNr")]
@ -47,6 +48,8 @@ namespace Elwig.Models.Entities {
[Column("cancelled")]
public bool IsCancelled { get; set; }
[NotMapped]
public TextDecorationCollection? TextDecoration => IsCancelled ? TextDecorations.Strikethrough : null;
[Column("ancmt_from")]
public long? AncmtFromUnix { get; set; }

View File

@ -0,0 +1,18 @@
-- schema version 29 to 30
PRAGMA writable_schema = ON;
DROP VIEW v_bki_member;
CREATE VIEW v_bki_member AS
SELECT s.year, m.mgnr, m.lfbis_nr, m.name,
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS other_names,
a.name AS billing_name, COALESCE(a.address, m.address) AS address,
COALESCE(a.country, m.country) AS country, COALESCE(a.postal_dest, m.postal_dest) AS postal_dest,
SUM(COALESCE(IIF((c.year_from IS NULL OR c.year_from <= s.year) AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, NULL), 0)) AS area
FROM season s, member m
LEFT JOIN member_billing_address a ON a.mgnr = m.mgnr
LEFT JOIN area_commitment c ON c.mgnr = m.mgnr
GROUP BY s.year, m.mgnr;
PRAGMA schema_version = 2901;
PRAGMA writable_schema = OFF;

View File

@ -106,7 +106,7 @@ namespace Elwig.Services {
var a = new AreaCom {
FbNr = oldFbNr ?? newFbNr,
MgNr = (int)vm.MgNr!,
YearFrom = (int)vm.YearFrom!,
YearFrom = vm.YearFrom,
YearTo = vm.YearTo,
VtrgId = vm.AreaComType!.VtrgId,
CultId = vm.WineCult?.CultId,

View File

@ -12,6 +12,8 @@ using Microsoft.Win32;
using System.Windows.Input;
using System.Windows;
using System;
using LinqKit;
using System.Windows.Controls;
namespace Elwig.Services {
public static class DeliveryAncmtService {
@ -53,11 +55,21 @@ namespace Elwig.Services {
var filterVar = new List<string>();
var filterNotVar = new List<string>();
var filterMgNr = new List<int>();
var filterZwst = new List<string>();
var filterAttr = new List<string>();
var filterNotAttr = new List<string>();
var filterCult = new List<string>();
var filterNotCult = new List<string>();
var filterDate = new List<(string?, string?)>();
int filterWeightGt = 0, filterWeightLt = 0;
var filter = vm.TextFilter;
if (filter.Count > 0) {
var var = await ctx.WineVarieties.ToDictionaryAsync(v => v.SortId, v => v);
var mgnr = await ctx.Members.ToDictionaryAsync(m => m.MgNr.ToString(), m => m);
var zwst = await ctx.Branches.ToDictionaryAsync(b => b.Name.ToLower().Split(' ')[0], b => b);
var attr = await ctx.WineAttributes.ToDictionaryAsync(a => a.Name.ToLower().Split(' ')[0], a => a);
var cult = await ctx.WineCultivations.ToDictionaryAsync(c => c.Name.ToLower().Split(' ')[0], c => c);
for (int i = 0; i < filter.Count; i++) {
var e = filter[i];
@ -81,6 +93,82 @@ namespace Elwig.Services {
filterMgNr.Add(int.Parse(e));
filter.RemoveAt(i--);
filterNames.Add(member.AdministrativeName);
} else if (attr.ContainsKey(e.ToLower())) {
var a = attr[e.ToLower()];
filterAttr.Add(a.AttrId);
filter.RemoveAt(i--);
filterNames.Add($"Attribut {a.Name}");
} else if (e[0] == '!' && attr.ContainsKey(e[1..].ToLower())) {
var a = attr[e[1..].ToLower()];
filterNotAttr.Add(a.AttrId);
filter.RemoveAt(i--);
filterNames.Add($"ohne Attribut {a.Name}");
} else if (cult.ContainsKey(e.ToLower())) {
var c = cult[e.ToLower()];
filterCult.Add(c.CultId);
filter.RemoveAt(i--);
filterNames.Add($"Bewirtschaftung {c.Name}");
} else if (e[0] == '!' && cult.ContainsKey(e[1..].ToLower())) {
var c = cult[e[1..].ToLower()];
filterNotCult.Add(c.CultId);
filter.RemoveAt(i--);
filterNames.Add($"ohne Bewirtschaftung {c.Name}");
} else if (zwst.ContainsKey(e.ToLower())) {
var b = zwst[e.ToLower()];
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 (DateOnly.TryParse(e, out var date)) {
var str = date.ToString("yyyy-MM-dd");
filterDate.Add((str, str));
filter.RemoveAt(i--);
if (filterNames.Contains($"{vm.FilterSeason}") && vm.FilterSeason == date.Year)
filterNames.Remove($"{vm.FilterSeason}");
filterNames.Add(date.ToString("dd.MM.yyyy"));
} else if (Utils.DateFromToRegex.IsMatch(e)) {
var parts = e.Split("-");
if (parts.Length == 1) {
// single date
var dParts = parts[0].Split('.');
var str = $"{dParts[2]}-{dParts[1].PadLeft(2, '0')}-{dParts[0].PadLeft(2, '0')}";
filterDate.Add((str, str));
filter.RemoveAt(i--);
var n = string.Join('.', str.Split('-').Reverse());
if (dParts[2] == "") {
filterNames.Remove($"{vm.FilterSeason}");
filterNames.Add(n + $"{vm.FilterSeason}");
} else {
if ($"{vm.FilterSeason}" == dParts[2])
filterNames.Remove($"{vm.FilterSeason}");
filterNames.Add(n);
}
} else if (parts.Length == 2) {
// from/to date
var d1Parts = parts[0].Split('.');
var d2Parts = parts[1].Split('.');
var s1 = d1Parts.Length < 2 ? null : $"{d1Parts.ElementAtOrDefault(2)}-{d1Parts[1].PadLeft(2, '0')}-{d1Parts[0].PadLeft(2, '0')}";
var s2 = d2Parts.Length < 2 ? null : $"{d2Parts.ElementAtOrDefault(2)}-{d2Parts[1].PadLeft(2, '0')}-{d2Parts[0].PadLeft(2, '0')}";
filterDate.Add((s1, s2));
filter.RemoveAt(i--);
var n1 = s1 == null ? null : string.Join('.', s1.Split('-').Reverse());
var n2 = s2 == null ? null : string.Join('.', s2.Split('-').Reverse());
if (n1 != null && n2 != null) {
filterNames.Add($"{n1}{n2}");
} else if (n1 != null) {
filterNames.Add($"ab dem {n1}");
} else if (n2 != null) {
filterNames.Add($"bis zum {n2}");
}
}
} else if (e.Length > 2 && e.StartsWith('"') && e.EndsWith('"')) {
filter[i] = e[1..^1];
} else if (e.Length <= 2) {
@ -88,9 +176,30 @@ namespace Elwig.Services {
}
}
if (filterWeightGt > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Weight >= filterWeightGt);
if (filterWeightLt > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Weight <= filterWeightLt);
if (filterMgNr.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => filterMgNr.Contains(a.MgNr));
if (filterDate.Count > 0) {
var pr = PredicateBuilder.New<DeliveryAncmt>(false);
foreach (var (d1, d2) in filterDate)
pr.Or(a => (d1 == null || d1.CompareTo(a.Schedule.DateString.Substring(10 - d1.Length)) <= 0) && (d2 == null || d2.CompareTo(a.Schedule.DateString.Substring(10 - d2.Length)) >= 0));
deliveryAncmtQuery = deliveryAncmtQuery.Where(pr);
}
if (filterVar.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => filterVar.Contains(a.SortId));
if (filterNotVar.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => !filterNotVar.Contains(a.SortId));
if (filterZwst.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => filterZwst.Contains(a.Schedule.ZwstId));
if (filterAttr.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Schedule.AttrId != null && filterAttr.Contains(a.Schedule.AttrId));
if (filterNotAttr.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Schedule.AttrId == null || !filterNotAttr.Contains(a.Schedule.AttrId));
if (filterCult.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Schedule.CultId != null && filterCult.Contains(a.Schedule.CultId));
if (filterNotCult.Count > 0) deliveryAncmtQuery = deliveryAncmtQuery.Where(a => a.Schedule.CultId == null || !filterNotCult.Contains(a.Schedule.CultId));
if (filterWeightGt > 0 && filterWeightLt > 0) {
filterNames.Add($"{filterWeightGt:N0}{filterWeightLt:N0} kg");
} else if (filterWeightGt > 0) {
filterNames.Add($"ab {filterWeightGt:N0} kg");
} else if (filterWeightLt > 0) {
filterNames.Add($"bis {filterWeightLt:N0} kg");
}
}
return (filterNames, deliveryAncmtQuery, filter);
@ -182,5 +291,108 @@ namespace Elwig.Services {
Mouse.OverrideCursor = null;
}
}
private static void AddToolTipCell(Grid grid, string text, int row, int col, int colSpan = 1, bool bold = false, bool alignRight = false, bool alignCenter = false) {
var tb = new TextBlock() {
Text = text,
TextAlignment = alignRight ? TextAlignment.Right : alignCenter ? TextAlignment.Center : TextAlignment.Left,
Margin = new(0, 12 * row, 0, 0),
FontWeight = bold ? FontWeights.Bold : FontWeights.Normal,
};
tb.SetValue(Grid.ColumnProperty, col);
tb.SetValue(Grid.ColumnSpanProperty, colSpan);
grid.Children.Add(tb);
}
private static void AddToolTipRow(Grid grid, int row, string? h1, string? h2, int weight, int? total1, int total2) {
var bold = h2 == null;
if (h1 != null) AddToolTipCell(grid, h1 + ":", row, 0, (h2 == null) ? 2 : 1, bold);
if (h2 != null) AddToolTipCell(grid, h2 + ":", row, 1, 1, bold);
AddToolTipCell(grid, $"{weight:N0} kg", row, 2, 1, bold, true);
if (total1 != null && total1 != 0)
AddToolTipCell(grid, $"{weight * 100.0 / total1:N1} %", row, 3, 1, bold, true);
if (total2 != 0)
AddToolTipCell(grid, $"{weight * 100.0 / total2:N1} %", row, 4, 1, bold, true);
}
public static async Task<(string, Grid)> GenerateToolTip(IQueryable<DeliveryAncmt> deliveryAncmts) {
var grid = new Grid();
grid.ColumnDefinitions.Add(new() { Width = new(10) });
grid.ColumnDefinitions.Add(new() { Width = new(60) });
grid.ColumnDefinitions.Add(new() { Width = new(80) });
grid.ColumnDefinitions.Add(new() { Width = new(50) });
grid.ColumnDefinitions.Add(new() { Width = new(50) });
var text = "-";
var weight = await deliveryAncmts.SumAsync(p => p.Weight);
text = $"{weight:N0} kg";
AddToolTipRow(grid, 0, "Gewicht", null, weight, null, weight);
if (await deliveryAncmts.AnyAsync()) {
var attrGroups = await deliveryAncmts
.GroupBy(a => new { Attr = a.Schedule.Attribute!.Name, Cult = a.Schedule.Cultivation!.Name })
.Select(g => new {
g.Key.Attr,
g.Key.Cult,
Weight = g.Sum(a => a.Weight)
})
.OrderByDescending(g => g.Weight)
.ThenBy(g => g.Attr)
.ThenBy(g => g.Cult)
.ToListAsync();
var sortGroups = await deliveryAncmts
.GroupBy(a => a.SortId)
.Select(g => new {
SortId = g.Key,
Weight = g.Sum(a => a.Weight)
})
.OrderByDescending(g => g.Weight)
.ThenBy(g => g.SortId)
.ToListAsync();
var groups = await deliveryAncmts
.GroupBy(a => new {
Attr = a.Schedule.Attribute!.Name,
Cult = a.Schedule.Cultivation!.Name,
a.SortId,
})
.Select(g => new {
g.Key.Attr,
g.Key.Cult,
g.Key.SortId,
Weight = g.Sum(p => p.Weight)
})
.OrderByDescending(g => g.Weight)
.ThenBy(g => g.Attr)
.ThenBy(g => g.Cult)
.ThenBy(g => g.SortId)
.ToListAsync();
int rowNum = 1;
foreach (var attrG in attrGroups) {
rowNum++;
var name = attrG.Attr == null && attrG.Cult == null ? null : attrG.Attr + (attrG.Attr != null && attrG.Cult != null ? " / " : "") + attrG.Cult;
AddToolTipRow(grid, rowNum++, name, null, attrG.Weight, attrG.Weight, weight);
foreach (var g in groups.Where(g => g.Attr == attrG.Attr && g.Cult == attrG.Cult).OrderByDescending(g => g.Weight).ThenBy(g => g.SortId)) {
AddToolTipRow(grid, rowNum++, null, g.SortId, g.Weight, attrG.Weight, weight);
}
}
if (attrGroups.Count == 1) {
var g = attrGroups.First();
var name = g.Attr == null && g.Cult == null ? null : g.Attr + (g.Attr != null && g.Cult != null ? " / " : "") + g.Cult;
if (name != null) {
text += $" [{name}]";
}
if (sortGroups.Count > 1 && sortGroups.Count <= 4) {
text += $" = {string.Join(" + ", sortGroups.Select(g => $"{g.Weight:N0} kg ({(double)g.Weight / weight:0%})" + (g.SortId == null ? "" : $" [{g.SortId}]")))}";
}
} else if (attrGroups.Count <= 4) {
text += $" = {string.Join(" + ", attrGroups.Select(g => $"{g.Weight:N0} kg ({(double)g.Weight / weight:0%})" + (g.Attr == null && g.Cult == null ? "" : $" [{g.Attr}{(g.Attr != null && g.Cult != null ? " / " : "")}{g.Cult}]")))}";
}
}
return (text, grid);
}
}
}

View File

@ -134,7 +134,7 @@ namespace Elwig.Services {
var var = await ctx.WineVarieties.ToDictionaryAsync(v => v.SortId, v => v);
var qual = await ctx.WineQualityLevels.Where(q => !q.IsPredicate).ToDictionaryAsync(q => q.QualId, q => q);
var mgnr = await ctx.Members.ToDictionaryAsync(m => m.MgNr.ToString(), m => m);
var zwst = await ctx.Branches.ToDictionaryAsync(b => b.Name.ToLower().Split(" ")[0], b => b);
var zwst = await ctx.Branches.ToDictionaryAsync(b => b.Name.ToLower().Split(' ')[0], b => b);
var attr = await ctx.WineAttributes.ToDictionaryAsync(a => a.Name.ToLower().Split(' ')[0], a => a);
var cult = await ctx.WineCultivations.ToDictionaryAsync(c => c.Name.ToLower().Split(' ')[0], c => c);
@ -183,11 +183,11 @@ namespace Elwig.Services {
} else if (e.ToLower() == "!gerebelt") {
prd = prd.And(p => p.IsNetWeight == false);
filter.RemoveAt(i--);
filterNames.Add("brutto Wiegung");
filterNames.Add("nicht gerebelt gewogen");
} else if (e.ToLower() == "gerebelt") {
prd = prd.And(p => p.IsNetWeight == true);
filter.RemoveAt(i--);
filterNames.Add("netto Wiegung");
filterNames.Add("gerebelt gewogen");
} else if (e.Length >= 5 && e.Length <= 9 && "lesewagen".StartsWith(e, StringComparison.CurrentCultureIgnoreCase)) {
prd = prd.And(p => p.IsLesewagen == true);
filter.RemoveAt(i--);
@ -763,6 +763,7 @@ namespace Elwig.Services {
})
.OrderByDescending(g => g.Weight)
.ThenBy(g => g.Attr)
.ThenBy(g => g.Cult)
.ToListAsync();
var sortGroups = await deliveryParts
.GroupBy(p => p.SortId)
@ -791,8 +792,9 @@ namespace Elwig.Services {
Avg = g.Sum(p => p.Kmw * p.Weight) / g.Sum(p => p.Weight),
Max = g.Max(p => p.Kmw)
})
.OrderByDescending(g => g.SortId)
.OrderByDescending(g => g.Weight)
.ThenBy(g => g.Attr)
.ThenBy(g => g.Cult)
.ThenBy(g => g.SortId)
.ToListAsync();

View File

@ -3,6 +3,7 @@ using Elwig.Models.Entities;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace Elwig.ViewModels {
public partial class DeliveryAncmtAdminViewModel : ObservableObject {
@ -73,6 +74,9 @@ namespace Elwig.ViewModels {
[ObservableProperty]
private string _statusAncmtModified = "-";
[ObservableProperty]
private Grid? _statusWeightToolTip;
[ObservableProperty]
private Visibility _controlButtonsVisibility = Visibility.Visible;
[ObservableProperty]

View File

@ -84,7 +84,7 @@
<RowDefinition Height="42"/>
<RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="5"/>
<RowDefinition Height="2*" MinHeight="100"/>
<RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="42"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -105,7 +105,12 @@
Filtern nach:<LineBreak/>
<Bold>Sorte</Bold>: z.B. GV, ZW, rr, sa, !gv (ausgenommen GV), ...<LineBreak/>
<Bold>Rot/Weiß</Bold>: z.B. r, Rot, w, weiß, ...<LineBreak/>
<Bold>Mitglied</Bold>: z.B. 1234, 987, ...
<Bold>Mitglied</Bold>: z.B. 1234, 987, ...<LineBreak/>
<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. &lt;500kg, &gt;6000kg, ...<LineBreak/>
<Bold>Datum</Bold>: z.B. 1.9., 15.9.-10.10., -15.10.2020, ...
</TextBlock>
</TextBox.ToolTip>
</TextBox>
@ -129,7 +134,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="24"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="32"/>
<TextBlock Text="{Binding ZwstId}" Width="25" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}" Width="200"/>
<TextBlock Text="{Binding Description}" Width="200" TextDecorations="{Binding TextDecoration}"/>
<TextBlock TextAlignment="Right">
<TextBlock Text="{Binding AnnouncedWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
/ <TextBlock Text="{Binding MaxWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
@ -288,7 +293,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="28"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="35"/>
<TextBlock Text="{Binding ZwstId}" Width="30" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}"/>
<TextBlock Text="{Binding Description}" TextDecorations="{Binding TextDecoration}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
@ -324,11 +329,11 @@
<ItemsPanelTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" MinWidth="120"/>
<ColumnDefinition Width="0.5*" MinWidth="120"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="1*" MinWidth="150"/>
<ColumnDefinition Width="1.75*" MinWidth="150"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2.25*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
@ -342,7 +347,7 @@
</StatusBarItem>
<Separator Grid.Column="1"/>
<StatusBarItem Grid.Column="2">
<TextBlock>
<TextBlock ToolTip="{Binding StatusWeightToolTip}">
Gewicht: <Run Text="{Binding StatusWeight}"/>
</TextBlock>
</StatusBarItem>

View File

@ -134,7 +134,14 @@ namespace Elwig.Windows {
DeliveryAncmtList.ScrollIntoView(DeliveryAncmtList.SelectedItem);
ViewModel.StatusAncmts = $"{deliveryAncmts.Count:N0}";
ViewModel.StatusWeight = $"{deliveryAncmts.Sum(a => a.Weight):N0} kg";
if (filter.Count == 0) {
var (text, grid) = await DeliveryAncmtService.GenerateToolTip(deliveryAncmtQuery);
ViewModel.StatusWeight = text;
ViewModel.StatusWeightToolTip = grid;
} else {
ViewModel.StatusWeight = $"{deliveryAncmts.Sum(a => a.Weight):N0} kg";
ViewModel.StatusWeightToolTip = null;
}
}
private async Task RefreshInputs(bool validate = false) {
@ -276,6 +283,9 @@ namespace Elwig.Windows {
InitInputs();
ViewModel.MgNr = mgnr;
ViewModel.EnableSearchInputs = false;
MgNrInput.Focus();
MgNrInput.SelectAll();
}
protected override void ShortcutEdit() {

View File

@ -19,12 +19,12 @@
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Appium.WebDriver" Version="4.4.5" />
<PackageReference Include="NReco.PdfRenderer" Version="1.5.3" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
<PackageReference Include="NReco.PdfRenderer" Version="1.5.4" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -1 +1 @@
curl --fail -s -L "https://elwig.at/files/create.sql?v=29" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
curl --fail -s -L "https://elwig.at/files/create.sql?v=30" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"