* Added new Controllers to API

* Added methods to get WZs for specific client
This commit is contained in:
2025-05-08 20:44:20 +02:00
parent 1f08ae05f0
commit da1eae8ca9
8 changed files with 125 additions and 59 deletions

View File

@@ -2,6 +2,9 @@
@using Syncfusion.Blazor.Cards
@using Syncfusion.Blazor.Grids
@using SytelineSaAppEfDataModel.Dtos
@inject WarehouseService WarehouseService
<div class="h-100 d-flex justify-content-center align-items-start">
<SfCard CssClass="shadow" style="width: 100%; max-width: 1200px;">
@@ -9,63 +12,34 @@
<h3 class="text-primary">Dokumenty WZ na Magazynie</h3>
</CardHeader>
<CardContent>
<SfGrid @ref="_grid"
AllowFiltering="true"
AllowPaging="true"
AllowSorting="true"
AllowSelection="true"
TValue="EdiCustomerOrderDto"
DataSource="@_ediCustomerOrders"
EnableAdaptiveUI="true">
<GridTemplates>
<DetailTemplate>
@{
var order = context as EdiCustomerOrderDto;
<SfCard CssClass="mb-4">
<CardContent>
<div class="row">
<div class="col">
<u>Numer zamówienia EDI:</u> <b>@order?.CustomerOrderNumber</b><br/>
<u>Numer zamówienia Klienta:</u> <b>@order?.CustomerPoNumber</b><br/>
<u>Numer klienta:</u> <b>@order?.CustomerNumber</b><br/>
<u>Klient:</u> <b>@order?.CustomerName</b><br/>
<u>Numer odbiorcy:</u> <b>@(order?.CustomerSequence?.ToString() ?? "N/A")</b><br/>
<u>Data otrzymania:</u> <b>@(order?.RecivedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
<u>Wysłano do Syteline?:</u> <b>@((order?.Posted?.ToString() ?? "0") == "0" ? "NIE" : "TAK")</b><br/>
<u>Data wysyłki do Syteline:</u> <b>@(order?.PostedDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
<u>Data zamówienia:</u> <b>@(order?.OrderDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
</div>
<div class="col">
<u>Cena:</u> <b>@(order?.Price?.ToString("F2") ?? "N/A")</b><br/>
<u>Waga:</u> <b>@(order?.Weight?.ToString("F2") ?? "N/A")</b><br/>
<u>Magazyn:</u> <b>@order?.Warehouse</b><br/>
<u>Gate:</u> <b>@order?.Gate</b><br/>
<u>Kod odbiorcy:</u> <b>@order?.RecipientCode</b><br/>
<u>Kod wysyłającego:</u> <b>@order?.SenderCode</b><br/>
<u>Kod sprzedawcy:</u> <b>@order?.SellerCode</b><br/>
<u>Kod kupującego:</u> <b>@order?.BuyerCode</b><br/>
<u>Typ dokumentu:</u> <b>@order?.DocType</b><br/>
</div>
</div>
</CardContent>
</SfCard>
}
</DetailTemplate>
</GridTemplates>
<GridColumns>
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerOrderNumber) HeaderText="Numer Zamówienia" Width="110"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerPoNumber) HeaderText="Zamówienie Klienta" Width="100"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerNumber) HeaderText="Numer Klienta" Width="90"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerSequence) HeaderText="Odbiorca" Width="80"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.CreateDate) HeaderText="Data Otrzymania" TextAlign="TextAlign.Center" Width="110"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.SlOrderNumber) HeaderText="Zamówienie SL" Width="100"></GridColumn>
<GridColumn Field=@nameof(EdiCustomerOrderDto.SentToSl) HeaderText="Wysłane do SL" TextAlign="TextAlign.Center" Width="80"></GridColumn>
</GridColumns>
<GridFilterSettings Type="FilterType.Excel"/>
<GridPageSettings PageSize="10"/>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/>
<GridEvents TValue="EdiCustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick" RowSelected="RowSelected"/>
</SfGrid>
@* <SfGrid @ref="" *@
@* AllowFiltering="true" *@
@* AllowPaging="true" *@
@* AllowSorting="true" *@
@* AllowSelection="true" *@
@* TValue="" *@
@* DataSource="" *@
@* EnableAdaptiveUI="true"> *@
@* <GridTemplates> *@
@* <DetailTemplate> *@
@* @{ *@
@* } *@
@* </DetailTemplate> *@
@* </GridTemplates> *@
@* <GridColumns> *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerOrderNumber) HeaderText="Numer Zamówienia" Width="110"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerPoNumber) HeaderText="Zamówienie Klienta" Width="100"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerNumber) HeaderText="Numer Klienta" Width="90"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.CustomerSequence) HeaderText="Odbiorca" Width="80"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.CreateDate) HeaderText="Data Otrzymania" TextAlign="TextAlign.Center" Width="110"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.SlOrderNumber) HeaderText="Zamówienie SL" Width="100"></GridColumn> #1# *@
@* $1$ <GridColumn Field=@nameof(EdiCustomerOrderDto.SentToSl) HeaderText="Wysłane do SL" TextAlign="TextAlign.Center" Width="80"></GridColumn> #1# *@
@* </GridColumns> *@
@* <GridFilterSettings Type="FilterType.Excel"/> *@
@* <GridPageSettings PageSize="10"/> *@
@* <GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"/> *@
@* $1$ <GridEvents TValue="EdiCustomerOrderDto" OnRecordDoubleClick="OnRowDoubleClick" RowSelected="RowSelected"/> #1# *@
@* </SfGrid> *@
</CardContent>
<CardFooter>
<small class="text-muted">FA Krosno Manager © @(DateTime.Now.Year)</small>
@@ -74,5 +48,11 @@
</div>
@code {
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
IEnumerable<MaterialTransactionDto> task = await WarehouseService.GetAllClientWzsAsync("K005531", 0);
}
}
}

View File

@@ -52,6 +52,7 @@ builder.Services.AddScoped<FunctionService>();
builder.Services.AddScoped<UserService>();
builder.Services.AddScoped<ErrorLogService>();
builder.Services.AddScoped<ProductService>();
builder.Services.AddScoped<WarehouseService>();
var app = builder.Build();

View File

@@ -0,0 +1,21 @@
using SytelineSaAppEfDataModel.Dtos;
namespace OrdersManagement.Services;
public class WarehouseService
{
private readonly HttpClient _httpClient;
public WarehouseService(IHttpClientFactory httpClientFactory)
{
_httpClient = httpClientFactory.CreateClient("FaKrosnoApi");
}
public async Task<IEnumerable<MaterialTransactionDto>> GetAllClientWzsAsync(string customerNumber, int customerSequence)
{
var response = await _httpClient.GetAsync(
$"api/WzHeader/by-customer-number?customerNumber={customerNumber}&customerSequence={customerSequence}");
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<IEnumerable<MaterialTransactionDto>>();
}
}