From 41ef6bc4ae0963410715896d801f7a9caacab65a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 1 Jul 2025 11:14:52 +0200 Subject: [PATCH] Update x gestione dati extra da RRL x IOB --- MP.Core/DTO/IobDTO.cs | 83 ------------ MP.Data/Controllers/MpLandController.cs | 34 +++++ MP.Data/DTO/IobDTO.cs | 160 ++++++++++++++++++++++++ MP.Data/DbModels/MacchineModel.cs | 4 + MP.Data/Services/BaseServ.cs | 144 ++++++++++++++++++++- MP.Data/Services/LandDataService.cs | 55 ++++++++ MP.Data/Services/TabDataService.cs | 41 +++--- MP.Land/MP.Land.csproj | 2 +- MP.Land/Pages/IobList.razor | 60 +++++---- MP.Land/Pages/IobList.razor.cs | 86 +++++++++++-- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- 13 files changed, 533 insertions(+), 142 deletions(-) delete mode 100644 MP.Core/DTO/IobDTO.cs create mode 100644 MP.Data/DTO/IobDTO.cs diff --git a/MP.Core/DTO/IobDTO.cs b/MP.Core/DTO/IobDTO.cs deleted file mode 100644 index df3f6e10..00000000 --- a/MP.Core/DTO/IobDTO.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MP.Core.DTO -{ - public class IobDTO - { - - [Key] - /// - /// Idx macchina - /// - public string IdxMacchina { get; set; } = ""; - - /// - /// Cod macchina - /// - public string CodMacchina { get; set; } = ""; - /// - /// Nome macchina - /// - public string Nome { get; set; } = ""; - /// - /// Descrizione macchina - /// - public string Descrizione { get; set; } = ""; - /// - /// Descrizione macchina - /// - public string Note { get; set; } = ""; - - /// - /// Tipo di IOB (Win / rPi / Python) - /// - public string OS { get; set; } = ""; - - /// - /// Nome PC Iob - /// - public string IobName { get; set; } = ""; - - /// - /// IP v4 PC Iob - /// - public string IobIpv4 { get; set; } = ""; - - /// - /// Mac address IOB - /// - public string IobMac { get; set; } = ""; - - /// - /// Nome Adapter - /// - public string AdaptName { get; set; } = ""; - - /// - /// Sottotipo Adapter - /// - public string AdapType { get; set; } = ""; - - /// - /// Versione Adapter - /// - public string AdapVers { get; set; } = ""; - - /// - /// IP del target CNC/PLC - /// - public string TargetIp { get; set; } = ""; - - /// - /// Porta del target CNC/PLC - /// - public string TargetPort { get; set; } = ""; - - } -} diff --git a/MP.Data/Controllers/MpLandController.cs b/MP.Data/Controllers/MpLandController.cs index 270579e0..dab9748b 100644 --- a/MP.Data/Controllers/MpLandController.cs +++ b/MP.Data/Controllers/MpLandController.cs @@ -73,6 +73,22 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco Record Macchine + /// + /// + public List MacchineGetAll() + { + List dbResult = new List(); + using (MoonProContext localDbCtx = new MoonProContext(_configuration)) + { + dbResult = localDbCtx + .DbSetMacchine + .ToList(); + } + return dbResult; + } + /// /// Recupera tutti i record di RemoteRebootLog /// @@ -109,6 +125,24 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Recupera ultimo record x ogni IdxMacchina x avere ultimo attivo per impianti EXTRA (=no record Macchine) + /// + /// + public List RemRebootLogGetLastNoMacc() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetRemRebLog + .FromSqlRaw("EXEC stp_RRL_GetLastNoMachine") + .AsNoTracking() + .ToList(); + } + return dbResult; + } + /// /// Annulla modifiche su una specifica entity (cancel update) /// diff --git a/MP.Data/DTO/IobDTO.cs b/MP.Data/DTO/IobDTO.cs new file mode 100644 index 00000000..90bfc883 --- /dev/null +++ b/MP.Data/DTO/IobDTO.cs @@ -0,0 +1,160 @@ +using MP.Core.Objects; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.Data.DTO +{ + public class IobDTO + { + #region Public Constructors + + /// + /// Costruttore da dati completi x Macchine + /// + /// + /// + /// + public IobDTO(DbModels.MacchineModel recMacc, IOB_data iobInfo, Dictionary macInfo) + { + this.IdxMacchina = recMacc.IdxMacchina; + this.CodMacchina = recMacc.CodMacchina; + this.Nome = recMacc.Nome; + this.Descrizione = recMacc.Descrizione; + this.Note = recMacc.Note ?? ""; + this.Locazione = recMacc.locazione ?? ""; + this.OS = $"{iobInfo.iType}"; + this.IobName = iobInfo.name; + this.IobIpv4 = iobInfo.IP; + this.IobMac = ""; + if (macInfo != null && macInfo.Count > 0) + { + this.AdapName = macInfo.ContainsKey("IobExe") ? macInfo["IobExe"] : ""; + this.AdapType = macInfo.ContainsKey("IobType") ? macInfo["IobType"] : ""; + this.AdapVers = macInfo.ContainsKey("IobVersion") ? macInfo["IobVersion"] : ""; + this.TargetIp = macInfo.ContainsKey("MachIp") ? macInfo["MachIp"] : ""; + this.TargetPort = macInfo.ContainsKey("MachPort") ? macInfo["MachPort"] : ""; + } + this.IsMachine = true; + } + + /// + /// Costruttore empty di default + /// + public IobDTO() + { } + + /// + /// Costruttore da dati RemoteRebootLog e info incomplete + /// + /// + /// + /// + public IobDTO(DbModels.RemoteRebootLogModel recRRL, IOB_data iobInfo, Dictionary macInfo) + { + this.IdxMacchina = recRRL.IdxMacchina; + this.Locazione = "NA"; + this.OS = $"{iobInfo.iType}"; + this.IobName = iobInfo.name; + this.IobIpv4 = iobInfo.IP; + this.IobMac = recRRL.MacAddr; + if (macInfo != null && macInfo.Count > 0) + { + this.AdapName = macInfo.ContainsKey("IobExe") ? macInfo["IobExe"] : ""; + this.AdapType = macInfo.ContainsKey("IobType") ? macInfo["IobType"] : ""; + this.AdapVers = macInfo.ContainsKey("IobVersion") ? macInfo["IobVersion"] : ""; + this.TargetIp = macInfo.ContainsKey("MachIp") ? macInfo["MachIp"] : ""; + this.TargetPort = macInfo.ContainsKey("MachPort") ? macInfo["MachPort"] : ""; + } + this.IsMachine = false; + } + + #endregion Public Constructors + + #region Public Properties + + /// + /// Nome Adapter + /// + public string AdapName { get; set; } = ""; + + /// + /// Sottotipo Adapter + /// + public string AdapType { get; set; } = ""; + + /// + /// Versione Adapter + /// + public string AdapVers { get; set; } = ""; + + /// + /// Cod macchina + /// + public string CodMacchina { get; set; } = ""; + + /// + /// Descrizione macchina + /// + public string Descrizione { get; set; } = ""; + + [Key] + public string IdxMacchina { get; set; } = ""; + + /// + /// IP v4 PC Iob + /// + public string IobIpv4 { get; set; } = ""; + + /// + /// Mac address IOB + /// + public string IobMac { get; set; } = ""; + + /// + /// Nome PC Iob + /// + public string IobName { get; set; } = ""; + + /// + /// Indica se sia una macchina effettiva vs Extra da RemoteRebootLog (es PING, ENR, ...) + /// + public bool IsMachine { get; set; } = true; + + /// + /// Locazione (usata per nascondere in SITE/Tab) + /// + public string Locazione { get; set; } = ""; + + /// + /// Nome macchina + /// + public string Nome { get; set; } = ""; + + /// + /// Descrizione macchina + /// + public string Note { get; set; } = ""; + + /// + /// Tipo di IOB (Win / rPi / Python) + /// + public string OS { get; set; } = ""; + + /// + /// IP del target CNC/PLC + /// + public string TargetIp { get; set; } = ""; + + /// + /// Porta del target CNC/PLC + /// + public string TargetPort { get; set; } = ""; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/DbModels/MacchineModel.cs b/MP.Data/DbModels/MacchineModel.cs index 1cf87207..c5ffd8e0 100644 --- a/MP.Data/DbModels/MacchineModel.cs +++ b/MP.Data/DbModels/MacchineModel.cs @@ -30,6 +30,10 @@ namespace MP.Data.DbModels /// public string Descrizione { get; set; } = ""; /// + /// Note macchina + /// + public string Note { get; set; } = ""; + /// /// Patch del file json di configurazione di una ricetta /// public string RecipePath { get; set; } = ""; diff --git a/MP.Data/Services/BaseServ.cs b/MP.Data/Services/BaseServ.cs index 077a3b36..88efeb72 100644 --- a/MP.Data/Services/BaseServ.cs +++ b/MP.Data/Services/BaseServ.cs @@ -1,7 +1,12 @@ using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; +using MP.Core.Objects; +using Newtonsoft.Json; +using NLog; using StackExchange.Redis; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -22,13 +27,130 @@ namespace MP.Data.Services // setup compoenti REDIS redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); redisDb = redisConn.GetDatabase(); + + // json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/ + JSSettings = new JsonSerializerSettings() + { + ReferenceLoopHandling = ReferenceLoopHandling.Ignore + }; + + // recupero conf speciali + MpIoNS = _configuration.GetValue("ServerConf:MpIoNS"); } #endregion Public Constructors + #region Public Methods + + /// + /// Recupero info IOB x TAB (da info registrate IOB-WIN--> MP-IO) + /// + /// + /// + public IOB_data IobInfo(string IdxMacchina) + { + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + IOB_data? result = new IOB_data(); + // cerco in redis... + string currKey = RedHashMpIO($"hM2IOB:{IdxMacchina}"); + RedisValue rawData = redisDb.StringGet(currKey); + //if (!string.IsNullOrEmpty($"{rawData}")) + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject($"{rawData}"); + source = "REDIS"; + } + else + { + Log.Error($"Errore: non trovato valore valido in REDIS | key: {currKey}"); + Log.Info($"REDIS | conf: {redisConn.Configuration}"); + Log.Info($" --> Valore trovato:{Environment.NewLine}{rawData}"); + } + if (result == null) + { + result = new IOB_data(); + Log.Debug($"Init valore default | IdxMacchina: {IdxMacchina}"); + } + sw.Stop(); + Log.Debug($"IobInfo per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Recupero info Machine-IOB x TAB (da info registrate IOB-WIN --> MP-IO) + /// + /// + /// + public Dictionary MachIobConf(string IdxMacchina) + { + string source = "NA"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + Dictionary result = new Dictionary(); + // cerco in redis... + string currKey = RedHashMpIO($"IOB:{IdxMacchina}:MachIobConf"); + try + { + result = redisDb + .HashGetAll(currKey) + .ToDictionary(x => $"{x.Name}", x => $"{x.Value}"); + source = "REDIS"; + } + catch (Exception exc) + { + Log.Error($"Errore in MachIobConf{Environment.NewLine}{exc}"); + } + if (result == null) + { + result = new Dictionary(); + Log.Debug($"Init valore default MachIobConf | IdxMacchina: {IdxMacchina}"); + } + sw.Stop(); + Log.Debug($"MachIobConf per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Recupero Conf Yaml Machine-IOB + /// + /// + /// + public string MachIobYamlConf(string IdxMacchina) + { + string source = "NA"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + string result = ""; + // cerco in redis... + string currKey = RedHashMpIO($"IOB:{IdxMacchina}:ConfYaml"); + try + { + result = redisDb.StringGet(currKey); + source = "REDIS"; + } + catch (Exception exc) + { + Log.Error($"Errore in MachIobYamlConf{Environment.NewLine}{exc}"); + } + if (result == null) + { + result = ""; + Log.Debug($"Init valore default MachIobYamlConf | IdxMacchina: {IdxMacchina}"); + } + sw.Stop(); + Log.Debug($"MachIobYamlConf per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + #endregion Public Methods + #region Protected Fields protected static IConfiguration _configuration = null!; + protected JsonSerializerSettings? JSSettings; + protected string MpIoNS = ""; /// /// Oggetto per connessione a REDIS @@ -79,8 +201,29 @@ namespace MP.Data.Services #endregion Protected Properties + #region Protected Methods + + protected string RedHashMpIO(string keyName) + { + string result = keyName; + try + { + result = $"{MpIoNS}:{keyName}".Replace("\\", "_"); + } + catch (Exception exc) + { + Log.Error($"Errore in RedHashMpIO{Environment.NewLine}{exc}"); + } + + return result; + } + + #endregion Protected Methods + #region Private Fields + private static Logger Log = LogManager.GetCurrentClassLogger(); + /// /// Durata cache lunga IN SECONDI /// @@ -91,7 +234,6 @@ namespace MP.Data.Services /// private int cacheTtlShort = 60 * 1; - //private string redisBaseKey = "MP:BASE:Cache"; private Random rnd = new Random(); #endregion Private Fields diff --git a/MP.Data/Services/LandDataService.cs b/MP.Data/Services/LandDataService.cs index 51d40f4b..0fc7e0dc 100644 --- a/MP.Data/Services/LandDataService.cs +++ b/MP.Data/Services/LandDataService.cs @@ -1,7 +1,9 @@ using Microsoft.Extensions.Configuration; using MP.AppAuth.Controllers; +using MP.Core.DTO; using MP.Data.Controllers; using MP.Data.DbModels; +using MP.Data.DTO; using Newtonsoft.Json; using NLog; using StackExchange.Redis; @@ -45,6 +47,59 @@ namespace MP.Data.Services #region Public Methods + /// + /// Elenco INFO IOB da tab Macchine gestite + RemoteRebootLog + /// + /// + /// + public List IobListAll() + { + string source = "DB"; + List? dbResult = new List(); + string currKey = $"{redisBaseKey}:IobList"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + string? rawData = redisDb.StringGet(currKey); + if (!string.IsNullOrEmpty(rawData) && rawData.Length > 2) + { + source = "REDIS"; + var tempResult = JsonConvert.DeserializeObject>(rawData); + dbResult = tempResult ?? new List(); + } + else + { + // recupero RRL missing + var listRRl = dbController.RemRebootLogGetLast(); + var listRRlAdd = dbController.RemRebootLogGetLastNoMacc(); + // recupero lista macchine + var ListMacch = dbController.MacchineGetAll(); + // ...converto in DTO + dbResult = ListMacch + .Select(x => new IobDTO(x, IobInfo(x.IdxMacchina), MachIobConf(x.IdxMacchina))) + .ToList(); + // completo con RRL i mac address... + + // recupero record RemoteRebootLog mancanti e accodo + var listExtra = listRRlAdd.Select(x => new IobDTO(x, IobInfo(x.IdxMacchina), MachIobConf(x.IdxMacchina))) + .ToList(); + dbResult.AddRange(listExtra); + + //ordino x idxmacchina... + dbResult = dbResult.OrderBy(x => x.IdxMacchina).ToList(); + + // serializzo in cache redis + rawData = JsonConvert.SerializeObject(dbResult, JSSettings); + redisDb.StringSet(currKey, rawData, UltraLongCache); + } + if (dbResult == null) + { + dbResult = new List(); + } + sw.Stop(); + Log.Debug($"IobListAll | {source} | {sw.ElapsedMilliseconds} ms"); + return dbResult; + } + /// /// Recupera tutti i record di RemoteRebootLog /// diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 85cc8ff5..f58fde96 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1,14 +1,11 @@ using EgwCoreLib.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; -using MP.Data.DbModels; using MP.Core.DTO; -using MP.Data.DTO; using MP.Core.Objects; +using MP.Data.DbModels; using Newtonsoft.Json; using NLog; -using Org.BouncyCastle.Asn1.IsisMtt.Ocsp; using StackExchange.Redis; using System; using System.Collections.Generic; @@ -18,10 +15,6 @@ using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; -using MongoDB.Driver.Core.Operations; -using MP.Data.Controllers; -using DnsClient.Protocol; -using MP.AppAuth.Controllers; namespace MP.Data.Services { @@ -60,7 +53,9 @@ namespace MP.Data.Services // sistemo i parametri x redHas... CodModulo = _configuration.GetValue("SpecialConf:CodModulo"); CodModuloParam = _configuration.GetValue("SpecialConf:CodModuloParam"); +#if false MpIoNS = _configuration.GetValue("ServerConf:MpIoNS"); +#endif var cstringArray = ConnStr.Split(";"); foreach (var item in cstringArray) { @@ -1241,6 +1236,7 @@ namespace MP.Data.Services return fatto; } +#if false /// /// Recupero info IOB x TAB (da info registrate IOB-WIN--> MP-IO) /// @@ -1253,7 +1249,7 @@ namespace MP.Data.Services sw.Start(); IOB_data? result = new IOB_data(); // cerco in redis... - string currKey = redHashMpIO($"hM2IOB:{IdxMacchina}"); + string currKey = RedHashMpIO($"hM2IOB:{IdxMacchina}"); RedisValue rawData = redisDb.StringGet(currKey); //if (!string.IsNullOrEmpty($"{rawData}")) if (rawData.HasValue) @@ -1276,6 +1272,7 @@ namespace MP.Data.Services Log.Debug($"IobInfo per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; } +#endif /// /// Recupero info IOB x TAB (da info registrate IOB-WIN--> MP-IO) @@ -1289,7 +1286,7 @@ namespace MP.Data.Services sw.Start(); IOB_data? result = new IOB_data(); // cerco in redis... - string currKey = redHashMpIO($"hM2IOB:{IdxMacchina}"); + string currKey = RedHashMpIO($"hM2IOB:{IdxMacchina}"); RedisValue rawData = await redisDb.StringGetAsync(currKey); //if (!string.IsNullOrEmpty($"{rawData}")) if (rawData.HasValue) @@ -1524,7 +1521,7 @@ namespace MP.Data.Services sw.Start(); List? result = new List(); // cerco in redis... - string currKey = redHashMpIO($"CurrentParameters:{idxMacchina}"); + string currKey = RedHashMpIO($"CurrentParameters:{idxMacchina}"); RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue && rawData.Length() > 2) { @@ -1626,12 +1623,13 @@ namespace MP.Data.Services } // serializzo e salvo string serVal = JsonConvert.SerializeObject(innovations); - string currKey = redHashMpIO($"CurrentParameters:{idxMacchina}"); + string currKey = RedHashMpIO($"CurrentParameters:{idxMacchina}"); RedisValue rawData = redisDb.StringSet(currKey, serVal); } return answ; } +#if false /// /// Recupero info Machine-IOB x TAB (da info registrate IOB-WIN --> MP-IO) /// @@ -1644,7 +1642,7 @@ namespace MP.Data.Services sw.Start(); Dictionary result = new Dictionary(); // cerco in redis... - string currKey = redHashMpIO($"IOB:{IdxMacchina}:MachIobConf"); + string currKey = RedHashMpIO($"IOB:{IdxMacchina}:MachIobConf"); try { result = redisDb @@ -1678,7 +1676,7 @@ namespace MP.Data.Services sw.Start(); string result = ""; // cerco in redis... - string currKey = redHashMpIO($"IOB:{IdxMacchina}:ConfYaml"); + string currKey = RedHashMpIO($"IOB:{IdxMacchina}:ConfYaml"); try { result = redisDb.StringGet(currKey); @@ -1697,6 +1695,7 @@ namespace MP.Data.Services Log.Debug($"MachIobYamlConf per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; } +#endif /// /// Restitusice elenco KVP dei TASK SALVATI (da passare a IOB-WIN) per l'impianto indicato @@ -3967,6 +3966,8 @@ namespace MP.Data.Services protected int expMinutes = 1; + protected string MpIoNS = ""; + /// /// Oggetto per connessione a REDIS /// @@ -4021,8 +4022,6 @@ namespace MP.Data.Services /// private ExecStatsCollector esCollect = new ExecStatsCollector(); - private string MpIoNS = ""; - /// /// numero minimo di record per cui iniziare fase di log /// @@ -4114,7 +4113,7 @@ namespace MP.Data.Services /// private string exeTaskHash(string idxMacchina) { - return redHashMpIO($"ExeTask:{idxMacchina}"); + return RedHashMpIO($"ExeTask:{idxMacchina}"); } /// @@ -4154,7 +4153,8 @@ namespace MP.Data.Services return result; } - private string redHashMpIO(string keyName) +#if false + protected string RedHashMpIO(string keyName) { string result = keyName; try @@ -4163,11 +4163,12 @@ namespace MP.Data.Services } catch (Exception exc) { - Log.Error($"Errore in redHashMpIO{Environment.NewLine}{exc}"); + Log.Error($"Errore in RedHashMpIO{Environment.NewLine}{exc}"); } return result; } +#endif private string redHashParam(string keyName) { @@ -4292,7 +4293,7 @@ namespace MP.Data.Services /// private string savedTaskHash(string idxMacchina) { - return redHashMpIO($"SavedTask:{idxMacchina}"); + return RedHashMpIO($"SavedTask:{idxMacchina}"); } #endregion Private Methods diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index b5798d11..23f053dd 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2507.0108 + 6.16.2507.0111 Debug;Release;Debug_LiManDebug en True diff --git a/MP.Land/Pages/IobList.razor b/MP.Land/Pages/IobList.razor index 1094894b..03d00c5c 100644 --- a/MP.Land/Pages/IobList.razor +++ b/MP.Land/Pages/IobList.razor @@ -79,17 +79,16 @@ { Descr } - OS - PC IOB - Software - CNC/PLC + OS + PC IOB + Adapter + CNC/PLC Conf @foreach (var item in ListRecords) { - var cIobInfo = CurrIobInfo(item.IdxMacchina); @item.IdxMacchina @@ -111,30 +110,47 @@ } - @cIobInfo.iType + @item.OS -
- @cIobInfo.name -
-
@cIobInfo.IP
- - - @if (MacIobConf(item.IdxMacchina, "IobVersion").Length > 1) + @if (!string.IsNullOrEmpty(item.IobName)) {
- @* @MacIobConf(item.IdxMacchina, "IobExe") *@ - @IobExeTrim(item.IdxMacchina) -
-
- @MacIobConf(item.IdxMacchina, "IobType") | @MacIobConf(item.IdxMacchina, "IobVersion") + @item.IobName
+
@item.IobIpv4
+ } + else + { +
-
} - @MacIobConf(item.IdxMacchina, "MachIp") -
- port: @MacIobConf(item.IdxMacchina, "MachPort") -
+ @if (!string.IsNullOrEmpty(item.AdapName)) + { +
+ @item.AdapName +
+
+ @item.AdapType | @item.AdapVers +
+ } + else + { +
-
+ } + + + @if (!string.IsNullOrEmpty(item.TargetIp)) + { + @item.TargetIp +
+ port: @item.TargetPort +
+ } + else + { +
-
+ } diff --git a/MP.Land/Pages/IobList.razor.cs b/MP.Land/Pages/IobList.razor.cs index 9d1ad14b..58886ae0 100644 --- a/MP.Land/Pages/IobList.razor.cs +++ b/MP.Land/Pages/IobList.razor.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.JSInterop; using MP.AppAuth.Models; using MP.AppAuth.Services; +using MP.Data.DTO; using MP.Data.Services; using MP.Land.Data; using NLog; @@ -26,6 +27,7 @@ namespace MP.Land.Pages GC.Collect(); } +#if false public string MacIobConf(string idxMacc, string kReq) { string answ = "-"; @@ -38,15 +40,18 @@ namespace MP.Land.Pages } } return answ; - } + } +#endif #endregion Public Methods #region Protected Fields +#if false protected Dictionary DictIobInfo = new Dictionary(); - protected Dictionary> DictMachData = new Dictionary>(); + protected Dictionary> DictMachData = new Dictionary>(); +#endif #endregion Protected Fields @@ -55,6 +60,9 @@ namespace MP.Land.Pages [Inject] protected AppAuthService AppDService { get; set; } + [Inject] + protected LandDataService LDService { get; set; } + [Inject] protected LMessageService AppMService { get; set; } @@ -147,7 +155,7 @@ namespace MP.Land.Pages #region Protected Methods - protected string checkSelect(MacchineModel IdxODL) + protected string checkSelect(IobDTO IdxODL) { string answ = ""; #if false @@ -164,6 +172,7 @@ namespace MP.Land.Pages return answ; } +#if false protected Core.Objects.IOB_data CurrIobInfo(string idxMacc) { Core.Objects.IOB_data answ = new Core.Objects.IOB_data(); @@ -172,13 +181,17 @@ namespace MP.Land.Pages answ = DictIobInfo[idxMacc]; } return answ; - } + } +#endif protected void DataInit() { isLoading = true; - // importante altrimenti NON mostra update UI - AllRecords = AppDService.MacchineGetAll(); + // recupero TUTTI i dati IobList già completi anche on i RemoteRebootLog + AllRecords = LDService.IobListAll(); + + +#if false // leggo i remoteRebootLog e cerco IdxMacc NON presenti, aggiungendo... // fare!!! FixMe ToDo: aggiungere modello RRL, e query specifica x recuperare record con idxMacchina non presenti in tab Macchine.. @@ -188,6 +201,7 @@ namespace MP.Land.Pages // leggo le info IOB x ogni record trovato... DictIobInfo = AllRecords.ToDictionary(x => x.IdxMacchina, x => TabSrv.IobInfo(x.IdxMacchina)); DictMachData = AllRecords.ToDictionary(x => x.IdxMacchina, x => TabSrv.MachIobConf(x.IdxMacchina)); +#endif RefreshDisplay(); isLoading = false; } @@ -204,6 +218,7 @@ namespace MP.Land.Pages return answ; } +#if false protected string IobExeTrim(string IdxMacchina) { string answ = MacIobConf(IdxMacchina, "IobExe"); @@ -212,7 +227,8 @@ namespace MP.Land.Pages answ = answ.Substring(0, answ.IndexOf(',')); } return answ; - } + } +#endif protected override async Task OnInitializedAsync() { @@ -261,12 +277,12 @@ namespace MP.Land.Pages ///
private static Logger Log = LogManager.GetCurrentClassLogger(); - private List AllRecords = new List(); + private List AllRecords = new List(); private int currPage = 1; private bool isLoading = false; - private List ListRecords = new List(); + private List ListRecords = new List(); private int numRecord = 10; - private List SearchRecords = new List(); + private List SearchRecords = new List(); private string searchVal = ""; /// @@ -300,8 +316,9 @@ namespace MP.Land.Pages // in primis filtro conddizioni da selettori... SearchRecords = AllRecords .Where(x => (!string.IsNullOrEmpty(x.Locazione) || showEmptyLoc) - && (showMulti || !x.IdxMacchina.Contains("#"))) - .ToList(); + && (showMulti || !x.IdxMacchina.Contains("#")) + && (showExtra || x.IsMachine) + ).ToList(); // se ho ricerca filtro... if (!string.IsNullOrEmpty(searchVal)) @@ -356,8 +373,53 @@ namespace MP.Land.Pages } break; + case "OS": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.OS).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.OS).ToList(); + } + break; + + case "IobName": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.IobName).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.IobName).ToList(); + } + break; + + case "AdapName": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.AdapName).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.AdapName).ToList(); + } + break; + + case "TargetIp": + if (sortAsc) + { + SearchRecords = SearchRecords.OrderBy(x => x.TargetIp).ToList(); + } + else + { + SearchRecords = SearchRecords.OrderByDescending(x => x.TargetIp).ToList(); + } + break; + default: + SearchRecords = SearchRecords.OrderBy(x => x.IdxMacchina).ToList(); break; } } diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index c16065ca..2e989fd7 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

Versione: 6.16.2507.0108

+

Versione: 6.16.2507.0111


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 97c92218..0d6c22cc 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2507.0108 +6.16.2507.0111 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 64bea6eb..ee8bb1c0 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2507.0108 + 6.16.2507.0111 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false