diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj
index 24212401..722b07cd 100644
--- a/MP-TAB3/MP-TAB3.csproj
+++ b/MP-TAB3/MP-TAB3.csproj
@@ -3,7 +3,7 @@
net8.0
enable
- 8.16.2605.2907
+ 8.16.2605.2908
enable
MP_TAB3
diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html
index df4ddb74..7f15ac9a 100644
--- a/MP-TAB3/Resources/ChangeLog.html
+++ b/MP-TAB3/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
-
diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP-TAB3/Resources/VersNum.txt
+++ b/MP-TAB3/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml
index d26f6752..a3387c78 100644
--- a/MP-TAB3/Resources/manifest.xml
+++ b/MP-TAB3/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip
https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html
false
diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index d2a22b27..32575fc1 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -15,7 +15,7 @@ using static EgwCoreLib.Utils.DtUtils;
namespace MP.Data.Controllers
{
- public class MpSpecController : IDisposable
+ public class MpSpecController
{
#region Public Constructors
@@ -734,11 +734,6 @@ namespace MP.Data.Controllers
return dbResult;
}
- public void Dispose()
- {
- _configuration = null;
- }
-
///
/// Eliminazione di un dossier
///
diff --git a/MP.Data/Services/ListSelectDataSrv.cs b/MP.Data/Services/ListSelectDataSrv.cs
index 1452f71a..80cc2102 100644
--- a/MP.Data/Services/ListSelectDataSrv.cs
+++ b/MP.Data/Services/ListSelectDataSrv.cs
@@ -254,12 +254,6 @@ namespace MP.Data.Services
{
if (!_disposed)
{
- if (disposing)
- {
- // Free managed resources here
- dbController.Dispose();
- }
-
// Free unmanaged resources here
_disposed = true;
}
diff --git a/MP.Data/Services/OrderDataSrv.cs b/MP.Data/Services/OrderDataSrv.cs
index 42e0efdb..e974f441 100644
--- a/MP.Data/Services/OrderDataSrv.cs
+++ b/MP.Data/Services/OrderDataSrv.cs
@@ -131,12 +131,6 @@ namespace MP.Data.Services
{
if (!_disposed)
{
- if (disposing)
- {
- // Free managed resources here
- dbController.Dispose();
- }
-
// Free unmanaged resources here
_disposed = true;
}
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index d97f422a..a797534f 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 8.16.2605.2907
+ 8.16.2605.2908
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index d2983759..d596732c 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
-
Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index c4f54211..501709a5 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip
https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html
false
diff --git a/MP.IOC/Data/MpDataService.cs b/MP.IOC/Data/MpDataService.cs
index 73bd612f..f11e2a3c 100644
--- a/MP.IOC/Data/MpDataService.cs
+++ b/MP.IOC/Data/MpDataService.cs
@@ -19,7 +19,7 @@ using static MP.Core.Objects.Enums;
namespace MP.IOC.Data
{
- public class MpDataService : IDisposable
+ public class MpDataService
{
#region Public Constructors
@@ -97,51 +97,6 @@ namespace MP.IOC.Data
#region Public Methods
- ///
- /// Recupera eventuali azioni richieste
- ///
- ///
- public async Task ActionGetReq()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- DisplayAction? result = null;
- // cerco in redis...
- RedisValue rawData = await redisDb.StringGetAsync(Utils.redisActionReq);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject($"{rawData}");
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ActionGetReq Read from REDIS: {ts.TotalMilliseconds}ms");
- }
- if (result == null)
- {
- result = new DisplayAction();
- }
- return result;
- }
-
- ///
- /// Salva richiesta azione
- ///
- ///
- ///
- public bool ActionSetReq(DisplayAction? act2save)
- {
- bool fatto = false;
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- // cerco in redis...
- string rawData = JsonConvert.SerializeObject(act2save);
- // invio broadcast + salvo in redis
- BroadastMsgPipe.saveAndSendMessage(Utils.redisActionReq, rawData);
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ActionSetReq REDIS send to broadcast + Write cache: {ts.TotalMilliseconds}ms");
- return fatto;
- }
-
///
/// Verifica se sia da reinviare un tName alla macchina dall'elenco di quelli salvati (in
/// modalità upsert) se non scaduti
@@ -355,37 +310,6 @@ namespace MP.IOC.Data
return answ;
}
- public async Task
> AnagStatiComm()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- List? result = new List();
- // cerco in redis...
- RedisValue rawData = await redisDb.StringGetAsync(Utils.redisStatoCom);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"AnagStatiComm Read from REDIS: {ts.TotalMilliseconds}ms");
- }
- else
- {
- result = await SpecDbController.AnagStatiCommAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(Utils.redisStatoCom, rawData, getRandTOut(redisLongTimeCache));
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms");
- }
- if (result == null)
- {
- result = new List();
- }
- return result;
- }
-
///
/// Restituisce l'anagrafica STATI per intero
///
@@ -410,83 +334,6 @@ namespace MP.IOC.Data
return dbResult;
}
- public async Task> AnagTipoArtLV()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string source = "DB";
- List? result = new List();
- // cerco in redis...
- RedisValue rawData = await redisDb.StringGetAsync(Utils.redisTipoArt);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await SpecDbController.AnagTipoArtLvAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(Utils.redisTipoArt, rawData, getRandTOut(redisLongTimeCache));
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"AnagTipoArtLV Read from {source}: {ts.TotalMilliseconds}ms");
- if (result == null)
- {
- result = new List();
- }
- return result;
- }
-
- ///
- /// Elenco Codice articolo con dati dossier gestiti
- ///
- ///
- public async Task> ArticleWithDossier()
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = Utils.redisArtByDossier;
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(SpecDbController.ArticleWithDossier());
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ArticleWithDossier | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Eliminazione record selezionato
- ///
- ///
- ///
- public async Task ArticoliDeleteRecord(AnagArticoliModel currRec)
- {
- bool fatto = await SpecDbController.ArticoliDeleteRecord(currRec);
- await resetCacheArticoli();
- return fatto;
- }
-
///
/// Elenco ultimi articoli data amcchina
///
@@ -523,125 +370,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Restitusice elenco articoli cercati
- ///
- ///
- ///
- ///
- ///
- ///
- public async Task> ArticoliGetSearchAsync(int numRecord, string tipoArt, string azienda, string searchVal)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string sKey = string.IsNullOrEmpty(searchVal) ? "***" : searchVal;
- string currKey = $"{Utils.redisArtList}:{azienda}:{tipoArt}:{sKey}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.ArticoliGetSearchAsync(numRecord, tipoArt, azienda, searchVal);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ArticoliGetSearchAsync | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Aggiornamento record selezionato
- ///
- ///
- ///
- public async Task ArticoliUpdateRecord(AnagArticoliModel currRec)
- {
- bool fatto = await SpecDbController.ArticoliUpdateRecord(currRec);
- await resetCacheArticoli();
- return fatto;
- }
-
- ///
- /// Verifica se sia possiubile cancellare articolo dato suo CodArt cercando su redis o su
- /// tab veto da DB
- ///
- ///
- ///
- public bool ArticoloDelEnabled(object CodArt)
- {
- bool answ = false;
- string codArticolo = $"{CodArt}";
- int cacheCheckArtUsato = 1;
- int.TryParse(_configuration.GetValue("ServerConf:cacheCheckArtUsato"), out cacheCheckArtUsato);
- TimeSpan TTLCache = getRandTOut(cacheCheckArtUsato);
- // cerco in cache redis...
- string redKeyArtUsed = $"{Utils.redKeyArtUsed}:{codArticolo}";
- string redKeyTabCheckArt = Utils.redKeyTabCheckArt;
- var rawData = redisDb.StringGet(redKeyArtUsed);
- if (!string.IsNullOrEmpty(rawData))
- {
- bool.TryParse(rawData, out answ);
- }
- else
- {
- // controllo non sia stato mai prodotto sennò non posso cancellare...
- try
- {
- // cerco in cache se ci sia la tabella con gli articoli impiegati...
- var rawTable = redisDb.StringGet(redKeyTabCheckArt);
- List? artList = new List();
- if (!string.IsNullOrEmpty(rawTable))
- {
- artList = JsonConvert.DeserializeObject>($"{rawTable}");
- }
- // rileggo...
- if (artList == null || artList.Count == 0)
- {
- artList = new List();
- var tabArticoli = SpecDbController.ArticoliGetUsed();
- var codList = tabArticoli.Select(x => x.CodArticolo);
- foreach (string cod in codList)
- {
- artList.Add(cod);
- }
- // SE fosse vuoto aggiungo comunque il cado "ND"...
- if (artList.Count == 0)
- {
- artList.Add("ND");
- }
- // salvo
- rawTable = JsonConvert.SerializeObject(artList);
- redisDb.StringSet(redKeyTabCheckArt, rawTable, TTLCache);
- }
- // cerco nella tabella: se ci fosse --> disabilitato delete
- bool usato = false;
- if (artList != null && artList.Count > 0)
- {
- usato = artList.Contains(codArticolo);
- }
- answ = !usato;
- redisDb.StringSet(redKeyArtUsed, $"{answ}", TTLCache);
- }
- catch
- { }
- }
- return answ;
- }
-
///
/// Effettua split ODL
///
@@ -1084,59 +812,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Reset dati cache config
- ///
- ///
- public async Task ConfigResetCache()
- {
- await redisDb.StringSetAsync(Utils.redisConfKey, "");
- }
-
- ///
- /// Update chiave config
- ///
- ///
- public Task ConfigUpdateAsync(ConfigModel updRec)
- {
- return SpecDbController.ConfigUpdateAsync(updRec);
- }
-
- ///
- /// Elenco completo valori DatiMacchine
- ///
- ///
- public async Task> DatiMacchineGetAll()
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisBaseAddr}:TabDatiMacchine:ALL";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(SpecDbController.DatiMacchineGetAll());
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"DatiMacchineGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
public async Task> DecNumArtGetFiltAsync(string codArt = "")
{
List result = new();
@@ -1158,17 +833,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Dispose del connettore ai dati
- ///
- public void Dispose()
- {
- // Clear database controller
- SpecDbController.Dispose();
- mongoController.Dispose();
- redisConn.Dispose();
- }
-
///
/// Restituisce l'elenco delle date dei dossier x una macchina (se presenti) Impiegata anche
/// cache redis
@@ -1199,202 +863,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Eliminazione di un dossier
- ///
- /// record dossier da eliminare
- ///
- public async Task DossiersDeleteRecord(DossierModel selRecord)
- {
- bool result = false;
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- result = await SpecDbController.DossiersDeleteRecord(selRecord);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{Utils.redisDossByMac}:*");
- bool answ = await RedisFlushPatternAsync(pattern);
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"DossiersDeleteRecord | IdxMacchina {selRecord.IdxMacchina} | DtRif {selRecord.DtRif} | IdxODL {selRecord.IdxODL} | {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
- /// macchina (ordinato x data registrazione)
- ///
- /// * = tutte, altrimenti solo x una data macchina
- /// Data minima per estrazione records
- /// Data Massima per estrazione records
- /// Num Max records da recuperare
- ///
- public async Task> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd, int MaxRec)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtStart:yyyyMMddHHmm}:{DtEnd:yyyyMMddHHmm}:{MaxRec}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.DossiersGetLastFiltAsync(IdxMacchina, CodArticolo, DtStart, DtEnd, MaxRec);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"DossiersGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Inserimento nuovo record dossier
- ///
- ///
- ///
- public async Task DossiersInsert(DossierModel currDoss)
- {
- // aggiorno record sul DB
- bool answ = await SpecDbController.DossiersInsert(currDoss);
-
- return answ;
- }
-
- ///
- /// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
- ///
- /// macchina
- /// NUm massimo secondi per recuperare dati correnti
- /// DataOra riferimento x cui prendere valori antecedenti
- ///
- public async Task DossiersTakeParamsSnapshotLast(string IdxMacchina, DateTime dtMin, DateTime dtMax)
- {
- bool answ = false;
- await Task.Delay(1);
- Log.Info($"Richiesta snapshot per macchina {IdxMacchina} | periodo {dtMin} --> {dtMax}");
- // chiamo stored x salvare parametri
- SpecDbController.DossiersTakeParamsSnapshotLast(IdxMacchina, dtMin, dtMax);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{Utils.redisDossByMac}:*");
- answ = await RedisFlushPatternAsync(pattern);
- Log.Info($"Svuotata cache dossier | {pattern}");
- return answ;
- }
-
- ///
- /// Update valOut dossier
- ///
- ///
- ///
- public async Task DossiersUpdateValore(DossierModel currDoss)
- {
- // aggiorno record sul DB
- bool answ = await SpecDbController.DossiersUpdateValore(currDoss);
-
- return answ;
- }
-
- ///
- /// Restitusice elenco aziende
- ///
- ///
- public Task> ElencoAziende()
- {
- return SpecDbController.AnagGruppiAziendeAsync();
- }
-
- ///
- /// Restitusice elenco fasi
- ///
- ///
- public async Task> ElencoGruppiFaseAsync()
- {
- List result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisAnagGruppi}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- var rawResult = JsonConvert.DeserializeObject>($"{rawData}");
- if (rawResult != null)
- {
- result = rawResult;
- }
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.AnagGruppiFaseAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, getRandTOut(redisLongTimeCache / 5));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ElencoGruppiFaseAsync | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Aggiunta record EventList
- ///
- ///
- ///
- public async Task EvListInsert(EventListModel newRec)
- {
- return await SpecDbController.EvListInsert(newRec);
- }
-
- ///
- /// Imposta in redis la scadenza della pagina x il reload
- ///
- ///
- ///
- public DateTime ExpiryReloadParamGet()
- {
- DateTime dtRif = DateTime.Now;
- string currKey = $"{Utils.redisParamPageExp}";
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- dtRif = JsonConvert.DeserializeObject($"{rawData}");
- }
- return dtRif;
- }
-
- ///
- /// Imposta in redis la scadenza della pagina x il reload
- ///
- ///
- ///
- public bool ExpiryReloadParamSet(DateTime expTime)
- {
- bool fatto = false;
- string currKey = $"{Utils.redisParamPageExp}";
- string rawData = JsonConvert.SerializeObject(expTime);
- fatto = redisDb.StringSet(currKey, rawData);
- return fatto;
- }
-
///
/// Task completo sistemazione dossier quotidiani mancanti
///
@@ -1476,24 +944,6 @@ namespace MP.IOC.Data
return answ;
}
- public async Task FlushRedisCache()
- {
- await Task.Delay(1);
- RedisValue pattern = Utils.RedValue("*");
- bool answ = await RedisFlushPatternAsync(pattern);
- // rileggo vocabolario.,..
- ObjVocabolario = VocabolarioGetAll();
- return answ;
- }
-
- public async Task FlushRedisKey(string redKey)
- {
- await Task.Delay(1);
- RedisValue pattern = Utils.RedValue(redKey);
- bool answ = await RedisFlushPatternAsync(pattern);
- return answ;
- }
-
public List FluxLogDtoGetByFlux(string Valore)
{
List answ = new List();
@@ -1516,53 +966,6 @@ namespace MP.IOC.Data
return answ;
}
- ///
- /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
- ///
- /// Data massima x eventi
- /// Data minima x eventi
- /// * = tutte, altrimenti solo x una data macchina
- /// *=tutti, altrimenti solo selezionato
- /// numero massimo record da restituire
- ///
- public async Task> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, double redisCacheSec)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMddHHmm}:{DtMin:yyyyMMddHHmm}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.FluxLogGetLastFiltAsync(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- if (string.IsNullOrEmpty(canCacheParametri))
- {
- canCacheParametri = await tryGetConfigAsync("SPEC_ParametriEnableRedisCache");
- }
- if (canCacheParametri != "false")
- {
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec));
- }
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"FluxLogGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
///
/// Restituisce il valOut dell'ODL corrente (ODL deve esserci per gestione contapezzi, senza
/// ODL NO invio/gestione ODL)
@@ -1589,32 +992,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Restituisce il valOut dell'ODL corrente (ODL deve esserci per gestione contapezzi, senza
- /// ODL NO invio/gestione ODL)
- ///
- ///
- /// indica se forzare lettura da db (true) o meno
- ///
- public async Task GetCurrOdlAsync(string idxMacchina, bool forceDb)
- {
- string answ = "";
- // se ho forceDB leggo dai dati prod...
- if (forceDb)
- {
- var datiProd = await StatoProdMacchinaAsync(idxMacchina, DateTime.Now, true);
- if (datiProd != null)
- {
- answ = datiProd.IdxOdl.ToString();
- }
- }
- else
- {
- answ = await GetCurrOdlAsync(idxMacchina);
- }
- return answ;
- }
-
///
/// Restituisce il valOut dell'ultimo ODL
///
@@ -1692,29 +1069,6 @@ namespace MP.IOC.Data
return dataOraEvento;
}
- ///
- /// Restitusice elenco KVP dei TASK (da passare a IOB-WIN) per l'impianto indicato
- ///
- ///
- ///
- public async Task> GetTask2ExeMacchinaAsync(string idxMacchina)
- {
- var currHash = Utils.RedKeyTask2ExeMacc(idxMacchina, MpIoNS);
- return await RedisGetHashDictAsync(currHash);
- }
-
- ///
- /// Init ricetta
- ///
- ///
- ///
- ///
- ///
- public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary CalcArgs)
- {
- return mongoController.InitRecipe(confPath, idxPODL, CalcArgs);
- }
-
///
/// Restituisce il valOut booleano se la macchina sia abilitata all'input
///
@@ -1792,41 +1146,6 @@ namespace MP.IOC.Data
return answ;
}
- ///
- ///
- /// idxMacc odl da cercare
- ///
- public async Task> ListGiacenzeAsync(int IdxOdl)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisGiacenzaList}:{IdxOdl}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.ListGiacenzeAsync(IdxOdl);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ListGiacenzeAsync | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
public async Task> ListValuesFilt(string tabName, string fieldName)
{
List resultList = new List();
@@ -1963,113 +1282,6 @@ namespace MP.IOC.Data
return result ?? "";
}
- ///
- /// Verifica se la macchina abbia un codice CONF ricetta associato
- ///
- ///
- ///
- public async Task MacchineRecipeConf(string idxMacchina)
- {
- string? result = "";
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisMacRecipeConf}:{idxMacchina}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- //recupero elenco macchine...
- var machineList = await MacchineGetFilt("*");
- var currMach = machineList.Where(x => x.IdxMacchina == idxMacchina).FirstOrDefault();
- result = currMach != null ? currMach.RecipePath : null;
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"MacchineRecipeConf | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result ?? "";
- }
-
- ///
- /// Elenco idxMacc Macchine che abbiano dati FLuxLog, nel periodo indicato
- ///
- ///
- ///
- ///
- public async Task> MacchineWithFlux(DateTime dtStart, DateTime dtEnd)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisMacByFlux}:{dtStart:yyyyMMddHHmm}:{dtEnd:yyyyMMddHHmm}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await SpecDbController.MacchineWithFluxAsync(dtStart, dtEnd);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"MacchineWithFlux | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Lista parametri correnti (ObjItemDTO) della macchina (ex getCurrObjItems)
- ///
- ///
- ///
- public List MachineParamList(string idxMacchina)
- {
- // setup parametri costanti
- string source = "NA";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List? result = new List();
- // cerco in _redisConn...
- var currKey = Utils.RedKeyCurrObjItems(idxMacchina, MpIoNS);
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue && rawData.Length() > 2)
- {
- var rawVal = JsonConvert.DeserializeObject>($"{rawData}");
- // ordino!
- result = rawVal
- .OrderBy(x => x.displOrdinal)
- .ThenBy(x => x.description)
- .ToList();
- source = "REDIS";
- }
- if (result == null)
- {
- result = new List();
- source = "NONE";
- }
- sw.Stop();
- Log.Debug($"MachineParamList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
-
///
/// Lista parametri correnti (ObjItemDTO) della macchina (ex getCurrObjItems)
///
@@ -2375,94 +1587,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Elenco ODL dato batch selezionato
- ///
- /// Batch richiesto
- ///
- public async Task> OdlByBatch(string BatchSel)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = Utils.redisOdlByBatch;
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(SpecDbController.OdlByBatch(BatchSel));
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"OdlByBatch | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// ODL da chiave
- ///
- ///
- ///
- public ODLExpModel OdlByKey(int IdxOdl)
- {
- ODLExpModel? result = new ODLExpModel();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- result = SpecDbController.OdlByKey(IdxOdl);
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"OdlByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Effettua chiusura dell'ODL indicato, andand
- ///
- /// idx odl da chiudere
- /// idx macchina
- /// matricola operatore
- /// indica se confermare i pezzi priam di chiudere ODL
- public async Task ODLClose(int idxOdl, string idxMacchina, int matrOpr, bool confPezzi)
- {
- bool fatto = false;
- await Task.Delay(1);
- // recupero dati x conf modalità conferma
- var configData = await ConfigGetAllAsync();
- if (configData != null)
- {
- bool confRett = false;
- var currRec = configData.FirstOrDefault(x => x.Chiave == "confRett");
- if (currRec != null)
- {
- bool.TryParse(currRec.Valore, out confRett);
- }
- int modoConfProd = 0;
- currRec = configData.FirstOrDefault(x => x.Chiave == "modoConfProd");
- if (currRec != null)
- {
- int.TryParse(currRec.Valore, out modoConfProd);
- }
- // chiamo metodo conferma!
- fatto = await SpecDbController.ODLClose(idxOdl, idxMacchina, matrOpr, confPezzi, confRett, modoConfProd);
- }
-
- return fatto;
- }
-
public async Task OdlCurrByMaccAsync(string IdxMacchina)
{
ODLExpModel result = new();
@@ -2494,60 +1618,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Record ODL da chaive
- ///
- ///
- public async Task OdlGetByKey(int IdxOdl)
- {
- await Task.Delay(1);
- var dbResult = await SpecDbController.OdlGetByKey(IdxOdl);
- return dbResult;
- }
-
- ///
- /// ODL correnti (tutti)
- ///
- ///
- ///
- public async Task> OdlGetCurrentAsync()
- {
- List? dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisOdlCurrByMac}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- try
- {
- dbResult = JsonConvert.DeserializeObject>($"{rawData}");
- }
- catch
- { }
- readType = "REDIS";
- }
- else
- {
- var rawList = await SpecDbController.OdlGetCurrentAsync();
- dbResult = rawList.Select(x => x.IdxMacchina).Distinct().ToList();
- rawData = JsonConvert.SerializeObject(dbResult);
- await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(3));
- }
- if (dbResult == null)
- {
- dbResult = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"OdlGetCurrentAsync | Read from {readType}: {ts.TotalMilliseconds}ms");
-
- return dbResult;
- }
-
-
///
/// Recupero PODL da chiave
///
@@ -2628,60 +1698,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
- ///
- /// Solo lanciati (1) o ancora disponibili (0)
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- /// Macchina
- /// Gruppo
- /// Data inizio
- /// Data fine
- ///
- public async Task> POdlListGetFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo, DateTime startDate, DateTime endDate)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{Utils.redisPOdlList}:{codGruppo}:{idxMacchina}:{keyRichPart}:{lanciato}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}";
- // cerco in redis dato valOut sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(SpecDbController.ListPODLFilt(lanciato, keyRichPart, idxMacchina, codGruppo, startDate, endDate));
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"POdlListGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Aggiornamento record selezionato
- ///
- ///
- ///
- public async Task POdlUpdateRecord(PODLModel currRec)
- {
- var dbResult = await SpecDbController.PODLUpdateRecord(currRec);
- // elimino cache redis...
- await POdlFlushCache();
- return dbResult;
- }
-
///
/// Processa registrazione FL da IOB
///
@@ -3022,22 +2038,6 @@ namespace MP.IOC.Data
return result;
}
- ///
- /// Salva ricetta su MongoDB
- ///
- ///
- ///
- public async Task RecipeSetByPODL(RecipeModel currRecord)
- {
- bool answ = false;
- answ = await mongoController.RecipeSetByPODL(currRecord);
- if (answ)
- {
- await POdlFlushCache();
- }
- return answ;
- }
-
///
/// Effettua conteggio chaivi REDIS dato pattern ricerca
///
@@ -3100,31 +2100,6 @@ namespace MP.IOC.Data
return await redisDb.KeyDeleteAsync(keyVal);
}
- ///
- /// Esegue flush memoria redis dato keyVal
- ///
- ///
- ///
- public bool RedisFlushPattern(string pattern)
- {
- bool answ = false;
- var listEndpoints = redisConnAdmin.GetEndPoints();
- foreach (var endPoint in listEndpoints)
- {
- var server = redisConnAdmin.GetServer(endPoint);
- if (server != null)
- {
- var keyList = server.Keys(redisDb.Database, pattern);
- foreach (var item in keyList)
- {
- redisDb.KeyDelete(item);
- }
- answ = true;
- }
- }
- return answ;
- }
-
///
/// Esegue flush memoria redis dato keyVal, async
///
@@ -3316,77 +2291,6 @@ namespace MP.IOC.Data
return fatto;
}
- ///
- /// Recupera tutti i record di RemoteRebootLog
- ///
- ///
- public async Task> RemRebootLogGetAllAsync()
- {
- // setup parametri costanti
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List result = new List();
- // cerco in _redisConn...
- var currKey = $"{Utils.redisRemRebLog}:ALL";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- //if (!string.IsNullOrEmpty($"{rawData}"))
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}") ?? new();
- source = "REDIS";
- }
- else
- {
- result = await IocDbController.RemRebootLogGetAllAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(30));
- }
- if (result == null)
- {
- result = new List();
- }
- sw.Stop();
- Log.Debug($"RemRebootLogGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Recupera ultimo record x ogni IdxMacchina x avere ultimo attivo
- ///
- ///
- public async Task> RemRebootLogGetLast()
- {
- // setup parametri costanti
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List result = new List();
- // cerco in _redisConn...
- var currKey = $"{Utils.redisRemRebLog}:LAST";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}") ?? new();
- source = "REDIS";
- }
- else
- {
- result = await IocDbController.RemRebootLogGetLastAsync();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(30));
- }
- if (result == null)
- {
- result = new List();
- }
- sw.Stop();
- Log.Debug($"RemRebootLogGetLast | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
-
///
/// Elimina da elenco KVP il TASK per l'impianto indicato
///
@@ -3502,119 +2406,6 @@ namespace MP.IOC.Data
return answ;
}
- ///
- /// Processa registrazione EVENTO CONTEGGIO PEZZI x una data macchina IOB
- ///
- /// Macchina
- /// Pezzi da registrare
- /// DataOra evento
- /// DataOra corrente
- ///
- public async Task SaveCaricoPezziAsync(string idxMacchina, string qty, string dtEve = "", string dtCurr = "")
- {
- // default: 0, non registrato x cautela...
- string answ = "0";
- // Verifica se evento realtime oppure ho data specificata x processing @dtEve
- DateTime adesso = DateTime.Now;
- DateTime dtEvent = adesso;
- bool rtimeProc = string.IsNullOrEmpty(dtEve);
- if (!rtimeProc)
- {
- dtEvent = GetSrvDtEvent(dtEve, dtCurr);
- }
- // controllo per proseguire
- if (!string.IsNullOrEmpty(idxMacchina) && !string.IsNullOrEmpty(qty))
- {
- int numPzIncr = -1;
- int.TryParse(qty, out numPzIncr);
- // se il conteggio è >= 0 SALVO evento...
- if (numPzIncr >= 0)
- {
- var listOdl = await IocDbController.OdlListByMaccPeriodoAsync(idxMacchina, dtEvent, dtEvent.AddSeconds(1));
- if (listOdl != null && listOdl.Count > 0)
- {
- string codArticolo = listOdl.FirstOrDefault()?.CodArticolo ?? "ND";
- // registro evento 120 --> contapezzi in blocco !!!HARD CODED!!! !!!FIXME!!!
- int idxEvento = 120;
- // creo evento
- EventListModel newRecEv = new EventListModel()
- {
- CodArticolo = codArticolo,
- IdxMacchina = idxMacchina,
- IdxTipo = idxEvento,
- InizioStato = dtEvent,
- MatrOpr = 0,
- pallet = "-",
- Value = qty
- };
- // salva e processa
- var resp = await scriviRigaEventoAsync(newRecEv);
- // registro in risposta che è andato tutto bene... ovvero la qty richiesta...
- answ = qty;
- }
- }
- }
- else
- {
- string errore = $"Errore: mancano parametri macchina/incremento: idxMacchina {idxMacchina} | qty {qty}";
- Log.Error(errore);
- answ = errore;
- }
- return answ;
- }
-
- ///
- /// Processa registrazione di un counter x una data macchina IOB
- ///
- ///
- /// contapezzi
- ///
- public async Task SaveCounterAsync(string idxMacchina, string counter)
- {
- string answ = "0";
- // inizio processing vero e proprio INPUT...
- if (string.IsNullOrEmpty(idxMacchina))
- {
- string errore = "Errore: parametro macchina vuoto";
- Log.Info(errore);
- answ = errore;
- }
- else
- {
- if (string.IsNullOrEmpty(counter))
- {
- string errore = "Errore: parametro counter vuoto";
- Log.Error(errore);
- answ = errore;
- }
- else
- {
- int newCounter = -1;
- int.TryParse(counter, out newCounter);
- // se il conteggio è >= 0 SALVO come nuovo conteggio...
- if (newCounter >= 0)
- {
- var currKey = Utils.RedKeyPzCount(idxMacchina, MpIoNS);
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- // salvo per + tempo...
- await redisDb.StringSetAsync(currKey, answ.ToString());
- answ = counter;
- }
- else
- {
- int currCount = await PzCounterTcAsync(idxMacchina);
- answ = currCount.ToString();
- // salvo per meno tempo...
- await redisDb.StringSetAsync(currKey, answ);
- }
- }
- }
- }
- return answ;
- }
-
public async Task SaveDataItemsAsync(string id, List dataList)
{
bool answ = false;
@@ -3771,104 +2562,6 @@ namespace MP.IOC.Data
return answ;
}
- ///
- /// Statistiche ODL calcolate (da stored stp_STAT_ODL)
- ///
- ///
- public Task> StatOdl(int IdxOdl)
- {
- return SpecDbController.OdlStart(IdxOdl);
- }
-
- ///
- /// restituisce il valOut da REDIS associato al tag richeisto
- ///
- /// Chiave in cui cercare il valOut
- ///
- public string TagConfGetKey(string redKey)
- {
- string outVal = "";
- // cerco in REDIS la conf x l'IOB
- var rawData = redisDb.StringGet(redKey);
- if (!string.IsNullOrEmpty(rawData))
- {
- outVal = $"{rawData}";
- }
- return outVal;
- }
-
- ///
- /// Elenco setup dei tag conf correnti
- ///
- ///
- public Task>> TagsGetAll()
- {
- return Task.FromResult(currTagConf);
- }
-
- ///
- /// Esegue traduzione dato vocabolario da Lingua + Lemma
- ///
- ///
- ///
- ///
- public string Traduci(string lemma, string lingua)
- {
- string answ = $"[{lemma}]";
- // verifico se ho qualcosa nell'obj vocabolario...
- if (ObjVocabolario == null || ObjVocabolario.Count == 0)
- {
- // inizializzo il vocabolario...
- ObjVocabolario = VocabolarioGetAll();
- }
- var record = ObjVocabolario.Where(x => x.Lingua == lingua && x.Lemma == lemma).FirstOrDefault();
- if (record != null)
- {
- answ = record.Traduzione;
- }
- return answ;
- }
-
- public async Task updateDossierValue(DossierModel currDoss, FluxLogDTO editFL)
- {
- bool answ = false;
- // recupero intero set valori dossier deserializzando...
- var fluxLogList = FluxLogDtoGetByFlux(currDoss.Valore);
- await Task.Delay(1);
-
- // se tutto ok
- if (fluxLogList != null)
- {
- // da provare...!!!!
-
- // elimino vecchio record
- var currRec = fluxLogList.FirstOrDefault(x => x.CodFlux == editFL.CodFlux && x.dtEvento == editFL.dtEvento);
- if (currRec != null)
- {
- fluxLogList.Remove(currRec);
- // aggiungo nuovo
- fluxLogList.Add(editFL);
- }
-
- // serializzo nuovamente valOut
- DossierFluxLogDTO? result = new DossierFluxLogDTO();
- var ODLflux = result.ODL.ToList();
- foreach (var item in fluxLogList)
- {
- ODLflux.Add(item);
- }
-
- DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = ODLflux };
-
- string rawVal = JsonConvert.SerializeObject(updatedResult);
- currDoss.Valore = rawVal;
- // aggiorno record sul DB
- await SpecDbController.DossiersUpdateValore(currDoss);
- }
-
- return answ;
- }
-
///
/// Effettua UPSERT elenco parametri correnti x IOB (se c'è UPDATE, se manca ADD)
///
@@ -3938,40 +2631,6 @@ namespace MP.IOC.Data
return valOut;
}
- ///
- /// Elenco completo tabella Vocabolario
- ///
- ///
- public List VocabolarioGetAll()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- List? result = new List();
- string source = "REDIS";
- // cerco in redis...
- RedisValue rawData = redisDb.StringGet(Utils.redisVocabolario);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- }
- else
- {
- result = SpecDbController.VocabolarioGetAll();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(Utils.redisVocabolario, rawData, getRandTOut(redisLongTimeCache / 5));
- source = "DB";
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"VocabolarioGetAll Read from {source}: {ts.TotalMilliseconds}ms");
- if (result == null)
- {
- result = new List();
- }
- return result;
- }
-
#endregion Public Methods
#region Internal Methods
@@ -4089,11 +2748,6 @@ namespace MP.IOC.Data
private string MpIoNS = "";
- ///
- /// Oggetto vocabolario x uso continuo traduzione
- ///
- private List ObjVocabolario = new List();
-
///
/// Oggetto per connessione a REDIS
///
diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj
index c0012b86..ee4df1a7 100644
--- a/MP.IOC/MP.IOC.csproj
+++ b/MP.IOC/MP.IOC.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- 8.16.2605.2907
+ 8.16.2605.2908
diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html
index b5bb6646..3399fa4c 100644
--- a/MP.IOC/Resources/ChangeLog.html
+++ b/MP.IOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-IOC
- Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
-
diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.IOC/Resources/VersNum.txt
+++ b/MP.IOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml
index 402bdbd2..d583a70f 100644
--- a/MP.IOC/Resources/manifest.xml
+++ b/MP.IOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip
https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 180ba1cc..c32f472d 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2605.2907
+ 8.16.2605.2908
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index 75967f1b..14843a9f 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
-
Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 5d7d8de9..bd08e1a6 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
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
diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj
index 3a846b66..f653ad75 100644
--- a/MP.MON/MP.MON.csproj
+++ b/MP.MON/MP.MON.csproj
@@ -6,7 +6,7 @@
enable
MP.MON
$(AssemblyName.Replace(' ', '_'))
- 8.16.2605.2907
+ 8.16.2605.2908
diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html
index df4ddb74..7f15ac9a 100644
--- a/MP.MON/Resources/ChangeLog.html
+++ b/MP.MON/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
-
diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.MON/Resources/VersNum.txt
+++ b/MP.MON/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml
index 0c4426f0..85890acd 100644
--- a/MP.MON/Resources/manifest.xml
+++ b/MP.MON/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.MON.zip
https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html
false
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index c6122009..d2a9c1c0 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Prog
- 8.16.2605.2907
+ 8.16.2605.2908
True
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index 8d002a99..fa44d60e 100644
--- a/MP.Prog/Resources/ChangeLog.html
+++ b/MP.Prog/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo gestione Programmi MAPO
-
Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index efdb7b7a..dd088ad3 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html
false
diff --git a/MP.RIOC/MP.RIOC.csproj b/MP.RIOC/MP.RIOC.csproj
index 7f255a6b..289a1164 100644
--- a/MP.RIOC/MP.RIOC.csproj
+++ b/MP.RIOC/MP.RIOC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.RIOC
- 8.16.2605.2907
+ 8.16.2605.2908
diff --git a/MP.RIOC/Resources/ChangeLog.html b/MP.RIOC/Resources/ChangeLog.html
index 20231bff..3c4a0ab3 100644
--- a/MP.RIOC/Resources/ChangeLog.html
+++ b/MP.RIOC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MP-RIOC
-
Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
-
diff --git a/MP.RIOC/Resources/VersNum.txt b/MP.RIOC/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.RIOC/Resources/VersNum.txt
+++ b/MP.RIOC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.RIOC/Resources/manifest.xml b/MP.RIOC/Resources/manifest.xml
index 285de5c8..ac7c96f4 100644
--- a/MP.RIOC/Resources/manifest.xml
+++ b/MP.RIOC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/MP.RIOC.zip
https://nexus.steamware.net/repository/SWS/MP-RIOC/stable/LAST/ChangeLog.html
false
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index e3a4ff68..c79f76cf 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -541,7 +541,6 @@ namespace MP.SPEC.Data
public void Dispose()
{
// Clear database controller
- dbController.Dispose();
mongoController.Dispose();
redisConn.Dispose();
}
diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj
index d44879d1..697d86b5 100644
--- a/MP.Stats/MP.Stats.csproj
+++ b/MP.Stats/MP.Stats.csproj
@@ -4,7 +4,7 @@
net8.0
MP.Stats
826e877c-ba70-4253-84cb-d0b1cafd4440
- 8.16.2605.2907
+ 8.16.2605.2908
true
en
diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html
index a1e7f04e..7dac42c3 100644
--- a/MP.Stats/Resources/ChangeLog.html
+++ b/MP.Stats/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo statistiche MAPO
-
Versione: 8.16.2605.2907
+ Versione: 8.16.2605.2908
Note di rilascio:
diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt
index 9badb5e0..2fdfac52 100644
--- a/MP.Stats/Resources/VersNum.txt
+++ b/MP.Stats/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2907
+8.16.2605.2908
diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml
index f58d9206..d88310f1 100644
--- a/MP.Stats/Resources/manifest.xml
+++ b/MP.Stats/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2907
+ 8.16.2605.2908
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip
https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html
false
diff --git a/Refactor_Plan.md b/Refactor_Plan.md
index a6679d5d..52293576 100644
--- a/Refactor_Plan.md
+++ b/Refactor_Plan.md
@@ -36,9 +36,28 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- Analisi di `MpDataService.cs` effettuata.
- Identificati i metodi con caching manuale (Redis/DB) e quelli già migrati a `GetOrFetchAsync`.
+# Piano di Refactoring: Migrazione a FusionCache in `MpDataService.cs`
+
+Stiamo lavorando sul progetto MP-SPEC.sln, dentro la cartella MP-SPEC (ed i progetti da cui dipende).
+
+Voglio ottimizzare il file Data\MpDataService.cs
+
+## Obiettivo
+Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCache` per implementare un approccio multi-layer (Memory + Redis + DB), standardizzando l'accesso ai dati.
+
+## Strategia di Migrazione
+- **Metodo Standard**: `GetOrFetchAsync(string operationName, string cacheKey, Func> fetchFunc, TimeSpan expiration, params string[] tagList)`.
+- **Invalidazione**: Utilizzare i tag tramite `FlushCacheByTagsAsync`.
+
+## Stato Avanzamento
+
+### Fase 1: Analisi e Mapping (Completata)
+- Analisi di `MpDataService.cs` effettuata.
+- Identificati i metodi con caching manuale (Redis/DB) e quelli già migrati a `GetOrFetchAsync`.
+
### Fase 2: Refactoring Metodi di Lettura (Cache-aside) (In corso)
-#### ✅ Metodi Migrati (Usano già `GetOrFetchAsync`)
+#### ✅ Metodi Migrati (Usano già `GetOrFetchAsync` o `FusionCache.GetOrSet`)
- `AnagEventiGeneralAsync`
- `AnagStatiCommAsync`
- `AnagTipoArtLvAsync`
@@ -70,6 +89,7 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- `StatoMacchinaAsync`
- `TksScoreAsync`
- `WipKitFiltAsync`
+- `Traduci` (Migrato con `GetOrSet` su dizionario lingua)
#### 🛠️ Metodi da Migrare (Usano ancora Redis/DB manuale)
- [ ] Migrazione di `ActionGetReq` (linea 110: usa `redisDb.StringGetAsync`).
@@ -88,7 +108,18 @@ Migrare la logica di caching manuale (Redis + DB) verso l'utilizzo di `IFusionCa
- [ ] Migrazione di `POdlListByKitParent` (linea 1863: usa `redisDb.StringGet` e `StringSet`).
- [ ] Migrazione di `ProcFLStats` (linea 1992: usa `redisDb.StringSet`).
- [ ] Migrazione di `RecDbMaintStat` (linea 2451: usa `redisDb.StringSet`).
-- [ ] Migrazione di `VocabolarioGetAll` (linea 2278: usa `redisDb.StringGet` e `StringSet`).
+
+*(Nota: Il vecchio metodo `VocabolarioGetAll` e la gestione manuale del dizionario sono stati rimossi in favore di `Traduci` con FusionCache).*
+
+### Fase 4: Verifica
+- [ ] Verificare la compilazione della soluzione tramite script PowerShell.
+- [ ] Controllare che i log (NLog) continuano a riflettere correttamente le operazioni.
+
+## Rischi e Mitigazioni
+- **Rischio**: Discrepanza nelle chiavi di cache tra vecchio e nuovo sistema.
+ - *Mitigazione*: Utilizzare rigorosamente le costanti in `Utils.redis...` per garantire che le chiavi siano identiche o gestite dal nuovo sistema.
+- **Rischio**: Errori di serializzazione.
+ - *Mitigazione*: `FusionCache` gestisce la serializzazione, ma è necessario assicurarsi che i tipi di ritorno siano compatibili con le aspettative dei chiamanti.
### Fase 4: Verifica
- [ ] Verificare la compilazione della soluzione tramite script PowerShell.