* Further improvements to generate PackList

This commit is contained in:
2025-05-17 18:36:11 +02:00
parent bc28c5d63d
commit 6ab3960e50
20 changed files with 671 additions and 191 deletions

View File

@@ -9,6 +9,7 @@
@using Syncfusion.Blazor.Navigations
@inject WarehouseService WarehouseService
@inject NavigationManager NavigationManager
<div class="h-100 d-flex justify-content-center align-items-start">
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
@@ -30,12 +31,10 @@
AllowSorting="true"
AllowSelection="true"
TValue="MaterialTransactionDto"
DataSource="@_materialTransactions"
DataSource="@_dataSource"
EnableAdaptiveUI="true">
<GridColumns>
<GridColumn Field=@nameof(MaterialTransactionDto.MTGroupNum) HeaderText="Numer WZ" TextAlign="TextAlign.Center" Width="110"></GridColumn>
<GridColumn Field=@nameof(MaterialTransactionDto.Item) HeaderText="Indeks" TextAlign="TextAlign.Center" Width="80"></GridColumn>
<GridColumn Field=@nameof(MaterialTransactionDto.Qty) HeaderText="Ilość sztuk" TextAlign="TextAlign.Right" Width="90"></GridColumn>
<GridColumn Field=@nameof(MaterialTransactionDto.CreateDate) HeaderText="Data utworzenia" TextAlign="TextAlign.Center" Width="100"></GridColumn>
<GridColumn Field=@nameof(MaterialTransactionDto.RefNum) HeaderText="Numer zamówienia" TextAlign="TextAlign.Center" Width="110"></GridColumn>
</GridColumns>
@@ -48,7 +47,6 @@
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10" PageSizes="@(new[] { 10, 20, 50, 100 })"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
@* <GridEvents TValue="EdiCustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick" RowSelected="RowSelected"/> *@
</SfGrid>
}
</CardContent>
@@ -60,10 +58,11 @@
@code {
private SfGrid<MaterialTransactionDto> _grid;
IEnumerable<WzClientDto> _clients = new List<WzClientDto>();
IEnumerable<MaterialTransactionDto> _materialTransactions = new List<MaterialTransactionDto>();
private IEnumerable<WzClientDto> _clients = new List<WzClientDto>();
private IEnumerable<MaterialTransactionDto> _materialTransactions = new List<MaterialTransactionDto>();
private IEnumerable<MaterialTransactionDto> _dataSource = new List<MaterialTransactionDto>();
WzClientDto? _selectedClient;
private WzClientDto? _selectedClient;
bool _isVisible = false;
@@ -83,6 +82,7 @@
_selectedClient = args.ItemData;
_isVisible = true;
_materialTransactions = await WarehouseService.GetAllClientWzsAsync(_selectedClient.CustomerNumber, _selectedClient.CustomerSequence ?? 0);
_dataSource = _materialTransactions.GroupBy(x => x.MTGroupNum).Select(x => x.First()).ToList();
}
else
{
@@ -110,17 +110,29 @@
{
case "MEYLE":
IList<WzRowMeyleDto> rows = new List<WzRowMeyleDto>();
foreach (MaterialTransactionDto materialTransactionDto in selectedRecords)
IList<MaterialTransactionDto> materialTransactions = _materialTransactions.Where(x => selectedRecords.Any(y => y.MTGroupNum == x.MTGroupNum)).ToList();
foreach (MaterialTransactionDto materialTransactionDto in materialTransactions)
{
CustomerOrderDto customerOrder = await WarehouseService.GetCustomerOrder(materialTransactionDto.RefNum ?? string.Empty);
ItemCustDto item = await WarehouseService.GetItem(materialTransactionDto.Item ?? string.Empty, customerOrder.CustNum);
rows.Add(new WzRowMeyleDto
{
ID = Guid.NewGuid(),
Quantity = Math.Abs((int?)materialTransactionDto.Qty ?? 0),
//ItemNumber =
ItemNumber = item.CustItem,
OrderNumber = customerOrder.CustPo,
WzNumber = materialTransactionDto.MTGroupNum ?? string.Empty,
FK_Header = wzHeader.ID
});
}
await WarehouseService.CreateWzRowsMeyleAsync(rows);
break;
}
NavigationManager.NavigateTo("/Warehouse/PackList/" + wzHeader.ID);
}
}
}