* Further improvements for Marelli PackingList

This commit is contained in:
2025-09-11 21:08:31 +02:00
parent 50a25ff996
commit 01350f0146
10 changed files with 420 additions and 39 deletions

View File

@@ -133,7 +133,7 @@
if (firstRender)
{
_clients = await WarehouseService.GetAllClientsAsync();
_clients = _clients.Where(x => x.Name.Equals("MEYLE", StringComparison.OrdinalIgnoreCase));
_clients = _clients.Where(x => new[] { "MAGNETI MARELLI", "MEYLE" }.Any(y => y.Equals(x.Name, StringComparison.OrdinalIgnoreCase))).ToList();
StateHasChanged();
@@ -179,7 +179,7 @@
Guid headerId = obj.RowData.ID;
NavigationManager.NavigateTo($"/Warehouse/{_selectedClient.Name}/PackList/" + headerId);
NavigationManager.NavigateTo($"/Warehouse/{_selectedClient.ShortName}/PackList/" + headerId);
}
private async Task CreatePackingList()
@@ -210,18 +210,18 @@
await WarehouseService.CreateWzHeaderAsync(wzHeader);
switch (_selectedClient?.Name.ToUpper())
switch (_selectedClient?.ShortName.ToUpper())
{
case "MEYLE":
IList<WzRowMeyleDto> rows = new List<WzRowMeyleDto>();
IList<MaterialTransactionDto> materialTransactions = _materialTransactions.Where(x => selectedRecords.Any(y => y.MTGroupNum == x.MTGroupNum)).ToList();
IList<WzRowMeyleDto> meyleRows = new List<WzRowMeyleDto>();
IList<MaterialTransactionDto> meyleMaterialTransactions = _materialTransactions.Where(x => selectedRecords.Any(y => y.MTGroupNum == x.MTGroupNum)).ToList();
foreach (MaterialTransactionDto materialTransactionDto in materialTransactions)
foreach (MaterialTransactionDto materialTransactionDto in meyleMaterialTransactions)
{
CustomerOrderDto customerOrder = await WarehouseService.GetCustomerOrder(materialTransactionDto.RefNum ?? string.Empty);
ItemCustDto item = await WarehouseService.GetItem(materialTransactionDto.Item ?? string.Empty, customerOrder.CustNum);
rows.Add(new WzRowMeyleDto
meyleRows.Add(new WzRowMeyleDto
{
ID = Guid.NewGuid(),
Quantity = Math.Abs((int?)materialTransactionDto.Qty ?? 0),
@@ -235,10 +235,39 @@
});
}
await WarehouseService.CreateWzRowsMeyleAsync(rows);
await WarehouseService.CreateWzRowsMeyleAsync(meyleRows);
NavigationManager.NavigateTo("/Warehouse/Meyle/PackList/" + wzHeader.ID);
break;
case "MARELLI":
IList<WzRowMarelliDto> marelliRows = new List<WzRowMarelliDto>();
IList<MaterialTransactionDto> marelliMaterialTransactions = _materialTransactions.Where(x => selectedRecords.Any(y => y.MTGroupNum == x.MTGroupNum)).ToList();
foreach (MaterialTransactionDto materialTransactionDto in marelliMaterialTransactions)
{
CustomerOrderDto customerOrder = await WarehouseService.GetCustomerOrder(materialTransactionDto.RefNum ?? string.Empty);
ItemCustDto item = await WarehouseService.GetItem(materialTransactionDto.Item ?? string.Empty, customerOrder.CustNum);
marelliRows.Add(new WzRowMarelliDto
{
ID = Guid.NewGuid(),
Quantity = Math.Abs((int?)materialTransactionDto.Qty ?? 0),
ItemNumber = item.CustItem,
OrderNumber = customerOrder.CustPo,
WzNumber = materialTransactionDto.MTGroupNum ?? string.Empty,
FKHeader = wzHeader.ID,
TransactionNumber = (int?)materialTransactionDto.TransNum ?? 0,
Type = "MIX",
FaIndex = item.Item,
EngineerNumber = item.Uf_FKR_CustItem2
});
}
await WarehouseService.CreateWzRowsMarelliAsync(marelliRows);
NavigationManager.NavigateTo("/Warehouse/Marelli/PackList/" + wzHeader.ID);
break;
}
}