WerksverkaufScanner: Historie eingefügt
This commit is contained in:
parent
62014e4b63
commit
b1b2cf608c
@ -21,5 +21,7 @@ public class InventurErfassung
|
|||||||
|
|
||||||
public DateTime CreatedAt { get; set; }
|
public DateTime CreatedAt { get; set; }
|
||||||
public string Benutzer { get; set; }
|
public string Benutzer { get; set; }
|
||||||
|
|
||||||
|
public bool? Eingelesen { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
namespace WerksverkaufScanner.Data
|
||||||
|
{
|
||||||
|
public class InventurHistorieEintrag
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string ArtikelNummer { get; set; } = "";
|
||||||
|
public string Bezeichnung { get; set; } = "";
|
||||||
|
public int Variante { get; set; }
|
||||||
|
public int Menge { get; set; }
|
||||||
|
public DateTime? CreatedAt { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,17 +6,6 @@
|
|||||||
<h2>Inventur</h2>
|
<h2>Inventur</h2>
|
||||||
|
|
||||||
<div class="row row-cols-1 row-cols-md-2 g-3 mt-2">
|
<div class="row row-cols-1 row-cols-md-2 g-3 mt-2">
|
||||||
@* <div class="col">
|
|
||||||
<div class="card h-100 shadow-sm border-0">
|
|
||||||
<div class="card-body text-center">
|
|
||||||
<i class="bi bi-box-seam display-5 text-primary mb-2"></i>
|
|
||||||
<h5>Inventur vorbereiten</h5>
|
|
||||||
<p class="text-muted">Hier müssen die aktuellen Inventureinstellungen gescannt werden.</p>
|
|
||||||
<a href="/inventur/vorbereiten" class="btn btn-primary">Weiter</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> *@
|
|
||||||
|
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="card h-100 shadow-sm border-0">
|
<div class="card h-100 shadow-sm border-0">
|
||||||
<div class="card-body text-center">
|
<div class="card-body text-center">
|
||||||
@ -27,5 +16,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<div class="card h-100 shadow-sm border-0">
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<i class="bi bi-box-seam display-5 text-primary mb-2"></i>
|
||||||
|
<h5>Inventur - Historie</h5>
|
||||||
|
<p class="text-muted">Hier sehen Sie die zuletzt gescannten Artikel und Mengen.</p>
|
||||||
|
<a href="/inventur/historie" class="btn btn-primary">Weiter</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
@page "/inventur/historie"
|
||||||
|
@attribute [Authorize]
|
||||||
|
@inject InventurService Inventur
|
||||||
|
|
||||||
|
<h3>Inventur – Letzte Erfassungen</h3>
|
||||||
|
|
||||||
|
@if (historie == null)
|
||||||
|
{
|
||||||
|
<p>Lade Historie …</p>
|
||||||
|
}
|
||||||
|
else if (historie.Count == 0)
|
||||||
|
{
|
||||||
|
<p>Keine offenen Erfassungen für diese IP.</p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<table class="table table-sm table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ArtikelNr</th>
|
||||||
|
<th>Bezeichnung</th>
|
||||||
|
<th>Variante</th>
|
||||||
|
<th>Menge</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var h in historie)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@h.ArtikelNummer</td>
|
||||||
|
<td>@h.Bezeichnung</td>
|
||||||
|
<td>@h.Variante</td>
|
||||||
|
<td>@h.Menge</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
}
|
||||||
|
|
||||||
|
@code {
|
||||||
|
List<InventurHistorieEintrag>? historie;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
// IP dynamisch auslesen, z.B. aus localStorage oder Service:
|
||||||
|
var ip = "10.251.0.12"; // Zum Testen hart eintragen
|
||||||
|
historie = await Inventur.LadeInventurHistorieAsync(ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -53,4 +53,26 @@ public class InventurService
|
|||||||
|
|
||||||
return ctx?.Connection.RemoteIpAddress?.ToString();
|
return ctx?.Connection.RemoteIpAddress?.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<InventurHistorieEintrag>> LadeInventurHistorieAsync(string clientIp)
|
||||||
|
{
|
||||||
|
await using var db = await _dbFactory.CreateDbContextAsync();
|
||||||
|
|
||||||
|
// Hole die letzten 5 offenen Einträge inkl. Artikelnummer und Bezeichnung (JOIN via Artikel)
|
||||||
|
var query = from er in db.InventurErfassung
|
||||||
|
join art in db.Artikel on er.ArtikelId equals art.ArtikelId
|
||||||
|
where er.ClientIp == clientIp && er.Eingelesen == null
|
||||||
|
orderby er.Id descending
|
||||||
|
select new InventurHistorieEintrag
|
||||||
|
{
|
||||||
|
Id = er.Id,
|
||||||
|
ArtikelNummer = art.ArtikelNummer,
|
||||||
|
Bezeichnung = art.Bezeichnung,
|
||||||
|
Variante = er.Variante,
|
||||||
|
Menge = er.Menge,
|
||||||
|
CreatedAt = er.CreatedAt
|
||||||
|
};
|
||||||
|
|
||||||
|
return await query.ToListAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,6 @@
|
|||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<NavLink class="nav-link text-white" href="/inventur" Match="NavLinkMatch.Prefix">Inventur</NavLink>
|
<NavLink class="nav-link text-white" href="/inventur" Match="NavLinkMatch.Prefix">Inventur</NavLink>
|
||||||
</li>
|
</li>
|
||||||
@* <li class="nav-item">
|
|
||||||
<NavLink class="nav-link text-white" href="/stammdaten" Match="NavLinkMatch.Prefix">Stammdaten</NavLink>
|
|
||||||
</li> *@
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<NavLink class="nav-link text-white" href="/einstellungen" Match="NavLinkMatch.Prefix">Einstellungen</NavLink>
|
<NavLink class="nav-link text-white" href="/einstellungen" Match="NavLinkMatch.Prefix">Einstellungen</NavLink>
|
||||||
</li>
|
</li>
|
||||||
@ -76,10 +73,6 @@
|
|||||||
<NavLink class="nav-link text-white" href="/inventur" Match="NavLinkMatch.Prefix"
|
<NavLink class="nav-link text-white" href="/inventur" Match="NavLinkMatch.Prefix"
|
||||||
@onclick="CloseMenu">Inventur</NavLink>
|
@onclick="CloseMenu">Inventur</NavLink>
|
||||||
</li>
|
</li>
|
||||||
@* <li class="nav-item">
|
|
||||||
<NavLink class="nav-link text-white" href="/stammdaten" Match="NavLinkMatch.Prefix"
|
|
||||||
@onclick="CloseMenu">Stammdaten</NavLink>
|
|
||||||
</li> *@
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<NavLink class="nav-link text-white" href="/einstellungen" Match="NavLinkMatch.Prefix"
|
<NavLink class="nav-link text-white" href="/einstellungen" Match="NavLinkMatch.Prefix"
|
||||||
@onclick="CloseMenu">Einstellungen</NavLink>
|
@onclick="CloseMenu">Einstellungen</NavLink>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user