* 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);
}
}
}

View File

@@ -1,7 +1,104 @@
@page "/Warehouse/PackList"
@page "/Warehouse/PackList/{WzHeader:guid}"
@using Syncfusion.Blazor.Cards
@using Syncfusion.Blazor.Grids
@using SytelineSaAppEfDataModel.Dtos
@using Syncfusion.Blazor.Navigations
<h3>WarehousePackList</h3>
@inject WarehouseService WarehouseService
<div class="h-100 d-flex justify-content-center align-items-start">
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
<CardHeader>
<h3 class="text-primary">Packing List</h3>
</CardHeader>
<CardContent>
<SfGrid @ref="_grid"
AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
TValue="WzRowMeyleDto"
DataSource="@_wzRowsMeyle"
EnableAdaptiveUI="true">
<SfToolbar>
<ToolbarItems>
<ToolbarItem Type="ItemType.Button" Text="Zapisz" Id="SaveButton"
PrefixIcon="e-icons e-save" OnClick="SaveChanges"/>
<ToolbarItem Type="ItemType.Button" Id="Generuj XLS" PrefixIcon="e-icons export-xls"
Text="Usuń Zapisane Filtry" OnClick="ExportXls"/>
</ToolbarItems>
</SfToolbar>
<GridColumns>
<GridColumn Field=@nameof(WzRowMeyleDto.ID) IsPrimaryKey="true" Visible="false" AllowEditing="false"
TextAlign="TextAlign.Center" HeaderText="ID" Width="70"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.OrderNumber) AllowEditing="false"
TextAlign="TextAlign.Center" HeaderText="Numer Zamówienia Meyle"
Width="70"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.ItemNumber) AllowEditing="false"
TextAlign="TextAlign.Center" HeaderText="Meyle Numer" Width="100"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.Quantity) AllowEditing="false" TextAlign="TextAlign.Center"
HeaderText="Ilość w Dostawie" Width="80"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.PalletNumber) AllowEditing="true"
TextAlign="TextAlign.Center" HeaderText="Nr Palety" Width="100"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.WzNumber) AllowEditing="false" TextAlign="TextAlign.Center"
HeaderText="Nr WZ" Width="100"></GridColumn>
<GridColumn Field=@nameof(WzRowMeyleDto.PartNumber) AllowEditing="true" TextAlign="TextAlign.Center"
HeaderText="Nr Partii" Width="80"></GridColumn>
</GridColumns>
<GridEditSettings AllowDeleting="false"
AllowAdding="false"
AllowEditing="true"
AllowNextRowEdit="true"
AllowEditOnDblClick="true"
ShowConfirmDialog="false"
Mode="EditMode.Batch">
</GridEditSettings>
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
<GridEvents OnBatchSave="OnBatchSave" TValue="WzRowMeyleDto"></GridEvents>
</SfGrid>
</CardContent>
<CardFooter>
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
</CardFooter>
</SfCard>
</div>
@code {
[Parameter] public Guid WzHeader { get; set; }
private SfGrid<WzRowMeyleDto> _grid;
private IEnumerable<WzRowMeyleDto> _wzRowsMeyle { get; set; } = new List<WzRowMeyleDto>();
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
_wzRowsMeyle = await WarehouseService.GetWzRowsByWzHeaderId(WzHeader);
StateHasChanged();
}
}
private async Task SaveChanges()
{
await _grid.EndEditAsync();
}
private async Task OnBatchSave(BeforeBatchSaveArgs<WzRowMeyleDto> obj)
{
var changes = obj.BatchChanges;
var changedRecords = changes.ChangedRecords;
await WarehouseService.UpdateWzRowsMeyleAsync(changedRecords);
_wzRowsMeyle = await WarehouseService.GetWzRowsByWzHeaderId(WzHeader);
StateHasChanged();
await _grid.Refresh();
}
private async Task ExportXls()
{
await _grid.ExportToExcelAsync();
}
}