tentativo fix giacenze

This commit is contained in:
zaccaria.majid
2022-11-29 17:07:47 +01:00
parent 965a6da706
commit 81a6efbc11
9 changed files with 72 additions and 8 deletions
+25
View File
@@ -355,6 +355,7 @@ namespace MP.Data.Controllers
}
return dbResult;
}
/// <summary>
/// Elenco TUTTI GLI ODL
/// </summary>
@@ -378,6 +379,30 @@ namespace MP.Data.Controllers
}
return dbResult;
}
/// <summary>
/// ODL da chiave
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato
+1
View File
@@ -10,6 +10,7 @@ using System.ComponentModel.DataAnnotations.Schema;
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("v_ODL_exp")]
public partial class ODLExpModel
{
#region Public Properties
+1 -1
View File
@@ -35,7 +35,7 @@ namespace MP.SPEC.Components
protected List<AnagGiacenzeModel>? elencoGiacenze;
[Parameter]
public int IdxOdl { get; set; } = 0;
public int IdxOdl { get; set; }
protected override async Task OnInitializedAsync()
{
+39
View File
@@ -807,6 +807,45 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// ODL da chiave
/// </summary>
/// <param name="IdxOdl"></param>
/// <returns></returns>
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<List<AnagGiacenzeModel>>($"{rawData}");
readType = "REDIS";
}
else
{
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
}
if (result == null)
{
result = new List<AnagGiacenzeModel>();
}
#endif
result = dbController.OdlByKey(IdxOdl);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"OdlByKey | Read from {readType}: {ts.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Elenco di tutte le macchine gestite
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.2916</Version>
<Version>6.16.2211.2917</Version>
</PropertyGroup>
<ItemGroup>
+2 -3
View File
@@ -34,7 +34,7 @@ namespace MP.SPEC.Pages
protected List<ODLModel>? 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);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.2916</h4>
<h4>Versione: 6.16.2211.2917</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.2916
6.16.2211.2917
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.2916</version>
<version>6.16.2211.2917</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>