* 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();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
@using Syncfusion.Blazor.Grids
|
||||
@using SytelineSaAppEfDataModel.Dtos
|
||||
@using Syncfusion.Blazor.Navigations
|
||||
@using Syncfusion.Blazor.Popups
|
||||
|
||||
@inject WarehouseService WarehouseService
|
||||
|
||||
@@ -13,13 +14,13 @@
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<SfGrid @ref="_grid"
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
AllowSelection="true"
|
||||
TValue="WzRowMeyleDto"
|
||||
DataSource="@_wzRowsMeyle"
|
||||
EnableAdaptiveUI="true">
|
||||
AllowFiltering="true"
|
||||
AllowPaging="true"
|
||||
AllowSorting="true"
|
||||
AllowSelection="true"
|
||||
TValue="WzRowMeyleDto"
|
||||
DataSource="@_wzRowsMeyle"
|
||||
EnableAdaptiveUI="true">
|
||||
<SfToolbar>
|
||||
<ToolbarItems>
|
||||
<ToolbarItem Type="ItemType.Button" Text="Zapisz" Id="SaveButton"
|
||||
@@ -59,6 +60,25 @@
|
||||
<GridEvents OnBatchSave="OnBatchSave" TValue="WzRowMeyleDto"></GridEvents>
|
||||
</SfGrid>
|
||||
</CardContent>
|
||||
|
||||
<SfDialog Width="500px" Title="Informacja" IsModal="true" @bind-Visible="Visibility" AllowPrerender="true">
|
||||
<DialogTemplates>
|
||||
<Content>
|
||||
@if (_isValid)
|
||||
{
|
||||
<p>Packing List został wygenerowany i wysłany!</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Błąd: Nie Wszystkie linie mają wypełniony <b>NUMER PALETY</b>.<br/>Packing List nie zostanie wygenerowany!</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>
|
||||
</CardFooter>
|
||||
@@ -71,6 +91,15 @@
|
||||
private SfGrid<WzRowMeyleDto> _grid;
|
||||
private IEnumerable<WzRowMeyleDto> _wzRowsMeyle { get; set; } = new List<WzRowMeyleDto>();
|
||||
|
||||
private bool _isValid;
|
||||
|
||||
private bool Visibility { get; set; }
|
||||
|
||||
private void HideModal()
|
||||
{
|
||||
Visibility = false;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
@@ -99,6 +128,15 @@
|
||||
|
||||
private async Task ExportXls()
|
||||
{
|
||||
await WarehouseService.GenerateXlsForMeyleAsync(WzHeader);
|
||||
int count = _wzRowsMeyle.Count(x => x.PalletNumber == null);
|
||||
|
||||
_isValid = count == 0;
|
||||
|
||||
if (_isValid)
|
||||
{
|
||||
await WarehouseService.GenerateXlsForMeyleAsync(WzHeader);
|
||||
}
|
||||
|
||||
Visibility = true;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,14 @@ public class WarehouseService(IHttpClientFactory httpClientFactory)
|
||||
return await response.Content.ReadFromJsonAsync<IEnumerable<MaterialTransactionDto>>();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<WzHeaderDto>> GetAllClientWzHeadersAsync(string customerNumber, int customerSequence)
|
||||
{
|
||||
var response = await _httpClient.GetAsync(
|
||||
$"api/WzHeader/all-wz-headers?customerNumber={customerNumber}&customerSequence={customerSequence}");
|
||||
response.EnsureSuccessStatusCode();
|
||||
return await response.Content.ReadFromJsonAsync<IEnumerable<WzHeaderDto>>();
|
||||
}
|
||||
|
||||
public async Task CreateWzHeaderAsync(WzHeaderDto wzHeader)
|
||||
{
|
||||
var response = await _httpClient.PostAsJsonAsync("api/WzHeader", wzHeader);
|
||||
|
||||
Reference in New Issue
Block a user