* Added validation to not generate more than one PackingList to the same WZ

* Added filtering when found more than one item after scanning
This commit is contained in:
2025-08-04 20:13:54 +02:00
parent e69b10398f
commit 1842fd6146
2 changed files with 39 additions and 4 deletions

View File

@@ -94,6 +94,17 @@
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
</DialogButtons>
</SfDialog>
<SfDialog Width="500px" Title="Błąd" IsModal="true" @bind-Visible="VisibilityError" AllowPrerender="true">
<DialogTemplates>
<Content>
<p>Błąd: Dla zaznaczonego rekordu istnieje już PackingList!</p>
</Content>
</DialogTemplates>
<DialogButtons>
<DialogButton Content="OK" IsPrimary="true" OnClick="@HideModal"/>
</DialogButtons>
</SfDialog>
<CardFooter>
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
@@ -115,6 +126,7 @@
private bool _isVisible;
private bool Visibility { get; set; }
private bool VisibilityError { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
@@ -178,12 +190,20 @@
return;
}
string wzNumbers = string.Join(", ",selectedRecords.Select(x => x.MTGroupNum).Distinct());
if (_wzHeaders.Any(x => x.WzNumbers == wzNumbers))
{
VisibilityError = true;
return;
}
WzHeaderDto wzHeader = new WzHeaderDto
{
ID = Guid.NewGuid(),
FK_Client = _selectedClient?.ID,
CreatedDate = DateTime.Now,
WzNumbers = string.Join(", ",selectedRecords.Select(x => x.MTGroupNum).Distinct())
WzNumbers = wzNumbers
};
await WarehouseService.CreateWzHeaderAsync(wzHeader);
@@ -223,5 +243,6 @@
private void HideModal()
{
Visibility = false;
VisibilityError = false;
}
}