From 89a84223ba3fb23a0dbbea06af27614b07f0a42a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 29 Apr 2024 13:58:07 +0200 Subject: [PATCH] Update UI x conversione DTO --- MagMan.Data.Tenant/Services/TenantService.cs | 6 +++--- MagMan.UI/Controllers/LogMachineController.cs | 14 ++++++++++---- MagMan.UI/MagMan.UI.csproj | 2 +- Resources/ChangeLog.html | 2 +- Resources/VersNum.txt | 2 +- Resources/manifest.xml | 2 +- 6 files changed, 17 insertions(+), 11 deletions(-) diff --git a/MagMan.Data.Tenant/Services/TenantService.cs b/MagMan.Data.Tenant/Services/TenantService.cs index bc92431..1b8bd10 100644 --- a/MagMan.Data.Tenant/Services/TenantService.cs +++ b/MagMan.Data.Tenant/Services/TenantService.cs @@ -501,15 +501,15 @@ namespace MagMan.Data.Tenant.Services /// /// DTO di partenza /// - public LogMachineModel LogMacFromDto(LogMachineDTO origItem) + public LogMachineModel LogMacFromDto(LogMachineDTO origItem, int machineCloudId, int keyNum) { LogMachineModel answ = new LogMachineModel() { ProjDbId = origItem.ProjCloudId, DtEvent = origItem.DtEvent, EvType = origItem.EvType, - MachineID = origItem.MachineCloudId, - KeyNum = origItem.KeyNum, + MachineID = machineCloudId, + KeyNum = keyNum, VarAddress = origItem.SupervId, VarValue = origItem.VarValue }; diff --git a/MagMan.UI/Controllers/LogMachineController.cs b/MagMan.UI/Controllers/LogMachineController.cs index 38cf552..13bce24 100644 --- a/MagMan.UI/Controllers/LogMachineController.cs +++ b/MagMan.UI/Controllers/LogMachineController.cs @@ -71,8 +71,8 @@ namespace MagMan.UI.Controllers { // in primis recupero codice chiave da token... int nKey = await MTAdmService.MainKeyByToken(id); - var rawList = await TService.LogMacGetLast(nKey, machineId,numRec); - if(rawList!=null) + var rawList = await TService.LogMacGetLast(nKey, machineId, numRec); + if (rawList != null) { ListRecords.AddRange(rawList); } @@ -95,10 +95,16 @@ namespace MagMan.UI.Controllers { // in primis recupero codice chiave da token... int nKey = await MTAdmService.MainKeyByToken(id); + int machId = 0; + var machList = await MTAdmService.MachineGetByToken(id); + if (machList != null && machList.Count > 0) + { + machId = machList.FirstOrDefault()!.MachineID; + } if (nKey > 0) { // converto elenco da Dto --> DB - var listRec = rawData.LogList.Select(x=> TService.LogMacFromDto(x)).ToList(); + var listRec = rawData.LogList.Select(x => TService.LogMacFromDto(x, machId, nKey)).ToList(); try { // upsert! @@ -109,7 +115,7 @@ namespace MagMan.UI.Controllers Log.Error($"LogMachineController.upsert | Errore in fase salvataggio di {rawData.LogList.Count} LogMacDTO{Environment.NewLine}{exc}"); } // resetto cache redis - await MTAdmService.FlushRedisCache(); + await MTAdmService.FlushRedisCache(); } } return answ; diff --git a/MagMan.UI/MagMan.UI.csproj b/MagMan.UI/MagMan.UI.csproj index d7a0001..b47c562 100644 --- a/MagMan.UI/MagMan.UI.csproj +++ b/MagMan.UI/MagMan.UI.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.2404.2711 + 1.0.2404.2913 enable enable true diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 309c328..3649c1e 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ MagMan - Wood Warehouse Management System -

Versione: 1.0.2404.2711

+

Versione: 1.0.2404.2913


Note di rilascio: