diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index d7081f32..93db28f1 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -355,6 +355,7 @@ namespace MP.Data.Controllers } return dbResult; } + /// /// Elenco TUTTI GLI ODL /// @@ -378,6 +379,30 @@ namespace MP.Data.Controllers } return dbResult; } + /// + /// ODL da chiave + /// + /// + public ODLExpModel OdlByKey(int IdxOdl) + { + ODLExpModel dbResult = new ODLExpModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbSetODLExp + .AsNoTracking() + .Where(x=> x.IdxOdl == IdxOdl) + .FirstOrDefault(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante OdlByKey{Environment.NewLine}{exc}"); + } + } + return dbResult; + } /// /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato diff --git a/MP.Data/DatabaseModels/ODLExpModel.cs b/MP.Data/DatabaseModels/ODLExpModel.cs index 4975200d..dbfd429e 100644 --- a/MP.Data/DatabaseModels/ODLExpModel.cs +++ b/MP.Data/DatabaseModels/ODLExpModel.cs @@ -10,6 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema; // namespace MP.Data.DatabaseModels { + [Table("v_ODL_exp")] public partial class ODLExpModel { #region Public Properties diff --git a/MP.SPEC/Components/ListGiacenze.razor.cs b/MP.SPEC/Components/ListGiacenze.razor.cs index 408b7210..1b5496b5 100644 --- a/MP.SPEC/Components/ListGiacenze.razor.cs +++ b/MP.SPEC/Components/ListGiacenze.razor.cs @@ -35,7 +35,7 @@ namespace MP.SPEC.Components protected List? elencoGiacenze; [Parameter] - public int IdxOdl { get; set; } = 0; + public int IdxOdl { get; set; } protected override async Task OnInitializedAsync() { diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index e694bcb4..e609cb16 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -807,6 +807,45 @@ namespace MP.SPEC.Data return result; } + + /// + /// ODL da chiave + /// + /// + /// + public ODLExpModel OdlByKey(int IdxOdl) + { + ODLExpModel? result = new ODLExpModel(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; +#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}"); + readType = "REDIS"; + } + else + { + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } +#endif + result = dbController.OdlByKey(IdxOdl); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"OdlByKey | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + /// /// Elenco di tutte le macchine gestite /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 0be92b1d..fc0f74e4 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2916 + 6.16.2211.2917 diff --git a/MP.SPEC/Pages/Giacenze.razor.cs b/MP.SPEC/Pages/Giacenze.razor.cs index a4ec97fb..7b5041b0 100644 --- a/MP.SPEC/Pages/Giacenze.razor.cs +++ b/MP.SPEC/Pages/Giacenze.razor.cs @@ -34,7 +34,7 @@ namespace MP.SPEC.Pages protected List? elencoOdl; - protected ODLModel? odlExp; + protected ODLExpModel? odlExp { get; set; } = null!; protected int IdxOdl { get; set; } = 0; protected override async Task OnInitializedAsync() @@ -45,8 +45,7 @@ namespace MP.SPEC.Pages { IdxOdl = int.Parse(_idxOdl); } - elencoOdl = MDService.ListOdlAll(); - odlExp = elencoOdl.Where(o => (o.IdxOdl == IdxOdl)).SingleOrDefault(); + odlExp = MDService.OdlByKey(IdxOdl); } } diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index bcb24292..e9794914 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.2916

+

Versione: 6.16.2211.2917


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 20db0176..02a93b28 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2916 +6.16.2211.2917 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index a6e07c4b..c375d63e 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2916 + 6.16.2211.2917 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