* Further improvements of Warehouse view
* Fixed issue with not saving Products updates
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@page "/Warehouse"
|
||||
|
||||
@using Blazored.LocalStorage
|
||||
@using Syncfusion.Blazor.Cards
|
||||
@using Syncfusion.Blazor.Grids
|
||||
@using SytelineSaAppEfDataModel.Dtos
|
||||
@@ -10,6 +11,7 @@
|
||||
|
||||
@inject WarehouseService WarehouseService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ILocalStorageService LocalStorage
|
||||
|
||||
<div class="h-100 d-flex justify-content-center align-items-start">
|
||||
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||
@@ -18,36 +20,66 @@
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<h5 class="text-primary mb-3">Klient</h5>
|
||||
<SfDropDownList TValue="Guid?" TItem="WzClientDto" DataSource="@_clients" Placeholder="Wybierz Klienta">
|
||||
<SfDropDownList @ref="_dropdown" TValue="Guid?" TItem="WzClientDto" DataSource="@_clients" Placeholder="Wybierz Klienta">
|
||||
<DropDownListFieldSettings Value="ID" Text="Name"/>
|
||||
<DropDownListEvents TValue="Guid?" TItem="WzClientDto" ValueChange="OnValueChange"/>
|
||||
</SfDropDownList>
|
||||
@if (_isVisible)
|
||||
{
|
||||
<h5 class="text-primary mb-3">Dokumenty WZ</h5>
|
||||
<SfGrid @ref="_grid"
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
AllowSelection="true"
|
||||
TValue="MaterialTransactionDto"
|
||||
DataSource="@_dataSource"
|
||||
EnableAdaptiveUI="true">
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(MaterialTransactionDto.MTGroupNum) HeaderText="Numer WZ" TextAlign="TextAlign.Center" Width="110"></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>
|
||||
<SfToolbar>
|
||||
<ToolbarItems>
|
||||
<ToolbarItem Type="ItemType.Button" Text="Utwórz Packing List" Id="CreatePackingList"
|
||||
PrefixIcon="e-icons e-save" OnClick="CreatePackingList"/>
|
||||
</ToolbarItems>
|
||||
</SfToolbar>
|
||||
<GridFilterSettings Type="FilterType.Excel"/>
|
||||
<GridPageSettings PageSize="10" PageSizes="@(new[] { 10, 20, 50, 100 })"/>
|
||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
|
||||
</SfGrid>
|
||||
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||
<CardHeader>
|
||||
<h5 class="text-primary mb-3">Dokumenty WZ</h5>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<SfGrid @ref="_grid"
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
AllowSelection="true"
|
||||
TValue="MaterialTransactionDto"
|
||||
DataSource="@_dataSource"
|
||||
EnableAdaptiveUI="true">
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(MaterialTransactionDto.MTGroupNum) HeaderText="Numer WZ" TextAlign="TextAlign.Center" Width="110"></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>
|
||||
<SfToolbar>
|
||||
<ToolbarItems>
|
||||
<ToolbarItem Type="ItemType.Button" Text="Utwórz Packing List" Id="CreatePackingList"
|
||||
PrefixIcon="e-icons e-save" OnClick="CreatePackingList"/>
|
||||
</ToolbarItems>
|
||||
</SfToolbar>
|
||||
<GridFilterSettings Type="FilterType.Excel"/>
|
||||
<GridPageSettings PageSize="5"/>
|
||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
|
||||
</SfGrid>
|
||||
</CardContent>
|
||||
</SfCard>
|
||||
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
|
||||
<CardHeader>
|
||||
<h5 class="text-primary mb-3">Packling Listy</h5>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<SfGrid @ref="_wzHeadersGrid"
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
AllowSelection="true"
|
||||
TValue="WzHeaderDto"
|
||||
DataSource="@_wzHeaders"
|
||||
EnableAdaptiveUI="true">
|
||||
<GridColumns>
|
||||
<GridColumn Field=@nameof(WzHeaderDto.ID) HeaderText="ID" TextAlign="TextAlign.Center" Width="110"></GridColumn>
|
||||
<GridColumn Field=@nameof(WzHeaderDto.CreatedDate) HeaderText="Data utworzenia" TextAlign="TextAlign.Center" Width="100"></GridColumn>
|
||||
</GridColumns>
|
||||
<GridFilterSettings Type="FilterType.Excel"/>
|
||||
<GridPageSettings PageSize="5"/>
|
||||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||||
<GridEvents TValue="WzHeaderDto" OnRecordDoubleClick="OnRowDoubleClick"/>
|
||||
</SfGrid>
|
||||
</CardContent>
|
||||
</SfCard>
|
||||
}
|
||||
</CardContent>
|
||||
<CardFooter>
|
||||
@@ -58,19 +90,32 @@
|
||||
|
||||
@code {
|
||||
private SfGrid<MaterialTransactionDto> _grid;
|
||||
private SfGrid<WzHeaderDto> _wzHeadersGrid;
|
||||
private IEnumerable<WzClientDto> _clients = new List<WzClientDto>();
|
||||
private IEnumerable<MaterialTransactionDto> _materialTransactions = new List<MaterialTransactionDto>();
|
||||
private IEnumerable<MaterialTransactionDto> _dataSource = new List<MaterialTransactionDto>();
|
||||
private IEnumerable<WzHeaderDto> _wzHeaders = new List<WzHeaderDto>();
|
||||
|
||||
private WzClientDto? _selectedClient;
|
||||
|
||||
bool _isVisible = false;
|
||||
|
||||
private WzHeaderDto? _selectedHeader;
|
||||
private SfDropDownList<Guid?, WzClientDto> _dropdown;
|
||||
private bool _isVisible;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
_clients = await WarehouseService.GetAllClientsAsync();
|
||||
_clients = _clients.Where(x => x.Name.Equals("MEYLE", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var savedClientId = await LocalStorage.GetItemAsync<Guid?>("SelectedClientId");
|
||||
|
||||
if (savedClientId != null && _clients.FirstOrDefault(c => c.ID == savedClientId) is {} savedClient)
|
||||
{
|
||||
await OnValueChange(new ChangeEventArgs<Guid?, WzClientDto>() { Value = savedClient.ID });
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -79,10 +124,18 @@
|
||||
{
|
||||
if (args.Value.HasValue)
|
||||
{
|
||||
_selectedClient = args.ItemData;
|
||||
_selectedClient = args.ItemData ?? _clients.FirstOrDefault(x => x.ID == args.Value);
|
||||
|
||||
if (_selectedClient == null) { return; }
|
||||
|
||||
_isVisible = true;
|
||||
_materialTransactions = await WarehouseService.GetAllClientWzsAsync(_selectedClient.CustomerNumber, _selectedClient.CustomerSequence ?? 0);
|
||||
_dataSource = _materialTransactions.GroupBy(x => x.MTGroupNum).Select(x => x.First()).ToList();
|
||||
_wzHeaders = await WarehouseService.GetAllClientWzHeadersAsync(_selectedClient.CustomerNumber, _selectedClient.CustomerSequence ?? 0);
|
||||
|
||||
await LocalStorage.SetItemAsync("SelectedClientId", _selectedClient.ID);
|
||||
|
||||
_dropdown.Value = _selectedClient.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,6 +146,13 @@
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void OnRowDoubleClick(RecordDoubleClickEventArgs<WzHeaderDto> obj)
|
||||
{
|
||||
Guid headerId = obj.RowData.ID;
|
||||
|
||||
NavigationManager.NavigateTo("/Warehouse/PackList/" + headerId);
|
||||
}
|
||||
|
||||
private async Task CreatePackingList()
|
||||
{
|
||||
var selectedRecords = await _grid.GetSelectedRecordsAsync();
|
||||
|
||||
Reference in New Issue
Block a user