diff --git a/MP.AppAuth/Controllers/MPController .cs b/MP.AppAuth/Controllers/MPController .cs
index 62d245ec..b3dee069 100644
--- a/MP.AppAuth/Controllers/MPController .cs
+++ b/MP.AppAuth/Controllers/MPController .cs
@@ -16,6 +16,14 @@ namespace MP.AppAuth.Controllers
#endregion Public Fields
+ #region Private Fields
+
+ private static IConfiguration _configuration;
+
+ private static Logger Log = LogManager.GetCurrentClassLogger();
+
+ #endregion Private Fields
+
#region Public Constructors
public MPController(IConfiguration configuration)
@@ -92,54 +100,6 @@ namespace MP.AppAuth.Controllers
return dbResult;
}
- ///
- /// Elenco Record x AnagMicroStati
- ///
- ///
- public List AnagMicroStati()
- {
- List dbResult = new List();
- using (MoonProContext localDbCtx = new MoonProContext(_configuration))
- {
- dbResult = localDbCtx
- .DbSetAnagMicroStati
- .ToList();
- }
- return dbResult;
- }
-
- ///
- /// Elenco Record x AnagraficaStati
- ///
- ///
- public List AnagStati()
- {
- List dbResult = new List();
- using (MoonProContext localDbCtx = new MoonProContext(_configuration))
- {
- dbResult = localDbCtx
- .DbSetAnagStati
- .ToList();
- }
- return dbResult;
- }
-
- ///
- /// Elenco Record x ListValues
- ///
- ///
- public List ListValues()
- {
- List dbResult = new List();
- using (MoonProContext localDbCtx = new MoonProContext(_configuration))
- {
- dbResult = localDbCtx
- .DbSetListValue
- .ToList();
- }
- return dbResult;
- }
-
///
/// Delete Record AnagKeyValue
///
@@ -210,6 +170,38 @@ namespace MP.AppAuth.Controllers
return fatto;
}
+ ///
+ /// Elenco Record x AnagMicroStati
+ ///
+ ///
+ public List AnagMicroStati()
+ {
+ List dbResult = new List();
+ using (MoonProContext localDbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = localDbCtx
+ .DbSetAnagMicroStati
+ .ToList();
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Elenco Record x AnagraficaStati
+ ///
+ ///
+ public List AnagStati()
+ {
+ List dbResult = new List();
+ using (MoonProContext localDbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = localDbCtx
+ .DbSetAnagStati
+ .ToList();
+ }
+ return dbResult;
+ }
+
///
/// Delete Record Config
///
@@ -288,6 +280,38 @@ namespace MP.AppAuth.Controllers
}
}
+ ///
+ /// Elenco Record x ListValues
+ ///
+ ///
+ public List ListValues()
+ {
+ List dbResult = new List();
+ using (MoonProContext localDbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = localDbCtx
+ .DbSetListValue
+ .ToList();
+ }
+ return dbResult;
+ }
+
+ ///
+ /// Elenco Record Macchine
+ ///
+ ///
+ public List MacchineGetAll()
+ {
+ List dbResult = new List();
+ using (MoonProContext localDbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = localDbCtx
+ .DbSetMacchine
+ .ToList();
+ }
+ return dbResult;
+ }
+
///
/// Delete Record Vocabolario
///
@@ -356,12 +380,5 @@ namespace MP.AppAuth.Controllers
}
#endregion Public Methods
-
- #region Private Fields
-
- private static IConfiguration _configuration;
- private static Logger Log = LogManager.GetCurrentClassLogger();
-
- #endregion Private Fields
}
}
\ No newline at end of file
diff --git a/MP.AppAuth/Models/Macchine.cs b/MP.AppAuth/Models/MacchineModel.cs
similarity index 84%
rename from MP.AppAuth/Models/Macchine.cs
rename to MP.AppAuth/Models/MacchineModel.cs
index f7ef7966..57727c75 100644
--- a/MP.AppAuth/Models/Macchine.cs
+++ b/MP.AppAuth/Models/MacchineModel.cs
@@ -1,24 +1,26 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
namespace MP.AppAuth.Models
{
- public partial class Macchine
+ [Table("Macchine")]
+ public partial class MacchineModel
{
#region Public Properties
- public string CodMacchina { get; set; }
- public int ColNum { get; set; }
- public string Css { get; set; }
- public string Descrizione { get; set; }
public string IdxMacchina { get; set; }
- public string Locazione { get; set; }
+ public string CodMacchina { get; set; }
public string Nome { get; set; }
+ public string Descrizione { get; set; }
+ public string Locazione { get; set; }
public string Note { get; set; }
- public int RowNum { get; set; }
+ public string Css { get; set; }
public string Url { get; set; }
+ public int ColNum { get; set; }
+ public int RowNum { get; set; }
#endregion Public Properties
}
diff --git a/MP.AppAuth/MoonProContext.cs b/MP.AppAuth/MoonProContext.cs
index f1e58261..6a1d615d 100644
--- a/MP.AppAuth/MoonProContext.cs
+++ b/MP.AppAuth/MoonProContext.cs
@@ -70,7 +70,7 @@ namespace MP.AppAuth
public virtual DbSet DbSetKeepAlive { get; set; }
public virtual DbSet DbSetLinkMenuJqm { get; set; }
public virtual DbSet DbSetListValue { get; set; }
- public virtual DbSet DbSetMacchine { get; set; }
+ public virtual DbSet DbSetMacchine { get; set; }
public virtual DbSet DbSetUpdMan { get; set; }
public virtual DbSet DbSetVocabolario { get; set; }
@@ -410,11 +410,11 @@ namespace MP.AppAuth
entity.Property(e => e.Ordinal).HasColumnName("ordinal");
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.IdxMacchina);
- entity.ToTable("Macchine");
+ //entity.ToTable("Macchine");
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
diff --git a/MP.AppAuth/Services/AppAuthService.cs b/MP.AppAuth/Services/AppAuthService.cs
index 75767389..312b12d4 100644
--- a/MP.AppAuth/Services/AppAuthService.cs
+++ b/MP.AppAuth/Services/AppAuthService.cs
@@ -26,6 +26,54 @@ namespace MP.AppAuth.Services
#endregion Public Fields
+ #region Private Fields
+
+ // gestione key Redis
+ private const string redisBaseAddr = "MP:LAND";
+
+ private const string rKeyDirittiUser = $"{redisBaseAddr}:DIR_USER";
+
+ private const string rKeyMacchine = $"{redisBaseAddr}:MACCHINE";
+
+ private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
+
+ private static IConfiguration _configuration;
+
+ private static ILogger _logger;
+
+ private static JsonSerializerSettings? JSSettings;
+
+ private static Logger Log = LogManager.GetCurrentClassLogger();
+
+ private static string Modulo = "";
+
+ ///
+ /// Durata cache lunga IN SECONDI
+ ///
+ private int cacheTtlLong = 60 * 5;
+
+ ///
+ /// Durata cache breve IN SECONDI
+ ///
+ private int cacheTtlShort = 60 * 1;
+
+ ///
+ /// Oggetto per connessione a REDIS
+ ///
+ private IConnectionMultiplexer redisConn;
+
+ //ISubscriber sub = redis.GetSubscriber();
+ ///
+ /// Oggetto DB redis da impiegare x chiamate R/W
+ ///
+ private StackExchange.Redis.IDatabase redisDb = null!;
+
+ private Random rnd = new Random();
+
+ private Dictionary Vocabolario = new Dictionary();
+
+ #endregion Private Fields
+
#region Public Constructors
public AppAuthService(IConfiguration configuration, ILogger logger, IConnectionMultiplexer redisConnMult)
@@ -64,6 +112,36 @@ namespace MP.AppAuth.Services
#endregion Public Constructors
+ #region Private Properties
+
+ private string CodApp { get; set; } = "";
+
+ ///
+ /// Durata cache lunga (+ perturbazione percentuale +/-10%)
+ ///
+ private TimeSpan FastCache
+ {
+ get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
+ }
+
+ ///
+ /// Durata cache lunga (+ perturbazione percentuale +/-10%)
+ ///
+ private TimeSpan LongCache
+ {
+ get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
+ }
+
+ ///
+ /// Durata cache lunga (+ perturbazione percentuale +/-10%)
+ ///
+ private TimeSpan UltraLongCache
+ {
+ get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
+ }
+
+ #endregion Private Properties
+
#region Public Methods
///
@@ -114,54 +192,6 @@ namespace MP.AppAuth.Services
return await Task.FromResult(dbResult);
}
- ///
- /// Lista AnagEventi
- ///
- ///
- public async Task> AnagIngressi()
- {
- List dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- dbResult = MpDbController.AnagIngressi();
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"Effettuata lettura da DB per AnagIngressi: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(dbResult);
- }
-
- ///
- /// Lista AnagEventi
- ///
- ///
- public async Task> AnagMicroStati()
- {
- List dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- dbResult = MpDbController.AnagMicroStati();
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"Effettuata lettura da DB per AnagMicroStati: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(dbResult);
- }
-
- ///
- /// Lista AnagStati
- ///
- ///
- public async Task> AnagStati()
- {
- List dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- dbResult = MpDbController.AnagStati();
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"Effettuata lettura da DB per AnagStati: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(dbResult);
- }
-
///
/// Lista Gruppi
///
@@ -178,22 +208,6 @@ namespace MP.AppAuth.Services
return await Task.FromResult(dbResult);
}
- ///
- /// Elenco ListValues
- ///
- ///
- public async Task> ListValues()
- {
- List dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- dbResult = MpDbController.ListValues();
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"Effettuata lettura da DB per ListValues: {ts.TotalMilliseconds} ms");
- return await Task.FromResult(dbResult);
- }
-
public async Task> AnagGruppiFilt(string codTipo)
{
List dbResult = new List();
@@ -206,6 +220,22 @@ namespace MP.AppAuth.Services
return await Task.FromResult(dbResult);
}
+ ///
+ /// Lista AnagEventi
+ ///
+ ///
+ public async Task> AnagIngressi()
+ {
+ List dbResult = new List();
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ dbResult = MpDbController.AnagIngressi();
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"Effettuata lettura da DB per AnagIngressi: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(dbResult);
+ }
+
public async Task AnagKeyValAdd(AnagKeyValueModel currRec)
{
bool answ = false;
@@ -254,6 +284,22 @@ namespace MP.AppAuth.Services
return await Task.FromResult(answ);
}
+ ///
+ /// Lista AnagEventi
+ ///
+ ///
+ public async Task> AnagMicroStati()
+ {
+ List dbResult = new List();
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ dbResult = MpDbController.AnagMicroStati();
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"Effettuata lettura da DB per AnagMicroStati: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(dbResult);
+ }
+
public async Task> AnagOperByGroupList(string codGruppo, string searchVal)
{
List dbResult = new List();
@@ -283,6 +329,22 @@ namespace MP.AppAuth.Services
return await Task.FromResult(dbResult);
}
+ ///
+ /// Lista AnagStati
+ ///
+ ///
+ public async Task> AnagStati()
+ {
+ List dbResult = new List();
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ dbResult = MpDbController.AnagStati();
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"Effettuata lettura da DB per AnagStati: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(dbResult);
+ }
+
public async Task ConfigAdd(ConfigModel currRec)
{
bool answ = false;
@@ -382,6 +444,57 @@ namespace MP.AppAuth.Services
CheckVoc();
}
+ ///
+ /// Elenco ListValues
+ ///
+ ///
+ public async Task> ListValues()
+ {
+ List dbResult = new List();
+ Stopwatch stopWatch = new Stopwatch();
+ stopWatch.Start();
+ dbResult = MpDbController.ListValues();
+ stopWatch.Stop();
+ TimeSpan ts = stopWatch.Elapsed;
+ Log.Trace($"Effettuata lettura da DB per ListValues: {ts.TotalMilliseconds} ms");
+ return await Task.FromResult(dbResult);
+ }
+
+ ///
+ /// Elenco Macchine gestite
+ ///
+ ///
+ ///
+ public List MacchineGetAll()
+ {
+ string source = "DB";
+ List? dbResult = new List();
+ string currKey = $"{rKeyMacchine}";
+ 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 diritti utente
+ dbResult = MpDbController.MacchineGetAll();
+ rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
+ redisDb.StringSet(currKey, rawData, UltraLongCache);
+ }
+ if (dbResult == null)
+ {
+ dbResult = new List();
+ }
+ sw.Stop();
+ Log.Debug($"MacchineGetAll | {source} | {sw.ElapsedMilliseconds} ms");
+ return dbResult;
+ }
+
///
/// Elenco permessi dato utente
///
@@ -539,84 +652,6 @@ namespace MP.AppAuth.Services
#endregion Protected Methods
- #region Private Fields
-
- // gestione key Redis
- private const string redisBaseAddr = "MP:LAND";
-
- private const string rKeyDirittiUser = $"{redisBaseAddr}:DIR_USER";
-
- private const string rKeyPermUser = $"{redisBaseAddr}:PERM_USER";
-
- private static IConfiguration _configuration;
-
- private static ILogger _logger;
-
- private static List ElencoMacchine = new List();
-
- private static JsonSerializerSettings? JSSettings;
-
- private static Logger Log = LogManager.GetCurrentClassLogger();
-
- private static string Modulo = "";
-
- ///
- /// Durata cache lunga IN SECONDI
- ///
- private int cacheTtlLong = 60 * 5;
-
- ///
- /// Durata cache breve IN SECONDI
- ///
- private int cacheTtlShort = 60 * 1;
-
- ///
- /// Oggetto per connessione a REDIS
- ///
- private IConnectionMultiplexer redisConn;
-
- //ISubscriber sub = redis.GetSubscriber();
- ///
- /// Oggetto DB redis da impiegare x chiamate R/W
- ///
- private StackExchange.Redis.IDatabase redisDb = null!;
-
- private Random rnd = new Random();
-
- private Dictionary Vocabolario = new Dictionary();
-
- #endregion Private Fields
-
- #region Private Properties
-
- private string CodApp { get; set; } = "";
-
- ///
- /// Durata cache lunga (+ perturbazione percentuale +/-10%)
- ///
- private TimeSpan FastCache
- {
- get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
- }
-
- ///
- /// Durata cache lunga (+ perturbazione percentuale +/-10%)
- ///
- private TimeSpan LongCache
- {
- get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
- }
-
- ///
- /// Durata cache lunga (+ perturbazione percentuale +/-10%)
- ///
- private TimeSpan UltraLongCache
- {
- get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
- }
-
- #endregion Private Properties
-
#region Private Methods
///
diff --git a/MP.Data/Controllers/MpIocController.cs b/MP.Data/Controllers/MpIocController.cs
index fb314801..17a9d49e 100644
--- a/MP.Data/Controllers/MpIocController.cs
+++ b/MP.Data/Controllers/MpIocController.cs
@@ -216,9 +216,9 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineGetFilt(string codGruppo)
+ public List MacchineGetFilt(string codGruppo)
{
- List dbResult = new List();
+ List dbResult = new List();
try
{
using (var dbCtx = new MoonProContext(_configuration))
diff --git a/MP.Data/Controllers/MpMonController.cs b/MP.Data/Controllers/MpMonController.cs
index 5dc6758a..4003acf1 100644
--- a/MP.Data/Controllers/MpMonController.cs
+++ b/MP.Data/Controllers/MpMonController.cs
@@ -71,9 +71,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Macchine
///
///
- public List MacchineGetAll()
+ public List MacchineGetAll()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
@@ -90,9 +90,9 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineGetFilt(string codGruppo)
+ public List MacchineGetFilt(string codGruppo)
{
- List dbResult = new List();
+ List dbResult = new List();
try
{
using (var dbCtx = new MoonProContext(_configuration))
diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index 6fe0e37d..1a8bbe54 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -1425,9 +1425,9 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineByMatrOper(int MatrOpr)
+ public List MacchineByMatrOper(int MatrOpr)
{
- List dbResult = new List();
+ List dbResult = new List();
try
{
using (var dbCtx = new MoonProContext(_configuration))
@@ -1475,9 +1475,9 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineGetFilt(string codGruppo)
+ public List MacchineGetFilt(string codGruppo)
{
- List dbResult = new List();
+ List dbResult = new List();
try
{
using (var dbCtx = new MoonProContext(_configuration))
@@ -1514,7 +1514,7 @@ namespace MP.Data.Controllers
}
///
- /// Elenco id Macchine che abbiano dati FLuxLog, nel periodo indicato
+ /// Elenco id MacchineModel che abbiano dati FLuxLog, nel periodo indicato
///
///
///
diff --git a/MP.Data/Controllers/MpStatsController.cs b/MP.Data/Controllers/MpStatsController.cs
index 079878ef..acf6ffda 100644
--- a/MP.Data/Controllers/MpStatsController.cs
+++ b/MP.Data/Controllers/MpStatsController.cs
@@ -126,9 +126,9 @@ namespace MP.Data.Controllers
/// Elenco da tabella Macchine
///
///
- public List MacchineGetAll()
+ public List MacchineGetAll()
{
- List dbResult = new List();
+ List dbResult = new List();
using (var dbCtx = new MoonPro_STATSContext(_configuration))
{
dbResult = dbCtx
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index 3104a874..028a0fcf 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -936,9 +936,9 @@ namespace MP.Data.Controllers
///
///
///
- public List MacchineByMatrOper(int MatrOpr)
+ public List MacchineByMatrOper(int MatrOpr)
{
- List dbResult = new List();
+ List dbResult = new List();
try
{
using (var dbCtx = new MoonProContext(_configuration))
diff --git a/MP.Data/DbModels/DiarioDiBordoModel.cs b/MP.Data/DbModels/DiarioDiBordoModel.cs
index afea0f94..5053711e 100644
--- a/MP.Data/DbModels/DiarioDiBordoModel.cs
+++ b/MP.Data/DbModels/DiarioDiBordoModel.cs
@@ -35,7 +35,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
///
diff --git a/MP.Data/DbModels/DossierModel.cs b/MP.Data/DbModels/DossierModel.cs
index d4e7623a..0cb3bb31 100644
--- a/MP.Data/DbModels/DossierModel.cs
+++ b/MP.Data/DbModels/DossierModel.cs
@@ -38,7 +38,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto ODL
diff --git a/MP.Data/DbModels/EventListModel.cs b/MP.Data/DbModels/EventListModel.cs
index 27e6805e..c4ba5bd7 100644
--- a/MP.Data/DbModels/EventListModel.cs
+++ b/MP.Data/DbModels/EventListModel.cs
@@ -35,7 +35,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
diff --git a/MP.Data/DbModels/Gruppi2MaccModel.cs b/MP.Data/DbModels/Gruppi2MaccModel.cs
index 01daae65..eff27663 100644
--- a/MP.Data/DbModels/Gruppi2MaccModel.cs
+++ b/MP.Data/DbModels/Gruppi2MaccModel.cs
@@ -21,7 +21,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Machine
diff --git a/MP.Data/DbModels/InsManualiModel.cs b/MP.Data/DbModels/InsManualiModel.cs
index f3e96fb2..a692763d 100644
--- a/MP.Data/DbModels/InsManualiModel.cs
+++ b/MP.Data/DbModels/InsManualiModel.cs
@@ -58,7 +58,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
diff --git a/MP.Data/DbModels/MacchineModel.cs b/MP.Data/DbModels/MacchineModel.cs
index b3899d7a..1cf87207 100644
--- a/MP.Data/DbModels/MacchineModel.cs
+++ b/MP.Data/DbModels/MacchineModel.cs
@@ -10,8 +10,8 @@ using System.ComponentModel.DataAnnotations.Schema;
//
namespace MP.Data.DbModels
{
- [Table("Macchine")]
- public partial class Macchine
+ [Table("MacchineModel")]
+ public partial class MacchineModel
{
#region Public Properties
diff --git a/MP.Data/DbModels/ODLExpModel.cs b/MP.Data/DbModels/ODLExpModel.cs
index 3d74eead..dfdee3fd 100644
--- a/MP.Data/DbModels/ODLExpModel.cs
+++ b/MP.Data/DbModels/ODLExpModel.cs
@@ -54,7 +54,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
///
diff --git a/MP.Data/DbModels/ODLModel.cs b/MP.Data/DbModels/ODLModel.cs
index a5634583..79ae4dbb 100644
--- a/MP.Data/DbModels/ODLModel.cs
+++ b/MP.Data/DbModels/ODLModel.cs
@@ -57,7 +57,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
///
diff --git a/MP.Data/DbModels/PODLExpModel.cs b/MP.Data/DbModels/PODLExpModel.cs
index 9577ba01..5352f1c0 100644
--- a/MP.Data/DbModels/PODLExpModel.cs
+++ b/MP.Data/DbModels/PODLExpModel.cs
@@ -74,7 +74,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
///
diff --git a/MP.Data/DbModels/PODLModel.cs b/MP.Data/DbModels/PODLModel.cs
index 83170e2e..5d660c90 100644
--- a/MP.Data/DbModels/PODLModel.cs
+++ b/MP.Data/DbModels/PODLModel.cs
@@ -61,7 +61,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
///
/// Navigazione oggetto Articolo
///
diff --git a/MP.Data/DbModels/TurniMaccModel.cs b/MP.Data/DbModels/TurniMaccModel.cs
index cc413f84..11a35a3d 100644
--- a/MP.Data/DbModels/TurniMaccModel.cs
+++ b/MP.Data/DbModels/TurniMaccModel.cs
@@ -25,7 +25,7 @@ namespace MP.Data.DbModels
/// Navigazione oggetto Machine
///
[ForeignKey("IdxMacchina")]
- public virtual Macchine MachineNav { get; set; } = null!;
+ public virtual MacchineModel MachineNav { get; set; } = null!;
#endregion Public Properties
}
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index a7e01fcf..c833c134 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -50,7 +50,7 @@ namespace MP.Data
public virtual DbSet DbSetConfig { get; set; }
public virtual DbSet DbSetLinkMenu { get; set; }
public virtual DbSet DbSetListValues { get; set; }
- public virtual DbSet DbSetMacchine { get; set; }
+ public virtual DbSet DbSetMacchine { get; set; }
public virtual DbSet DbSetMSE { get; set; }
public virtual DbSet DbSetODL { get; set; }
public virtual DbSet DbSetODLExp { get; set; }
@@ -190,7 +190,7 @@ namespace MP.Data
.HasMaxLength(50);
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.IdxMacchina);
diff --git a/MP.Data/MoonPro_FluxContext.cs b/MP.Data/MoonPro_FluxContext.cs
index 3d36a75e..9c14f8bf 100644
--- a/MP.Data/MoonPro_FluxContext.cs
+++ b/MP.Data/MoonPro_FluxContext.cs
@@ -49,7 +49,7 @@ namespace MP.Data
public virtual DbSet DbSetArticoli { get; set; }
- public virtual DbSet DbSetMacchine { get; set; }
+ public virtual DbSet DbSetMacchine { get; set; }
public virtual DbSet DbSetFluxLog { get; set; }
public virtual DbSet DbSetDossiers { get; set; }
public virtual DbSet DbSetParetoFluxLog { get; set; }
@@ -111,7 +111,7 @@ namespace MP.Data
.HasMaxLength(50);
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.IdxMacchina);
diff --git a/MP.Data/MoonPro_STATSContext.cs b/MP.Data/MoonPro_STATSContext.cs
index 453fe4e2..0b4b9990 100644
--- a/MP.Data/MoonPro_STATSContext.cs
+++ b/MP.Data/MoonPro_STATSContext.cs
@@ -43,7 +43,7 @@ namespace MP.Data
public virtual DbSet DbSetControlli { get; set; }
public virtual DbSet DbSetDdbTurni { get; set; }
public virtual DbSet DbSetFL { get; set; }
- public virtual DbSet DbSetMacchine { get; set; }
+ public virtual DbSet DbSetMacchine { get; set; }
public virtual DbSet DbSetODL { get; set; }
public virtual DbSet DbSetOdlEnergy { get; set; }
public virtual DbSet DbSetScarti { get; set; }
@@ -159,7 +159,7 @@ namespace MP.Data
.HasMaxLength(50);
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
entity.HasNoKey();
diff --git a/MP.Data/Services/ListSelectDataSrv.cs b/MP.Data/Services/ListSelectDataSrv.cs
index 6c8c41d6..0e1f4640 100644
--- a/MP.Data/Services/ListSelectDataSrv.cs
+++ b/MP.Data/Services/ListSelectDataSrv.cs
@@ -234,19 +234,19 @@ namespace MP.Data.Services
///
///
///
- public async Task> MacchineByMatrOper(int MatrOpr)
+ public async Task> MacchineByMatrOper(int MatrOpr)
{
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
- List? result = new List();
+ List? result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:Macc:{MatrOpr}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
- result = JsonConvert.DeserializeObject>($"{rawData}");
+ result = JsonConvert.DeserializeObject>($"{rawData}");
source = "REDIS";
}
else
@@ -258,7 +258,7 @@ namespace MP.Data.Services
}
if (result == null)
{
- result = new List();
+ result = new List();
}
sw.Stop();
Log.Debug($"MacchineGetFilt | MatrOpr: {MatrOpr} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs
index 7d1a7aae..37c2e730 100644
--- a/MP.Data/Services/MessageService.cs
+++ b/MP.Data/Services/MessageService.cs
@@ -125,14 +125,14 @@ namespace MP.Data.Services
///
/// Cache elenco macchine abilitate all'utente, vuoto se scaduto reload
///
- public List? ListMachineEnabled
+ public List? ListMachineEnabled
{
get
{
- List? answ = userListMachine;
+ List? answ = userListMachine;
if (DateTime.Now.Subtract(lastUserUpd).TotalSeconds > 30)
{
- answ = new List();
+ answ = new List();
Log.Debug("ListMachineEnabled unvalidated");
}
return answ;
@@ -710,7 +710,7 @@ namespace MP.Data.Services
#region Private Properties
- private List? userListMachine { get; set; } = null;
+ private List? userListMachine { get; set; } = null;
private Dictionary UserPrefs { get; set; } = new Dictionary();
#endregion Private Properties
diff --git a/MP.Data/Services/StatusData.cs b/MP.Data/Services/StatusData.cs
index 9d2e5142..afdece54 100644
--- a/MP.Data/Services/StatusData.cs
+++ b/MP.Data/Services/StatusData.cs
@@ -167,18 +167,18 @@ namespace MP.Data.Services
return outVal;
}
- public async Task> MacchineGetAll()
+ public async Task> MacchineGetAll()
{
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
- List? result = new List();
+ List? result = new List();
// cerco in redis...
string currKey = $"{Constants.redisMacchine}:ALL";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
- result = JsonConvert.DeserializeObject>($"{rawData}");
+ result = JsonConvert.DeserializeObject>($"{rawData}");
source = "REDIS";
}
else
@@ -190,7 +190,7 @@ namespace MP.Data.Services
}
if (result == null)
{
- result = new List();
+ result = new List();
}
sw.Stop();
Log.Debug($"MacchineGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
@@ -198,18 +198,18 @@ namespace MP.Data.Services
//return Task.FromResult(dbController.MacchineGetAll());
}
- public async Task> MacchineGetByGruppo(string CodGruppo)
+ public async Task> MacchineGetByGruppo(string CodGruppo)
{
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
- List? result = new List();
+ List? result = new List();
// cerco in redis...
string currKey = $"{Constants.redisMacchine}:{CodGruppo}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
- result = JsonConvert.DeserializeObject>($"{rawData}");
+ result = JsonConvert.DeserializeObject>($"{rawData}");
source = "REDIS";
}
else
@@ -222,7 +222,7 @@ namespace MP.Data.Services
}
if (result == null)
{
- result = new List();
+ result = new List();
}
sw.Stop();
Log.Debug($"MacchineGetByGruppo | {source} | {sw.Elapsed.TotalMilliseconds}ms");
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index c5681c67..f278fdde 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -1246,7 +1246,43 @@ namespace MP.Data.Services
///
///
///
- public async Task IobInfo(string IdxMacchina)
+ 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 IOB x TAB (da info registrate IOB-WIN--> MP-IO)
+ ///
+ ///
+ ///
+ public async Task IobInfoAsync(string IdxMacchina)
{
string source = "DB";
Stopwatch sw = new Stopwatch();
@@ -1273,7 +1309,7 @@ namespace MP.Data.Services
Log.Debug($"Init valore default | IdxMacchina: {IdxMacchina}");
}
sw.Stop();
- Log.Debug($"IobInfo per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ Log.Debug($"IobInfoAsync per {IdxMacchina} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
@@ -1431,11 +1467,11 @@ namespace MP.Data.Services
}
///
- /// Elenco Macchine dato operatore secondo gruppi (macchine/operatore)
+ /// Elenco MacchineModel dato operatore secondo gruppi (macchine/operatore)
///
///
///
- public async Task> MacchineByMatrOper(int MatrOpr)
+ public async Task> MacchineByMatrOper(int MatrOpr)
{
int rndWait = rnd.Next(0, 2);
await Task.Delay(rndWait);
@@ -1443,14 +1479,14 @@ namespace MP.Data.Services
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
- List result = new List();
+ List result = new List();
// cerco in redis...
string currKey = $"{redisBaseKey}:MachByMatOp:{MatrOpr}";
RedisValue rawData = redisDb.StringGet(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
- result = JsonConvert.DeserializeObject>($"{rawData}");
+ result = JsonConvert.DeserializeObject>($"{rawData}");
source = "REDIS";
}
else
@@ -1462,7 +1498,7 @@ namespace MP.Data.Services
}
if (result == null)
{
- result = new List();
+ result = new List();
}
sw.Stop();