diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index f39426ae..d7081f32 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -6,6 +6,7 @@ using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
+using System.Data;
using System.Linq;
using System.Threading.Tasks;
@@ -332,7 +333,7 @@ namespace MP.Data.Controllers
///
/// Elenco giacenze
///
- /// record dossier da eliminare
+ /// id odl da cercare
///
public List ListGiacenze(int IdxOdl)
{
@@ -344,7 +345,8 @@ namespace MP.Data.Controllers
dbResult = dbCtx
.DbGiacenzeData
.AsNoTracking()
- .Where(x => x.IdxOdl == IdxOdl).ToList();
+ .Where(x => x.IdxOdl == IdxOdl)
+ .ToList();
}
catch (Exception exc)
{
@@ -353,6 +355,29 @@ namespace MP.Data.Controllers
}
return dbResult;
}
+ ///
+ /// Elenco TUTTI GLI ODL
+ ///
+ ///
+ public List ListOdlAll()
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ try
+ {
+ dbResult = dbCtx
+ .DbSetODL
+ .AsNoTracking()
+ .ToList();
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}");
+ }
+ }
+ return dbResult;
+ }
///
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
diff --git a/MP.Data/DatabaseModels/AnagGiacenzeModel.cs b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs
index da8dff3b..3b001a78 100644
--- a/MP.Data/DatabaseModels/AnagGiacenzeModel.cs
+++ b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs
@@ -26,6 +26,5 @@ namespace MP.Data.DatabaseModels
public double QtyTot { get; set; } = 0;
public int NumPack { get; set; } = 0;
public string Notes { get; set; } = "";
-
}
}
diff --git a/MP.INVE/Data/MpDataService.cs b/MP.INVE/Data/MpDataService.cs
deleted file mode 100644
index 4e6329a8..00000000
--- a/MP.INVE/Data/MpDataService.cs
+++ /dev/null
@@ -1,1319 +0,0 @@
-using MP.Data;
-using MP.Data.Conf;
-using MP.Data.DatabaseModels;
-using MP.Data.DTO;
-using Newtonsoft.Json;
-using NLog;
-using StackExchange.Redis;
-using System.Diagnostics;
-
-namespace MP.INVE.Data
-{
- public class MpDataService : IDisposable
- {
- #region Public Constructors
-
- public MpDataService(IConfiguration configuration, ILogger logger)
- {
- _logger = logger;
- _logger.LogInformation("Starting MpDataService INIT");
- _configuration = configuration;
-
- // setup compoenti REDIS
- redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis"));
- redisConnAdmin = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("RedisAdmin"));
- redisDb = redisConn.GetDatabase();
-
- // leggo cache lungo periodo
- int.TryParse(_configuration.GetValue("ServerConf:redisLongTimeCache"), out redisLongTimeCache);
-
- _logger.LogInformation("Redis INIT");
-
- // conf DB
- string connStr = _configuration.GetConnectionString("Mp.Data");
- if (string.IsNullOrEmpty(connStr))
- {
- _logger.LogError("DbController: ConnString empty!");
- }
- else
- {
- dbController = new MP.Data.Controllers.MpSpecController(configuration);
- _logger.LogInformation("DbController OK");
- }
- }
-
- #endregion Public Constructors
-
- #region Public Properties
-
- public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!;
-
- ///
- /// Dizionario dei tag configurati per IOB
- ///
- public Dictionary> currTagConf { get; set; } = new Dictionary>();
-
- #endregion Public Properties
-
- #region Public Methods
-
- public async Task> AnagStatiComm()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- List? result = new List();
- // cerco in redis...
- RedisValue rawData = await redisDb.StringGetAsync(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 Task.FromResult(dbController.AnagStatiComm());
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(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;
- }
-
- 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(redisTipoArt);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.AnagTipoArtLV());
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(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 = redisArtByDossier;
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.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(AnagArticoli currRec)
- {
- bool fatto = await dbController.ArticoliDeleteRecord(currRec);
- await resetCacheArticoli();
- return fatto;
- }
-
- ///
- /// Restitusice elenco articoli cercati
- ///
- ///
- ///
- ///
- public async Task> ArticoliGetSearch(int numRecord, string azienda, string searchVal)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisArtList}:{azienda}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, 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($"ArticoliGetSearch | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Aggiornamento record selezionato
- ///
- ///
- ///
- public async Task ArticoliUpdateRecord(AnagArticoli currRec)
- {
- bool fatto = await dbController.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;
- string 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...
- string 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 = dbController.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;
- }
-
- public async Task> ConfigGetAll()
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- List? result = new List();
- // cerco in redis...
- RedisValue rawData = await redisDb.StringGetAsync(redisConfKey);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ConfigGetAll Read from REDIS: {ts.TotalMilliseconds}ms");
- }
- else
- {
- result = await Task.FromResult(dbController.ConfigGetAll());
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(redisConfKey, rawData, getRandTOut(redisLongTimeCache));
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ConfigGetAll Read from DB: {ts.TotalMilliseconds}ms");
- }
- if (result == null)
- {
- result = new List();
- }
- return result;
- }
-
- ///
- /// Restituisce valore della stringa (SE disponibile)
- ///
- ///
- ///
- public async Task tryGetConfig(string keyName)
- {
- string answ = "";
- // preselezione valori
- var configData = await ConfigGetAll();
- var currRec = configData.FirstOrDefault(x => x.Chiave == keyName);
- if (currRec != null)
- {
- answ = currRec.Valore;
- }
-
- return answ;
- }
-
-
-
- ///
- /// Reset dati cache config
- ///
- ///
- public async Task ConfigResetCache()
- {
- await redisDb.StringSetAsync(redisConfKey, "");
- }
-
- ///
- /// Update chiave config
- ///
- ///
- public async Task ConfigUpdate(ConfigModel updRec)
- {
- return await Task.FromResult(dbController.ConfigUpdate(updRec));
- }
-
- public void Dispose()
- {
- // Clear database controller
- dbController.Dispose();
- redisConn.Dispose();
- }
-
- ///
- /// 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 dbController.DossiersDeleteRecord(selRecord);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
- bool answ = await ExecFlushRedisPattern(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
- ///
- public async Task> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisDossByMac}:{IdxMacchina}:{CodArticolo}:{DtStart:yyyyMMddHHmm}:{DtEnd:yyyyMMddHHmm}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.DossiersGetLastFilt(IdxMacchina, CodArticolo, DtStart, DtEnd));
- // 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($"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 dbController.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 DossiersTakeParamsSnapshot(string IdxMacchina, int MaxSec, DateTime DtRif)
- {
- bool answ = false;
- await Task.Delay(1);
- // chiamo stored x salvare parametri
- dbController.DossiersTakeParamsSnapshot(IdxMacchina, MaxSec, DtRif);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
- answ = await ExecFlushRedisPattern(pattern);
- Log.Info($"Svuotata cache dossier | {pattern}");
- 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
- dbController.DossiersTakeParamsSnapshotLast(IdxMacchina, dtMin, dtMax);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{redisDossByMac}:*");
- answ = await ExecFlushRedisPattern(pattern);
- Log.Info($"Svuotata cache dossier | {pattern}");
- return answ;
- }
-
- ///
- /// Update valore dossier
- ///
- ///
- ///
- public async Task DossiersUpdateValore(DossierModel currDoss)
- {
- // aggiorno record sul DB
- bool answ = await dbController.DossiersUpdateValore(currDoss);
-
- return answ;
- }
-
- ///
- /// Restitusice elenco aziende
- ///
- ///
- public Task> ElencoAziende()
- {
- return Task.FromResult(dbController.AnagGruppiAziende());
- }
-
- ///
- /// Restitusice elenco fasi
- ///
- ///
- public Task> ElencoGruppiFase()
- {
-#if false
- return Task.FromResult(dbController.AnagGruppiFase());
-#endif
- List result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisAnagGruppi}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = dbController.AnagGruppiFase();
- // 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($"ElencoGruppiFase | Read from {readType}: {ts.TotalMilliseconds}ms");
- return Task.FromResult(result);
- }
-
- public Task> ElencoLink()
- {
- return Task.FromResult(dbController.ElencoLink());
- }
-
- ///
- /// Aggiunta record EventList
- ///
- ///
- ///
- public async Task EvListInsert(EventListModel newRec)
- {
- return await dbController.EvListInsert(newRec);
- }
-
- public async Task FlushRedisCache()
- {
- await Task.Delay(1);
- RedisValue pattern = new RedisValue($"{redisBaseAddr}*");
- bool answ = await ExecFlushRedisPattern(pattern);
- // rileggo vocabolario.,..
- ObjVocabolario = VocabolarioGetAll();
- 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, int redisCacheSec)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisFluxLogFilt}:{IdxMacchina}:{CodFlux}:{MaxRec}:{DtMax:yyyyMMddHHmm}:{DtMin:yyyyMMddHHmm}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec));
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"FluxLogGetLastFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Elenco setup dei tag conf correnti
- ///
- ///
- public Task>> getAllTags()
- {
- return Task.FromResult(currTagConf);
- }
-
- public List getFluxLog(string Valore)
- {
- List answ = new List();
- DossierFluxLogDTO? result = JsonConvert.DeserializeObject(Valore);
- if (result != null)
- {
- if (result.ODL != null)
- {
- answ = result
- .ODL
- .OrderBy(x => x.CodFlux)
- .ToList();
- // inizializzo SE necessario
- foreach (var item in answ)
- {
- item.ValoreEdit = String.IsNullOrEmpty(item.ValoreEdit) ? item.Valore : item.ValoreEdit;
- }
- }
- }
- return answ;
- }
-
- ///
- /// restituisce il valore da REDIS associato al tag richeisto
- ///
- /// Chiave in cui cercare il valore
- ///
- public string getTagConf(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 ODL filtrati x stato, articolo, KeyRich (che contiene stato)
- ///
- /// Stato ODL: true=in corso/completato
- /// Cod articolo
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- /// Reparto selezionato
- /// Macchina selezionata
- /// Data inizio
- /// Data fine
- ///
- public async Task> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string Reparto, string IdxMacchina, DateTime startDate, DateTime endDate)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisOdlList}:{inCorso}:{codArt}:{keyRichPart}:{Reparto}:{IdxMacchina}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, 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($"ListODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
-
-
- //return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate));
- }
-
- ///
- /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
- ///
- /// Cod articolo
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- ///
- public async Task> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisPOdlList}:{lanciato}:{keyRichPart}:{idxMacchina}:{codGruppo}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ListPODLFilt(lanciato, keyRichPart, idxMacchina, codGruppo));
- // 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($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
-
- ///
- /// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato)
- ///
- /// Cod articolo
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
- ///
- public async Task> ListPODLFiltNOOdl(string codArt, string keyRichPart)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisPOdlListNOOdl}:{codArt}:{keyRichPart}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ListPODLFiltNOOdl(codArt, keyRichPart));
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
- }
- if (result == null)
- {
- result = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Elenco di tutte le macchine gestite
- ///
- ///
- public async Task> MacchineGetAll()
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = redisMacList;
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.MacchineGetAll());
- // 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($"MacchineGetAll | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Elenco id 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 = $"{redisMacByFlux}:{dtStart:yyyyMMddHHmm}:{dtEnd:yyyyMMddHHmm}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await dbController.MacchineWithFlux(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;
- }
-
- ///
- /// 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 ConfigGetAll();
- 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 dbController.ODLClose(idxOdl, idxMacchina, matrOpr, confPezzi, confRett, modoConfProd);
- }
-
- return fatto;
- }
-
- ///
- /// Record ODL da chaive
- ///
- ///
- public async Task OdlGetByKey(int IdxOdl)
- {
- await Task.Delay(1);
- var dbResult = dbController.OdlGetByKey(IdxOdl);
- return dbResult;
- }
-
- ///
- /// ODL correnti (tutti)
- ///
- ///
- ///
- public List OdlGetCurrent()
- {
- List? dbResult = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisOdlCurrByMac}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- try
- {
- dbResult = JsonConvert.DeserializeObject>($"{rawData}");
- }
- catch
- { }
- readType = "REDIS";
- }
- else
- {
- dbResult = dbController.OdlGetCurrent().Select(x => x.IdxMacchina).Distinct().ToList();
- rawData = JsonConvert.SerializeObject(dbResult);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
- }
- if (dbResult == null)
- {
- dbResult = new List();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"OdlGetCurrent | Read from {readType}: {ts.TotalMilliseconds}ms");
-
- return dbResult;
- }
-
- ///
- /// Elenco di tutti i parametri filtrati x macchina
- ///
- /// * = tutte, altrimenti solo x una data macchina
- ///
- public async Task> ParametriGetFilt(string IdxMacchina)
- {
- List? result = new List();
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisFluxByMac}:{IdxMacchina}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
- // 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($"ParametriGetFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
- return result;
- }
-
- ///
- /// Recupero PODL da chiave
- ///
- ///
- ///
- public async Task PODL_getByKey(int idxPODL)
- {
- PODLModel result = new PODLModel();
- if (idxPODL != 0)
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisPOdlByPOdl}:{idxPODL}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = await dbController.PODL_getByKey(idxPODL);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new PODLModel();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
- }
- else
- {
- Log.Debug("Errore IdxPODL = 0");
- }
- return result;
- }
-
- ///
- /// Recupero PODL da IdxODL
- ///
- ///
- ///
- public PODLModel PODL_getByOdl(int idxODL)
- {
- PODLModel result = new PODLModel();
- if (idxODL != 0)
- {
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- string readType = "DB";
- string currKey = $"{redisPOdlByOdl}:{idxODL}";
- // cerco in redis dato valore sel macchina...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject($"{rawData}");
- readType = "REDIS";
- }
- else
- {
- result = dbController.PODL_getByOdl(idxODL);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new PODLModel();
- }
- stopWatch.Stop();
- TimeSpan ts = stopWatch.Elapsed;
- Log.Trace($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
- }
- else
- {
- Log.Debug("Errore IdxODL = 0");
- }
- return result;
- }
-
- ///
- /// Eliminazione record selezionato
- ///
- ///
- ///
- public async Task PODLDeleteRecord(PODLExpModel currRec)
- {
- return await dbController.PODLDeleteRecord(currRec);
- }
-
- ///
- /// Avvio fase setup per il record selezionato
- ///
- ///
- ///
- public async Task POdlDoSetup(PODLExpModel currRec)
- {
- return await dbController.PODL_startSetup(currRec, 0, 1, 1, "");
- }
-
- ///
- /// Aggiornamento record selezionato
- ///
- ///
- ///
- public async Task POdlUpdateRecord(PODLExpModel currRec)
- {
- var dbResult = await dbController.PODLUpdateRecord(currRec);
- // elimino cache redis...
- RedisValue pattern = new RedisValue($"{redisPOdlList}:*");
- bool answ = await ExecFlushRedisPattern(pattern);
-
- return dbResult;
- }
-
- ///
- /// Statistiche ODL calcolate (da stored stp_STAT_ODL)
- ///
- ///
- public Task> StatOdl(int IdxOdl)
- {
- return dbController.OdlStart(IdxOdl);
- }
-
- ///
- /// 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 = getFluxLog(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 valore
- 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 dbController.DossiersUpdateValore(currDoss);
- }
-
- return answ;
- }
-
- ///
- /// 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(redisVocabolario);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- }
- else
- {
- result = dbController.VocabolarioGetAll();
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(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 Protected Fields
-
- protected Random rand = new Random();
-
- #endregion Protected Fields
-
- #region Protected Methods
-
- ///
- /// Restituisce un timeout dai minuti richiesti + tempo random 1..60 sec
- ///
- ///
- ///
- protected TimeSpan getRandTOut(int stdMinutes)
- {
- double rndValue = (double)stdMinutes + (double)rand.Next(1, 60) / 60;
- return TimeSpan.FromMinutes(rndValue);
- }
-
- #endregion Protected Methods
-
- #region Private Fields
-
- private const string redisAnagGruppi = redisBaseAddr + "SPEC:Cache:AnagGruppi";
-
- private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier";
-
- private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList";
-
- private const string redisBaseAddr = "MP:";
-
- private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config";
-
- private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac";
-
- private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac";
-
- private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt";
-
- private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux";
-
- private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
-
- private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac";
- private const string redisOdlList = redisBaseAddr + "SPEC:Cache:OdlList";
-
- private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl";
- private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl";
- private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList";
- private const string redisPOdlListNOOdl = redisBaseAddr + "SPEC:Cache:POdlListNOOdl";
- private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
-
- private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
-
- private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario";
-
- private static IConfiguration _configuration = null!;
-
- private static ILogger _logger = null!;
-
- private static Logger Log = LogManager.GetCurrentClassLogger();
-
- ///
- /// Oggetto vocabolario x uso continuo traduzione
- ///
- private List ObjVocabolario = new List();
-
- ///
- /// Oggetto per connessione a REDIS
- ///
- private ConnectionMultiplexer redisConn = null!;
-
- ///
- /// Oggetto per connessione a REDIS modalità admin (ex flux dati)
- ///
- private ConnectionMultiplexer redisConnAdmin = null!;
-
- ///
- /// Oggetto DB redis da impiegare x chiamate R/W
- ///
- private IDatabase redisDb = null!;
-
- private int redisLongTimeCache = 5;
- private int redisShortTimeCache = 4;
-
- #endregion Private Fields
-
- #region Private Methods
-
- ///
- /// Esegue flush memoria redis dato pattern
- ///
- ///
- ///
- private async Task ExecFlushRedisPattern(RedisValue pattern)
- {
- bool answ = false;
- var listEndpoints = redisConnAdmin.GetEndPoints();
- foreach (var endPoint in listEndpoints)
- {
- //var server = redisConnAdmin.GetServer(listEndpoints[0]);
- var server = redisConnAdmin.GetServer(endPoint);
- if (server != null)
- {
- var keyList = server.Keys(redisDb.Database, pattern);
- foreach (var item in keyList)
- {
- await redisDb.KeyDeleteAsync(item);
- }
- // brutalmente rimuovo intero contenuto DB... DANGER
- //await server.FlushDatabaseAsync();
- answ = true;
- }
- }
-
- return answ;
- }
-
- private async Task resetCacheArticoli()
- {
- RedisValue pattern = new RedisValue($"{redisArtByDossier}:*");
- await ExecFlushRedisPattern(pattern);
- pattern = new RedisValue($"{redisArtList}:*");
- await ExecFlushRedisPattern(pattern);
- }
-
- #endregion Private Methods
- }
-}
\ No newline at end of file
diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj
index 1eeb772f..2988c20a 100644
--- a/MP.INVE/MP.INVE.csproj
+++ b/MP.INVE/MP.INVE.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.INVE
- 6.16.2211.2815
+ 6.16.2211.2916
diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html
index 1646c9be..33a30497 100644
--- a/MP.INVE/Resources/ChangeLog.html
+++ b/MP.INVE/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOINVE
- Versione: 6.16.2211.2815
+ Versione: 6.16.2211.2916
Note di rilascio:
-
diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt
index 45da9bb2..20db0176 100644
--- a/MP.INVE/Resources/VersNum.txt
+++ b/MP.INVE/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2211.2815
+6.16.2211.2916
diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml
index 29fb6552..a6165706 100644
--- a/MP.INVE/Resources/manifest.xml
+++ b/MP.INVE/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2211.2815
+ 6.16.2211.2916
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.SPEC/Components/ListGiacenze.razor b/MP.SPEC/Components/ListGiacenze.razor
new file mode 100644
index 00000000..72f5337f
--- /dev/null
+++ b/MP.SPEC/Components/ListGiacenze.razor
@@ -0,0 +1,61 @@
+
+
+
+
+ | Id Giacenza |
+ IdentRG |
+ Prodotto |
+ Tipo |
+ Fornitore |
+ Data riferimento |
+ ExtDoc |
+ Quantita totale |
+ Numero pacchetti |
+ Note |
+
+
+
+ @if (elencoGiacenze != null)
+ {
+ @foreach (var item in elencoGiacenze)
+ {
+
+
+ |
+ @item.IdxRG
+ |
+
+ @item.IdentRG
+ |
+
+
+ @item.Product
+ |
+
+
+ @item.Variety
+ |
+
+ @item.Supplier
+ |
+
+ @item.DateRif
+ |
+
+ @item.ExtDoc
+ |
+
+ @item.QtyTot
+ |
+
+ @item.NumPack
+ |
+
+ @item.Notes
+ |
+
+
+ }
+ }
+
+
diff --git a/MP.SPEC/Components/ListGiacenze.razor.cs b/MP.SPEC/Components/ListGiacenze.razor.cs
new file mode 100644
index 00000000..408b7210
--- /dev/null
+++ b/MP.SPEC/Components/ListGiacenze.razor.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Components;
+using System.Net.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Components.Authorization;
+using Microsoft.AspNetCore.Components.Forms;
+using Microsoft.AspNetCore.Components.Routing;
+using Microsoft.AspNetCore.Components.Web;
+using Microsoft.AspNetCore.Components.Web.Virtualization;
+using Microsoft.JSInterop;
+using MP.SPEC;
+using MP.SPEC.Shared;
+using MP.SPEC.Components;
+using Microsoft.AspNetCore.WebUtilities;
+using MP.Data.DatabaseModels;
+using MP.SPEC.Data;
+using Blazored.SessionStorage;
+
+namespace MP.SPEC.Components
+{
+ public partial class ListGiacenze
+ {
+ [Inject]
+ MpDataService MDService { get; set; } = null!;
+
+ [Inject]
+ NavigationManager NavManager { get; set; } = null!;
+
+ [Inject]
+ ISessionStorageService sessionStorage { get; set; } = null!;
+
+ protected List? elencoGiacenze;
+
+ [Parameter]
+ public int IdxOdl { get; set; } = 0;
+
+ protected override async Task OnInitializedAsync()
+ {
+ elencoGiacenze = await MDService.ListGiacenze(IdxOdl);
+ }
+ }
+}
\ No newline at end of file
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 36b8a481..e694bcb4 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -734,10 +734,10 @@ namespace MP.SPEC.Data
Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
+
///
- /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato)
///
- /// Solo lanciati (1) o ancora disponibili (0)
+ /// id odl da cercare
///
public async Task> ListGiacenze(int IdxOdl)
{
@@ -769,46 +769,43 @@ namespace MP.SPEC.Data
Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
-
-#if false
-
///
- /// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato)
+ /// elenco TUTTI gli ODL
///
- /// Cod articolo
- /// KeyRich (parziale) da cercare (es cod stato x yacht)
+ ///
///
- public async Task> ListPODLFiltNOOdl(string codArt, string keyRichPart)
+ public List ListOdlAll()
{
- List? result = new List();
+ List? result = new List();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
- string currKey = $"{redisPOdlListNOOdl}:{codArt}:{keyRichPart}";
+#if false
+ string currKey = $"{redisGiacenzaList}:{IdxOdl}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
- result = JsonConvert.DeserializeObject>($"{rawData}");
+ result = JsonConvert.DeserializeObject>($"{rawData}");
readType = "REDIS";
}
else
{
- result = await Task.FromResult(dbController.ListPODLFiltNOOdl(codArt, keyRichPart));
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
+ redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
}
if (result == null)
{
- result = new List();
- }
+ result = new List();
+ }
+#endif
+ result = dbController.ListOdlAll();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
- Log.Debug($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms");
+ Log.Debug($"ListOdlAll | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
- }
-#endif
+ }
///
/// Elenco di tutte le macchine gestite
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index a4ce8b5e..0be92b1d 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 6.16.2211.2912
+ 6.16.2211.2916
@@ -28,6 +28,7 @@
+
diff --git a/MP.SPEC/Pages/Giacenze.razor b/MP.SPEC/Pages/Giacenze.razor
index 99fbb5ec..fc1fdae4 100644
--- a/MP.SPEC/Pages/Giacenze.razor
+++ b/MP.SPEC/Pages/Giacenze.razor
@@ -3,77 +3,15 @@
-
-
-
- | IdxRG |
- IdxOdl |
- IdentRG |
- Product |
- Variety |
- Supplier |
- ExtDoc |
- DateRif |
- QtyTot |
- NumPack |
- Notes |
-
-
-
- @if (elencoGiacenze != null)
- {
- @foreach (var item in elencoGiacenze)
- {
-
-
- |
- @item.IdxRG
- |
-
- @item.IdxOdl
- |
-
- @item.IdentRG
- |
-
-
- @item.Product
- |
-
-
- @item.Variety
- |
-
- @item.Supplier
- |
-
- @item.ExtDoc
- |
-
-
- @item.DateRif
- |
-
- @item.QtyTot
- |
-
- @item.NumPack
- |
-
- @item.Notes
- |
-
-
-
- }
- }
-
-
+
diff --git a/MP.SPEC/Pages/Giacenze.razor.cs b/MP.SPEC/Pages/Giacenze.razor.cs
index 4d799bc1..a4ec97fb 100644
--- a/MP.SPEC/Pages/Giacenze.razor.cs
+++ b/MP.SPEC/Pages/Giacenze.razor.cs
@@ -17,6 +17,7 @@ using MP.SPEC.Components;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using Microsoft.AspNetCore.WebUtilities;
+using Blazored.SessionStorage;
namespace MP.SPEC.Pages
{
@@ -25,22 +26,27 @@ namespace MP.SPEC.Pages
[Inject]
MpDataService MDService { get; set; } = null!;
+ [Inject]
+ ISessionStorageService sessionStorage { get; set; } = null!;
+
[Inject]
NavigationManager NavManager { get; set; } = null!;
- protected List? elencoGiacenze;
+ protected List? elencoOdl;
- protected int IdxOdl = 0;
+ protected ODLModel? odlExp;
+ protected int IdxOdl { get; set; } = 0;
protected override async Task OnInitializedAsync()
{
+ await Task.Delay(1);
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl))
{
IdxOdl = int.Parse(_idxOdl);
}
-
- elencoGiacenze = await MDService.ListGiacenze(IdxOdl);
+ elencoOdl = MDService.ListOdlAll();
+ odlExp = elencoOdl.Where(o => (o.IdxOdl == IdxOdl)).SingleOrDefault();
}
}
diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs
index acb4bdc5..13deb26f 100644
--- a/MP.SPEC/Program.cs
+++ b/MP.SPEC/Program.cs
@@ -1,4 +1,5 @@
using Blazored.LocalStorage;
+using Blazored.SessionStorage;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
@@ -40,6 +41,7 @@ builder.Services.AddSingleton(redisMultiplexer);
builder.Services.AddSingleton();
builder.Services.AddScoped();
builder.Services.AddBlazoredLocalStorage();
+builder.Services.AddBlazoredSessionStorage();
builder.Services.AddHttpClient();
builder.Services.AddSingleton();
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index 63edddad..bcb24292 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 6.16.2211.2912
+ Versione: 6.16.2211.2916
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index d37a13af..20db0176 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2211.2912
+6.16.2211.2916
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index 715bc2cd..a6e07c4b 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2211.2912
+ 6.16.2211.2916
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip
https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html
false