Esportazione immagini anche con ispezione completata
This commit is contained in:
@@ -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!);
|
||||
|
||||
Reference in New Issue
Block a user