Fix vari
This commit is contained in:
@@ -178,7 +178,9 @@
|
||||
PersonaRif = scheda.Responsabile,
|
||||
Barcodes = scheda.Articoli.ConvertAll(x => x.Barcode),
|
||||
Scandeza = (ScadenzaEnum)scheda.Scadenza,
|
||||
ParentActivityId = scheda.Ispezione?.ActivityId
|
||||
// Aggancia all'ispezione esistente: dopo la prima scheda l'id e' noto,
|
||||
// così le successive non creano nuove ispezioni.
|
||||
ParentActivityId = ispezione.ActivityId
|
||||
}
|
||||
);
|
||||
|
||||
@@ -198,6 +200,8 @@
|
||||
ispezione.Rilevatore,
|
||||
apiResponse.ActivityIdIspezione
|
||||
);
|
||||
// Aggiorna l'id in memoria per l'iterazione successiva.
|
||||
ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||
|
||||
if (scheda.ImageNames == null) continue;
|
||||
|
||||
@@ -350,35 +354,41 @@
|
||||
PersonaRif = x.Responsabile,
|
||||
Barcodes = x.Articoli.ConvertAll(y => y.Barcode),
|
||||
Scandeza = (ScadenzaEnum)x.Scadenza,
|
||||
ParentActivityId = x.Ispezione?.ActivityId
|
||||
// Aggancia all'ispezione esistente sul server (evita di crearne una nuova a ogni export).
|
||||
ParentActivityId = ispezione.ActivityId
|
||||
};
|
||||
});
|
||||
|
||||
var apiResponse = await IntegrySteupService.SaveMultipleSchede(saveRequest);
|
||||
|
||||
if (apiResponse != null)
|
||||
if (apiResponse == null)
|
||||
{
|
||||
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||
Snackbar.Add("Esportazione non riuscita. Le schede restano sul dispositivo, riprova.", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
await IspezioniService.UpdateActivityIdIspezioneAsync(ispezione.CodMdep, ispezione.Data,
|
||||
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
||||
);
|
||||
SteupDataService.InspectionPageState.Ispezione.ActivityId = apiResponse.ActivityIdIspezione;
|
||||
|
||||
if (!apiResponse.ActivityIdSchedaList.IsNullOrEmpty())
|
||||
await IspezioniService.UpdateActivityIdIspezioneAsync(ispezione.CodMdep, ispezione.Data,
|
||||
UserSession.User.Username, apiResponse.ActivityIdIspezione
|
||||
);
|
||||
|
||||
if (!apiResponse.ActivityIdSchedaList.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var scheda in SchedeGrouped[jtbFasi])
|
||||
{
|
||||
foreach (var scheda in SchedeGrouped[jtbFasi])
|
||||
{
|
||||
var activityId = apiResponse.ActivityIdSchedaList!.Find(x =>
|
||||
x.LocalId != null && x.LocalId == scheda.Id
|
||||
)?.ActivityId;
|
||||
var activityId = apiResponse.ActivityIdSchedaList!.Find(x =>
|
||||
x.LocalId != null && x.LocalId == scheda.Id
|
||||
)?.ActivityId;
|
||||
|
||||
if (activityId == null) continue;
|
||||
if (activityId == null) continue;
|
||||
|
||||
scheda.ActivityId = activityId;
|
||||
await IspezioniService.UpdateActivityIdSchedaAsync(scheda.Id, scheda.ActivityId);
|
||||
}
|
||||
scheda.ActivityId = activityId;
|
||||
await IspezioniService.UpdateActivityIdSchedaAsync(scheda.Id, scheda.ActivityId);
|
||||
}
|
||||
}
|
||||
|
||||
Snackbar.Add("Reparto esportato", Severity.Success);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user