Consolidate mapping and finance configuration

This commit is contained in:
2026-05-07 15:20:54 +02:00
parent dea171862c
commit dc3fd77c86
24 changed files with 988 additions and 537 deletions
@@ -69,21 +69,16 @@ public class ExportOrchestrationService
{
using var db = await _dbFactory.CreateDbContextAsync();
var sites = await db.Sites.Include(s => s.HanaServer).Where(s => s.IsActive).ToListAsync();
var consolidatedRecords = new List<SalesRecord>();
foreach (var site in sites)
{
var result = await ExportSiteAsync(site);
if (result?.Records is { Count: > 0 })
consolidatedRecords.AddRange(result.Records);
}
await ExportSiteAsync(site);
await RunConsolidatedExportAsync(consolidatedRecords);
await RunConsolidatedExportAsync();
}
public async Task<string?> ExportConsolidatedOnlyAsync()
{
return await RunConsolidatedExportAsync(null);
return await RunConsolidatedExportAsync();
}
public async Task<SiteExportResult?> ExportSiteByIdAsync(int siteId)
@@ -139,7 +134,7 @@ public class ExportOrchestrationService
OnExportStatusChanged?.Invoke();
}
private async Task<string?> RunConsolidatedExportAsync(List<SalesRecord>? records)
private async Task<string?> RunConsolidatedExportAsync()
{
lock (_lock)
{
@@ -153,7 +148,7 @@ public class ExportOrchestrationService
try
{
return await _consolidatedExportService.ExportAsync(records ?? []);
return await _consolidatedExportService.ExportAsync();
}
catch (Exception ex)
{