Esportazione immagini anche con ispezione completata

This commit is contained in:
2026-03-03 12:50:17 +01:00
parent e1e0c91db5
commit 3760e38c8d
2 changed files with 82 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
@using SteUp.Shared.Core.Enum
@using SteUp.Shared.Core.Interface.IntegryApi
@using SteUp.Shared.Core.Interface.LocalDb
@using SteUp.Shared.Core.Interface.System
@using SteUp.Shared.Core.Messages.Ispezione
@using SteUp.Shared.Core.Messages.Scheda
@inject NewSchedaService NewScheda
@@ -14,6 +15,7 @@
@inject IIspezioniService IspezioniService
@inject IDialogService Dialog
@inject IIntegrySteupService IntegrySteupService
@inject IAttachedService AttachedService
@implements IDisposable
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
@@ -64,9 +66,7 @@
{
<SchedaCard Scheda="scheda" OnSchedaDeleted="OnSchedaDeleted"
OnSchedaModified="OnSchedaModified"
Stato="@SteupDataService.InspectionPageState.Ispezione.Stato"
CodMdep="@SteupDataService.InspectionPageState.Ispezione.CodMdep"
Data="@SteupDataService.InspectionPageState.Ispezione.Data"/>
Ispezione="@SteupDataService.InspectionPageState.Ispezione"/>
}
</ChildContent>
</MudExpansionPanel>
@@ -118,6 +118,49 @@
var ispezione = SteupDataService.InspectionPageState.Ispezione;
foreach (var scheda in ispezione.Schede.Where(x => x.ActivityId == null))
{
var apiResponse = await IntegrySteupService.SaveScheda(
new SaveRequestDto
{
LocalIdScheda = scheda.Id,
ActivityTypeId = scheda.ActivityTypeId,
CodJfas = scheda.CodJfas,
CodMdep = ispezione.CodMdep,
DataCreazione = ispezione.Data,
Note = scheda.Note,
PersonaRif = scheda.Responsabile,
Barcodes = scheda.Articoli.ConvertAll(x => x.Barcode),
Scandeza = (ScadenzaEnum)scheda.Scadenza,
ParentActivityId = scheda.Ispezione?.ActivityId
}
);
if (apiResponse == null) continue;
scheda.ActivityId = apiResponse.ActivityIdScheda;
await IspezioniService.UpdateSchedaAsync(scheda);
await IspezioniService.UpdateActivityIdIspezioneAsync(
ispezione.CodMdep,
ispezione.Data,
ispezione.Rilevatore,
apiResponse.ActivityIdIspezione
);
if (scheda.ImageNames == null) continue;
var fileList = (await AttachedService.GetInspectionFiles(ispezione, scheda.ImageNames))?
.Where(x => x.ToUpload).ToList();
if (fileList == null) continue;
foreach (var file in fileList)
{
await IntegrySteupService.UploadFile(scheda.ActivityId!, file.FileBytes!, file.Name!);
}
}
SteupDataService.InspectionPageState.Ispezione.Stato = StatusEnum.Completata;
await IntegrySteupService.CompleteInspection(ispezione.ActivityId!);