* 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

@@ -63,20 +63,34 @@ public class WarehouseService(IHttpClientFactory httpClientFactory)
}
}
public async Task CreateWzRowsMeyleAsync(IEnumerable<WzRowMeyleDto> wzRowMeyles)
public async Task CreateWzRowsMeyleAsync(IEnumerable<WzRowMeyleDto> wzRowsMeyle)
{
if (wzRowMeyles == null || !wzRowMeyles.Any())
if (wzRowsMeyle == null || !wzRowsMeyle.Any())
{
throw new ArgumentException("No rows provided to create.");
}
var response = await _httpClient.PostAsJsonAsync("api/WzRowMeyle", wzRowMeyles);
var response = await _httpClient.PostAsJsonAsync("api/WzRowMeyle", wzRowsMeyle);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new HttpRequestException($"Failed to create WzRowMeyle: {response.StatusCode}, Content: {errorContent}");
}
}
public async Task CreateWzRowsMarelliAsync(IEnumerable<WzRowMarelliDto> wzRowsMarelli)
{
if (wzRowsMarelli == null || !wzRowsMarelli.Any())
{
throw new ArgumentException("No rows provided to create.");
}
var response = await _httpClient.PostAsJsonAsync("api/WzRowMarelli", wzRowsMarelli);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new HttpRequestException($"Failed to create WzRowMarelli: {response.StatusCode}, Content: {errorContent}");
}
}
public async Task<CustomerOrderDto> GetCustomerOrder(string customerOrderNumber)
@@ -95,12 +109,19 @@ public class WarehouseService(IHttpClientFactory httpClientFactory)
return await response.Content.ReadFromJsonAsync<ItemCustDto>();
}
public async Task<IEnumerable<WzRowMeyleDto>> GetWzRowsByWzHeaderId(Guid wzHeaderId)
public async Task<IEnumerable<WzRowMeyleDto>> GetWzRowsMeyleByWzHeaderId(Guid wzHeaderId)
{
var response = await _httpClient.GetAsync($"api/WzRowMeyle/by-wz-header-id?wzHeaderId={wzHeaderId}");
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<IEnumerable<WzRowMeyleDto>>();
}
public async Task<IEnumerable<WzRowMarelliDto>> GetWzRowsMarelliByWzHeaderId(Guid wzHeaderId)
{
var response = await _httpClient.GetAsync($"api/WzRowMarelli/by-wz-header-id?wzHeaderId={wzHeaderId}");
response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<IEnumerable<WzRowMarelliDto>>();
}
public async Task<IDictionary<string, List<TransactionModel>>> GetTransactionsModels()
{
@@ -124,6 +145,17 @@ public class WarehouseService(IHttpClientFactory httpClientFactory)
response.EnsureSuccessStatusCode();
}
public async Task UpdateWzRowsMarelliAsync(IEnumerable<WzRowMarelliDto?> wzRowsMarelli)
{
if (wzRowsMarelli == null || !wzRowsMarelli.Any())
{
throw new ArgumentException("No rows provided to update.");
}
var response = await _httpClient.PutAsJsonAsync("api/WzRowMarelli", wzRowsMarelli);
response.EnsureSuccessStatusCode();
}
public async Task GenerateXlsForMeyleAsync(Guid wzHeaderId)
{
var response = await _httpClient.GetAsync($"api/ExcelGenerator/generate-meyle?packListId={wzHeaderId}");