TAB3:
- levati molti metodi async dove non necessari x speedup pagina status-map
This commit is contained in:
@@ -101,14 +101,14 @@ namespace MP_TAB3.Components
|
||||
await EA_ReloadMStor.InvokeAsync(true);
|
||||
// calcolo tempo esecuzione
|
||||
sw.Stop();
|
||||
int delta = 500 - (int)sw.ElapsedMilliseconds;
|
||||
int delta = 250 - (int)sw.ElapsedMilliseconds;
|
||||
delta = delta > 0 ? delta : 50;
|
||||
await Task.Delay(delta);
|
||||
ResetClass = "btn-primary";
|
||||
// await InvokeAsync(StateHasChanged);
|
||||
Log.Info($"ForceReload completed in {sw.Elapsed.TotalMilliseconds}ms");
|
||||
// ricarica pagina!
|
||||
NavMan.NavigateTo("status-map");
|
||||
NavMan.NavigateTo("status-map", true);
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
||||
@@ -316,14 +316,17 @@ namespace MP_TAB3.Components
|
||||
/// <returns></returns>
|
||||
public string ImgUrlMacc(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(imgBasePath))
|
||||
{
|
||||
// se configurata uso cartella virtuale... altrimenti cartella processo
|
||||
string baseUrl = config.GetValue<string>("SpecialConf:AppUrl") ?? (config.GetValue<string>("OptConf:AppUrl") ?? "");
|
||||
imgBasePath = $"{baseUrl}/macchine";
|
||||
}
|
||||
if (string.IsNullOrEmpty(url.ToString()))
|
||||
{
|
||||
url = "Steamware.png";
|
||||
}
|
||||
string fullPath = $"{imgBasePath}/{url}";
|
||||
#if false
|
||||
string fullPath = Path.Combine(imgBasePath, url);
|
||||
#endif
|
||||
return fullPath;
|
||||
}
|
||||
|
||||
@@ -360,17 +363,6 @@ namespace MP_TAB3.Components
|
||||
TabDServ.ConfigGetVal("TAB_ShowQtaExtra", ref showQtaExtra);
|
||||
await ReloadXDL(true);
|
||||
// se configurata uso cartella virtuale... altrimenti cartella processo
|
||||
#if false
|
||||
var sImgBasePath = config.GetValue<string>("ServerConf:ImgBasePath") ?? (config.GetValue<string>("OptConf:ImgBasePath") ?? "");
|
||||
if (!string.IsNullOrEmpty(sImgBasePath))
|
||||
{
|
||||
imgBasePath = sImgBasePath;
|
||||
}
|
||||
else
|
||||
{
|
||||
imgBasePath = $"{Environment.CurrentDirectory}/images/";
|
||||
}
|
||||
#endif
|
||||
string baseUrl = config.GetValue<string>("SpecialConf:AppUrl") ?? (config.GetValue<string>("OptConf:AppUrl") ?? "");
|
||||
imgBasePath = $"{baseUrl}/macchine";
|
||||
await loadDetails();
|
||||
@@ -381,6 +373,12 @@ namespace MP_TAB3.Components
|
||||
{
|
||||
// controllo variazione parametri...
|
||||
string lastIMS = LastIdxMacchSub;
|
||||
if (string.IsNullOrEmpty(imgBasePath))
|
||||
{
|
||||
// se configurata uso cartella virtuale... altrimenti cartella processo
|
||||
string baseUrl = config.GetValue<string>("SpecialConf:AppUrl") ?? (config.GetValue<string>("OptConf:AppUrl") ?? "");
|
||||
imgBasePath = $"{baseUrl}/macchine";
|
||||
}
|
||||
if (paramsChanged())
|
||||
{
|
||||
saveParams();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2503.2717</Version>
|
||||
<Version>6.16.2503.2719</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
<meta name="author" content="EgalWare" />
|
||||
<link rel="shortcut icon" href="images/favicon.ico" />
|
||||
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
||||
<base href="~/" />
|
||||
@* <base href="~/" /> *@
|
||||
<link rel="stylesheet" href="lib/font-awesome/css/all.min.css" />
|
||||
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/font.min.css" />
|
||||
<link rel="stylesheet" href="css/site.css" />
|
||||
<link rel="stylesheet" href="css/site.min.css" />
|
||||
<link rel="stylesheet" href="MP-TAB3.styles.css" />
|
||||
<component type="typeof(HeadOutlet)" render-mode="Server" />
|
||||
</head>
|
||||
@@ -38,9 +38,7 @@
|
||||
|
||||
<script src="lib/Utils.js"></script>
|
||||
<script src="lib/WindowSize.js"></script>
|
||||
<script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
|
||||
|
||||
@* <script src="_framework/blazor.server.js"></script> *@
|
||||
<script src="lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
@*Gestione autoriconnessione: https://github.com/dotnet/aspnetcore/issues/38305 (vedere anche https://docs.microsoft.com/it-it/aspnet/core/blazor/fundamentals/signalr?view=aspnetcore-6.0#modify-the-reconnection-handler-blazor-server)*@
|
||||
<script src="_framework/blazor.server.js" autostart="false"></script>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2503.2717</h4>
|
||||
<h4>Versione: 6.16.2503.2719</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2503.2717
|
||||
6.16.2503.2719
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2503.2717</version>
|
||||
<version>6.16.2503.2719</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1439,6 +1439,37 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero PODL da chiave
|
||||
/// </summary>
|
||||
/// <param name="idxPODL"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<PODLExpModel> PODLExp_getByKeyAsync(int idxPODL)
|
||||
{
|
||||
PODLExpModel dbResult = new PODLExpModel();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxPromessa = new SqlParameter("@IdxPromessa", idxPODL);
|
||||
var rawResult = await dbCtx
|
||||
.DbSetPODLExp
|
||||
.FromSqlRaw("EXEC stp_PODL_getByIdx @IdxPromessa", IdxPromessa)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
if (rawResult != null && rawResult.Count > 0)
|
||||
{
|
||||
dbResult = rawResult.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante PODLExp_getByKeyAsync{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce elenco RC filtrato
|
||||
/// </summary>
|
||||
|
||||
@@ -1339,13 +1339,18 @@ namespace MP.Data.Services
|
||||
/// <returns></returns>
|
||||
public async Task<ODLExpModel> OdlByIdx(int idxOdl, bool onlyUnused)
|
||||
{
|
||||
int rndWait = rnd.Next(0, 3);
|
||||
await Task.Delay(rndWait);
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ODLExpModel result = new ODLExpModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxOdl}:{onlyUnused}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
#if false
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
#endif
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
@@ -1353,11 +1358,17 @@ namespace MP.Data.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlByIdx(idxOdl, onlyUnused));
|
||||
var listRes = dbTabController.OdlByIdx(idxOdl, onlyUnused);
|
||||
#if false
|
||||
var listRes = await Task.FromResult(dbTabController.OdlByIdx(idxOdl, onlyUnused));
|
||||
#endif
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
redisDb.StringSet(currKey, rawData, FastCache);
|
||||
#if false
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
#endif
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -1398,6 +1409,9 @@ namespace MP.Data.Services
|
||||
/// <returns></returns>
|
||||
public async Task<ODLExpModel> OdlCurrByMacc(string idxMacchina, bool forceDb)
|
||||
{
|
||||
// pausa random x evitare sovrapposizioni...
|
||||
int rndWait = rnd.Next(0, 3);
|
||||
await Task.Delay(rndWait);
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
@@ -1407,7 +1421,10 @@ namespace MP.Data.Services
|
||||
{
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:CURR";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
#if false
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
#endif
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLExpModel>($"{rawData}");
|
||||
@@ -1415,11 +1432,17 @@ namespace MP.Data.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
var listRes = dbTabController.OdlCurrByMacc(idxMacchina);
|
||||
#if false
|
||||
var listRes = await Task.FromResult(dbTabController.OdlCurrByMacc(idxMacchina));
|
||||
#endif
|
||||
result = listRes.FirstOrDefault();
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
redisDb.StringSet(currKey, rawData, FastCache);
|
||||
#if false
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
#endif
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
@@ -1925,6 +1948,11 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generatore random classe
|
||||
/// </summary>
|
||||
private Random rnd = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Recupero PODL da chiave
|
||||
/// </summary>
|
||||
@@ -1933,12 +1961,26 @@ namespace MP.Data.Services
|
||||
public async Task<PODLExpModel> PODLExp_getByKey(int idxPODL)
|
||||
{
|
||||
string source = "DB";
|
||||
// pausa random x evitare sovrapposizioni...
|
||||
int rndWait = rnd.Next(0, 3);
|
||||
await Task.Delay(rndWait);
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
PODLExpModel result = new PODLExpModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:PODL:{idxPODL}";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
RedisValue rawData;
|
||||
rawData = redisDb.StringGet(currKey);
|
||||
#if false
|
||||
if (doSync)
|
||||
{
|
||||
rawData = redisDb.StringGet(currKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData = await redisDb.StringGetAsync(currKey);
|
||||
}
|
||||
#endif
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<PODLExpModel>($"{rawData}");
|
||||
@@ -1946,10 +1988,31 @@ namespace MP.Data.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbTabController.PODLExp_getByKey(idxPODL));
|
||||
result = dbTabController.PODLExp_getByKey(idxPODL);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
redisDb.StringSet(currKey, rawData, FastCache);
|
||||
#if false
|
||||
if (doSync)
|
||||
{
|
||||
result = dbTabController.PODLExp_getByKey(idxPODL);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await dbTabController.PODLExp_getByKeyAsync(idxPODL);
|
||||
}
|
||||
//result = await Task.FromResult(dbTabController.PODLExp_getByKey(idxPODL));
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
if (doSync)
|
||||
{
|
||||
redisDb.StringSet(currKey, rawData, FastCache);
|
||||
}
|
||||
else
|
||||
{
|
||||
await redisDb.StringSetAsync(currKey, rawData, FastCache);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user