290 lines
15 KiB
Plaintext
290 lines
15 KiB
Plaintext
@page "/CustomerOrder/{CustomerOrderId:guid}"
|
||
|
||
@rendermode InteractiveServer
|
||
|
||
@inject CustomerOrderService CustomerOrderService
|
||
@inject ScheduleOrderService ScheduleOrderService
|
||
@using SytelineSaAppEfDataModel.Dtos
|
||
@using OrdersManagement.Components.Pages.Shared
|
||
@using Syncfusion.Blazor.Grids
|
||
@using Syncfusion.Blazor.Cards
|
||
@inherits LayoutComponentBase
|
||
|
||
<div class="h-100 d-flex flex-column">
|
||
<h5>Zamówienie klienta nr @CustomerOrderDto?.CoNum</h5>
|
||
<SfCard>
|
||
<CardContent>
|
||
<div class="row">
|
||
<div class="col">
|
||
<u>Numer Zamówienia:</u> <b>@CustomerOrderDto?.CoNum</b><br/>
|
||
<u>Numer Zamówienia Klienta:</u> <b>@CustomerOrderDto?.CustPo</b><br/>
|
||
<u>Klient:</u> <b>@CustomerOrderDto?.CustNum</b><br/>
|
||
<u>Numer Odbiorcy:</u> <b>@CustomerOrderDto?.CustSeq</b><br/>
|
||
<u>Kontakt:</u> <b>@CustomerOrderDto?.Contact</b><br/>
|
||
<u>Telefon:</u> <b>@CustomerOrderDto?.Phone</b><br/>
|
||
<u>Data Zamówienia:</u> <b>@CustomerOrderDto?.OrderDate.ToString("yyyy-MM-dd HH:mm:ss")</b><br/>
|
||
<u>Warunki:</u> <b>@CustomerOrderDto?.TermsCode</b><br/>
|
||
<u>Wartość Brutto:</u> <b>@(CustomerOrderDto?.Price?.ToString("F2") ?? "N/A")</b><br/>
|
||
<u>Status:</u> <b>@CustomerOrderDto?.TranslatedStatus</b><br/>
|
||
</div>
|
||
<div class="col">
|
||
<u>Magazyn:</u> <b>@CustomerOrderDto?.Whse</b><br/>
|
||
<u>VAT:</u> <b>@CustomerOrderDto?.FrtTaxCode1</b><br/>
|
||
<u>Typ Odbiorcy:</u> <b>@CustomerOrderDto?.EndUserType</b><br/>
|
||
<u>Kurs Wymiany:</u> <b>@(CustomerOrderDto?.ExchRate?.ToString("F4") ?? "N/A")</b><br/>
|
||
<u>Gate:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_Gate</b><br/>
|
||
<u>RecipientCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_RecipientCode</b><br/>
|
||
<u>SelletCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SellerCode</b><br/>
|
||
<u>SenderCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_SenderCode</b><br/>
|
||
<u>BuyerCode:</u> <b>@CustomerOrderDto?.Uf_FKR_EDI_BuyerCode</b><br/>
|
||
<u>Typ Dokumentu:</u> <b>@CustomerOrderDto?.Uf_DocType</b><br/>
|
||
</div>
|
||
</div>
|
||
</CardContent>
|
||
</SfCard>
|
||
<br/>
|
||
<div class="row">
|
||
<div class="col-md-12">
|
||
<Button Color="ButtonColor.Primary" @onclick="ShowLastDelfors">@_text</Button>
|
||
</div>
|
||
</div>
|
||
<br/>
|
||
@if (_isVisible)
|
||
{
|
||
<div class="row">
|
||
<h5>Zamówienie DELFOR do zamówienia @CustomerOrderDto?.CoNum</h5>
|
||
</div>
|
||
<br/>
|
||
<div class="row">
|
||
<ScheduleOrdersGrid PageSize="5" PassGridRef="SetGridRef" GridData="_scheduleOrders"></ScheduleOrdersGrid>
|
||
</div>
|
||
<br/>
|
||
}
|
||
<h5>Indeksy</h5>
|
||
<SfGrid @ref="_customerOrderLinesGrid"
|
||
AllowFiltering="true"
|
||
AllowPaging="true"
|
||
AllowSorting="true"
|
||
AllowSelection="true"
|
||
TValue="CustomerOrderLineDto"
|
||
DataSource="@_customerOrderLines"
|
||
EnableAdaptiveUI="true">
|
||
<GridTemplates>
|
||
<DetailTemplate>
|
||
@{
|
||
var order = context as CustomerOrderLineDto;
|
||
<SfCard>
|
||
<CardContent>
|
||
<div class="row">
|
||
<h6>Szczegóły</h6>
|
||
<div class="col">
|
||
<u>Numer zamówienia:</u> <b>@order?.CoNum</b><br/>
|
||
<u>Linia:</u> <b>@order?.CoLine</b><br/>
|
||
<u>Pozycja:</u> <b>@order?.Item</b><br/>
|
||
<u>Pozycja Klienta:</u> <b>@order?.CustItem</b><br/>
|
||
<u>Opis:</u> <b>@order?.Description</b><br/>
|
||
<u>Łączna Ilość:</u> <b>@order?.BlanketQty.ToString("F2")</b><br/>
|
||
<u>Status:</u> <b>@order?.TranslatedStatus</b><br/>
|
||
</div>
|
||
<div class="col">
|
||
<u>Cena:</u> <b>@(order?.ContPrice?.ToString("F2") ?? "N/A")</b><br/>
|
||
<u>Ważne Od:</u> <b>@(order?.EffDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||
<u>J/M:</u> <b>@order?.UM</b><br/>
|
||
<u>BoxType:</u> <b>@order?.Uf_FKR_EDI_BLN_BoxType</b><br/>
|
||
<u>Address:</u> <b>@order?.Uf_FKR_EDI_BLN_Address</b><br/>
|
||
<u>FinalDestination:</u> <b>@order?.Uf_FKR_EDI_BLN_FinalDestination</b><br/>
|
||
<u>QtyPerBox:</u> <b>@(order?.Uf_FKR_EDI_BLN_QtyPerBox?.ToString() ?? "N/A")</b>
|
||
</div>
|
||
</div>
|
||
</CardContent>
|
||
</SfCard>
|
||
}
|
||
</DetailTemplate>
|
||
</GridTemplates>
|
||
<GridColumns>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.CoLine) HeaderText="Linia" Width="70"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.Item) HeaderText="Pozycja" Width="100"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.CustItem) HeaderText="Pozycja Klienta"
|
||
Width="120"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.Description) HeaderText="Opis" Width="200"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.BlanketQty) HeaderText="Ilość" TextAlign="TextAlign.Right"
|
||
Width="100"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.UM) HeaderText="J/M" Width="50"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.ContPrice) HeaderText="Cena" Width="100"></GridColumn>
|
||
<GridColumn Field=@nameof(CustomerOrderLineDto.TranslatedStatus) HeaderText="Status"
|
||
Width="100"></GridColumn>
|
||
</GridColumns>
|
||
<GridFilterSettings Type="FilterType.Excel"/>
|
||
<GridPageSettings PageSize="10"/>
|
||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||
<GridEvents TValue="CustomerOrderLineDto" RowSelected="OnSelectedLineRow"></GridEvents>
|
||
</SfGrid>
|
||
@if (_isVisibleCustomerOrderLine)
|
||
{
|
||
<br/>
|
||
<h5>Harmonogramy</h5>
|
||
<SfGrid @ref="_customerOrderLineItemsGrid"
|
||
TValue="CustomerOrderLineItemDto"
|
||
DataSource="@_customerOrderLineItems"
|
||
AllowFiltering="true"
|
||
AllowPaging="true"
|
||
AllowSelection="true"
|
||
AllowSorting="true"
|
||
SelectionMode="Syncfusion.Blazor.Grids.SelectionMode.Single"
|
||
SelectedItemsChanged="SelectedCustomerOrderLineItemChanged">
|
||
<GridTemplates>
|
||
<DetailTemplate>
|
||
@{
|
||
var detailLineItem = context as CustomerOrderLineItemDto;
|
||
<SfCard>
|
||
<CardContent>
|
||
<div class="row">
|
||
<h6>Szczegóły</h6>
|
||
<div class="col">
|
||
<u>Numer Zamówienia:</u> <b>@detailLineItem?.CoNum</b><br/>
|
||
<u>Linia:</u> <b>@detailLineItem?.CoLine</b><br/>
|
||
<u>Zwolnienie:</u> <b>@detailLineItem?.CoRelease</b><br/>
|
||
<u>Pozycja:</u> <b>@detailLineItem?.Item</b><br/>
|
||
<u>Pozycja Klienta:</u> <b>@detailLineItem?.CustItem</b><br/>
|
||
<u>Łączna Ilość
|
||
Sztuk:</u> <b>@(detailLineItem?.QtyOrdered.ToString("F2") ?? "N/A")</b><br/>
|
||
<u>Cena:</u> <b>@(detailLineItem?.Price.ToString("F2") ?? "N/A")</b><br/>
|
||
<u>Data
|
||
Wykonania:</u> <b>@(detailLineItem?.DueDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||
<u>Data
|
||
Rejestracji:</u> <b>@(detailLineItem?.ReleaseDate?.ToString("dd.MM.yyyy") ?? "N/A")</b><br/>
|
||
<u>Magazyn:</u> <b>@detailLineItem?.Whse</b><br/>
|
||
<u>Typ
|
||
Documentu:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DocumentType</b><br/>
|
||
</div>
|
||
<div class="col">
|
||
<u>Kod VAT:</u> <b>@detailLineItem?.TaxCode1</b><br/>
|
||
<u>J/M:</u> <b>@detailLineItem?.UM</b><br/>
|
||
<u>Numer Klienta:</u> <b>@detailLineItem?.CoCustNum</b><br/>
|
||
<u>Opis:</u> <b>@detailLineItem?.Description</b><br/>
|
||
<u>Status:</u> <b>@detailLineItem?.TranslatedStatus</b><br/>
|
||
<u>RoutingCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_RoutingCode</b><br/>
|
||
<u>DeliveryCallNumber:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_DeliveryCallNum</b><br/>
|
||
<u>UnloadingPoint:</u> <b>@detailLineItem?.Uf_LOC_11_UnloadingPoint</b><br/>
|
||
<u>DestinationPoint:</u> <b>@detailLineItem?.Uf_LOC_159_DestinationPoint</b><br/>
|
||
<u>PalletCode:</u> <b>@detailLineItem?.Uf_FKR_EDI_ITEM_PalletCode</b><br/>
|
||
</div>
|
||
</div>
|
||
</CardContent>
|
||
</SfCard>
|
||
}
|
||
</DetailTemplate>
|
||
</GridTemplates>
|
||
<Syncfusion.Blazor.Grids.GridColumns>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoLine) HeaderText="Linia"
|
||
Width="70"/>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CoRelease)
|
||
HeaderText="Zwolnienie" Width="70"/>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.Item) HeaderText="Pozycja"
|
||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.CustItem)
|
||
HeaderText="Pozycja"
|
||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.QtyOrdered)
|
||
HeaderText="Łączna Ilość" TextAlign="TextAlign.Right"
|
||
Width="120"></Syncfusion.Blazor.Grids.GridColumn>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.DueDate)
|
||
HeaderText="Data Wykonania" Width="100"/>
|
||
<Syncfusion.Blazor.Grids.GridColumn Field=@nameof(CustomerOrderLineItemDto.TranslatedStatus)
|
||
HeaderText="Status"
|
||
Width="100"></Syncfusion.Blazor.Grids.GridColumn>
|
||
</Syncfusion.Blazor.Grids.GridColumns>
|
||
<GridFilterSettings Type="FilterType.Excel"/>
|
||
<GridPageSettings PageSize="10"/>
|
||
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Single"/>
|
||
</SfGrid>
|
||
}
|
||
</div>
|
||
|
||
@code {
|
||
[Parameter] public Guid CustomerOrderId { get; set; }
|
||
|
||
private CustomerOrderDto CustomerOrderDto { get; set; }
|
||
private List<CustomerOrderLineDto> _customerOrderLines = [];
|
||
private List<CustomerOrderLineItemDto> _customerOrderLineItems = [];
|
||
|
||
private IEnumerable<ScheduleOrderDto>? _scheduleOrders;
|
||
|
||
CustomerOrderLineDto? _selectedCustomerOrderLine;
|
||
|
||
private SfGrid<CustomerOrderLineDto>? _customerOrderLinesGrid;
|
||
private SfGrid<CustomerOrderLineItemDto>? _customerOrderLineItemsGrid;
|
||
|
||
private bool _isVisibleCustomerOrderLine;
|
||
|
||
private SfGrid<ScheduleOrderDto> _gridRef = new();
|
||
|
||
private bool _isVisible = true;
|
||
private string _text = "Pokaż powiązane zamówienia DELFOR";
|
||
|
||
protected override async Task OnInitializedAsync()
|
||
{
|
||
CustomerOrderDto? customerOrder = await CustomerOrderService.GetCustomerOrderAsync(CustomerOrderId);
|
||
|
||
if (customerOrder != null)
|
||
{
|
||
CustomerOrderDto = customerOrder;
|
||
_customerOrderLines = CustomerOrderDto.CustomerOrderLines.ToList() ?? [];
|
||
}
|
||
}
|
||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||
{
|
||
if (firstRender)
|
||
{
|
||
await SetGridRef(_gridRef);
|
||
StateHasChanged();
|
||
_isVisible = false;
|
||
}
|
||
}
|
||
|
||
private async Task ShowLastDelfors()
|
||
{
|
||
if (_isVisible)
|
||
{
|
||
_isVisible = false;
|
||
_text = "Pokaż powiązane zamówienia DELFOR";
|
||
_scheduleOrders = [];
|
||
}
|
||
else
|
||
{
|
||
_scheduleOrders = await FetchScheduleOrdersAsync();
|
||
await _gridRef.Refresh();
|
||
StateHasChanged();
|
||
_isVisible = true;
|
||
_text = "Ukryj";
|
||
}
|
||
}
|
||
|
||
private async Task SetGridRef(SfGrid<ScheduleOrderDto> grid)
|
||
{
|
||
_gridRef = grid;
|
||
}
|
||
|
||
private async Task<IEnumerable<ScheduleOrderDto>> FetchScheduleOrdersAsync()
|
||
{
|
||
_scheduleOrders = [];
|
||
IList<int> scheduleOrderDetails = CustomerOrderDto?.EdiCustomerOrderTranslates?.Select(x => x.ScheduleOrderId).Distinct().ToList() ?? [];
|
||
|
||
if (scheduleOrderDetails.Any())
|
||
{
|
||
_scheduleOrders = await ScheduleOrderService.GetScheduleOrdersAsync() ?? new List<ScheduleOrderDto>();
|
||
_scheduleOrders = _scheduleOrders.Where(x => scheduleOrderDetails.Contains(x.ID)).OrderByDescending(x => x.LastUpdateDate).ToList();
|
||
}
|
||
|
||
return _scheduleOrders;
|
||
}
|
||
|
||
private void OnSelectedLineRow<TValue>(RowSelectEventArgs<TValue> obj)
|
||
{
|
||
_selectedCustomerOrderLine = obj.Data as CustomerOrderLineDto;
|
||
_isVisibleCustomerOrderLine = _selectedCustomerOrderLine != null;
|
||
_customerOrderLineItems = _selectedCustomerOrderLine?.CustomerOrderLineItems.ToList() ?? [];
|
||
}
|
||
|
||
} |