diff --git a/MP.IOC/Controllers/RecipeArchiveController.cs b/MP.IOC/Controllers/RecipeArchiveController.cs index 405040f9..9e4059b1 100644 --- a/MP.IOC/Controllers/RecipeArchiveController.cs +++ b/MP.IOC/Controllers/RecipeArchiveController.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc; using MP.IOC.Data; using NLog; +using NLog.Fluent; namespace MP.IOC.Controllers { @@ -26,7 +27,7 @@ namespace MP.IOC.Controllers [HttpGet("GetByPODL")] public async Task GetByPODL(string idxMacc, int idxPODL) { - string answ = ""; + string answ = "NO DATA"; string archPath = await DService.MacchineRecipeArchive(idxMacc); var podlData = await DService.POdlGetByKey(idxPODL); if (podlData != null) @@ -35,8 +36,34 @@ namespace MP.IOC.Controllers string fullPath = Path.Combine(archPath, fileName); if (!string.IsNullOrEmpty(fullPath)) { - answ = System.IO.File.ReadAllText(fullPath); + try + { + if (System.IO.File.Exists(fullPath)) + { + answ = System.IO.File.ReadAllText(fullPath); + if (string.IsNullOrEmpty(answ)) + { + Log.Error($"Errore in GetByPODL: contenuto file vuoto | idxMacc: {idxMacc} | idxPODL: {idxPODL}"); + } + } + else + { + Log.Error($"Errore in GetByPODL: il file non esiste | fullPath {fullPath}"); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in GetByPODL:{Environment.NewLine}{exc}"); + } } + else + { + Log.Error($"Errore in GetByPODL: fullPath null "); + } + } + else + { + Log.Error($"Errore in GetByPODL: podlData null | idxPODL: {idxPODL}"); } return answ; } @@ -44,15 +71,41 @@ namespace MP.IOC.Controllers [HttpGet("GetFile")] public async Task GetFile(string idxMacc, string fileName) { - string answ = ""; + string answ = "NO DATA"; string archPath = await DService.MacchineRecipeArchive(idxMacc); if (!string.IsNullOrEmpty(archPath)) { string fullPath = Path.Combine(archPath, fileName); if (!string.IsNullOrEmpty(fullPath)) { - answ = System.IO.File.ReadAllText(fullPath); + try + { + if (System.IO.File.Exists(fullPath)) + { + answ = System.IO.File.ReadAllText(fullPath); + if (string.IsNullOrEmpty(answ)) + { + Log.Error($"Errore in GetFile: contenuto file vuoto | idxMacc: {idxMacc} | fileName: {fileName}"); + } + } + else + { + Log.Error($"Errore in GetFile: il file non esiste | fullPath {fullPath}"); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione in GetFile:{Environment.NewLine}{exc}"); + } } + else + { + Log.Error($"Errore in GetFile: fullPath null "); + } + } + else + { + Log.Error($"Errore in GetFile: archPath null "); } return answ; } diff --git a/MP.IOC/NLog.config b/MP.IOC/NLog.config new file mode 100644 index 00000000..3e4185f4 --- /dev/null +++ b/MP.IOC/NLog.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 05e7e91a..bf127384 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

Versione: 6.16.2304.419

+

Versione: 6.16.2304.509


Note di rilascio: