diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index e040f492..0d2a1351 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -194,9 +194,9 @@ namespace MP.Data.Controllers
/// Elenco Gruppi tipo Fasi
///
///
- public List AnagGruppiFase()
+ public Task> AnagGruppiFaseAsync()
{
- return AnagGruppiGetTipo("FASE");
+ return AnagGruppiGetTipoAsync("FASE");
}
///
@@ -1352,24 +1352,15 @@ namespace MP.Data.Controllers
///
/// id odl da cercare
///
- public List ListGiacenze(int IdxOdl)
+ public async Task> ListGiacenzeAsync(int IdxOdl)
{
List dbResult = new List();
- using (var dbCtx = new MoonPro_InveContext(_configuration))
- {
- try
- {
- dbResult = dbCtx
- .DbGiacenzeData
- .AsNoTracking()
- .Where(x => x.IdxOdl == IdxOdl)
- .ToList();
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione durante ListGiacenze{Environment.NewLine}{exc}");
- }
- }
+ using var dbCtx = new MoonPro_InveContext(_configuration);
+ dbResult = await dbCtx
+ .DbGiacenzeData
+ .Where(x => x.IdxOdl == IdxOdl)
+ .AsNoTracking()
+ .ToListAsync();
return dbResult;
}
diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs
index 037de309..a6d463ad 100644
--- a/MP.SPEC/Components/ListDossiers.razor.cs
+++ b/MP.SPEC/Components/ListDossiers.razor.cs
@@ -230,7 +230,7 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
await MDService.ConfigResetCache();
- ListGruppiFase = MDService.ElencoGruppiFase();
+ ListGruppiFase = await MDService.ElencoGruppiFaseAsync();
ListStati = await MDService.AnagStatiCommAsync();
selAzienda = await MDService.ConfigTryGetAsync("AZIENDA");
giacenzeConf = await MDService.ConfigTryGetAsync("SPEC_ShowGiacenze");
diff --git a/MP.SPEC/Components/ListGiacenze.razor.cs b/MP.SPEC/Components/ListGiacenze.razor.cs
index 24f37bbe..542e02c7 100644
--- a/MP.SPEC/Components/ListGiacenze.razor.cs
+++ b/MP.SPEC/Components/ListGiacenze.razor.cs
@@ -42,7 +42,7 @@ namespace MP.SPEC.Components
protected override async Task OnParametersSetAsync()
{
- elencoGiacenze = await MDService.ListGiacenze(IdxOdl);
+ elencoGiacenze = await MDService.ListGiacenzeAsync(IdxOdl);
}
#endregion Protected Methods
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 4f4a43c1..9fb69510 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -652,44 +652,21 @@ namespace MP.SPEC.Data
}
///
- /// Restitusice elenco Fasi
+ /// Restituisce elenco Fasi
///
///
- public List ElencoGruppiFase()
+ public async Task> ElencoGruppiFaseAsync()
{
- using var activity = ActivitySource.StartActivity("ElencoGruppiFase");
- List result = new List();
- string source = "DB";
- string currKey = $"{Utils.redisAnagGruppi}:FASE";
- // cerco in redis dato valore sel idxMaccSel...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- var rawResult = JsonConvert.DeserializeObject>($"{rawData}");
- if (rawResult != null)
- {
- result = rawResult;
- }
- source = "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();
- }
- activity?.SetTag("data.source", source);
- activity?.SetTag("result.count", result.Count);
- activity?.Stop();
- LogTrace($"ElencoGruppiFase | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return result;
+ return await GetOrFetchAsync(
+ operationName: "ElencoGruppiFaseAsync",
+ cacheKey: $"{Utils.redisAnagGruppi}:FASE",
+ expiration: TimeSpan.FromMinutes(redisLongTimeCache / 5),
+ fetchFunc: async () => await dbController.AnagGruppiFaseAsync() ?? new List(),
+ tagList: [Utils.redisAnagGruppi]
+ );
}
+
///
/// Elenco link validi per il menu
///
@@ -1369,38 +1346,20 @@ namespace MP.SPEC.Data
}
///
+ /// Elenco giacenze filtrate x IdxOdl
///
/// id odl da cercare
///
- public async Task> ListGiacenze(int IdxOdl)
+ public async Task> ListGiacenzeAsync(int IdxOdl)
{
- using var activity = ActivitySource.StartActivity("ListGiacenze");
- List? result = new List();
- string source = "DB";
string currKey = $"{Utils.redisGiacenzaList}:{IdxOdl}";
- // cerco in redis dato valore sel idxMaccSel...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ListGiacenze(IdxOdl));
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- activity?.SetTag("data.source", source);
- activity?.SetTag("result.count", result.Count);
- activity?.Stop();
- LogTrace($"ListGiacenze | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return result;
+ return await GetOrFetchAsync(
+ operationName: "ListGiacenzeAsync",
+ cacheKey: currKey,
+ expiration: TimeSpan.FromSeconds(redisShortTimeCache),
+ fetchFunc: async () => await dbController.ListGiacenzeAsync(IdxOdl) ?? new List(),
+ tagList: [Utils.redisGiacenzaList]
+ );
}
///
@@ -3050,76 +3009,6 @@ namespace MP.SPEC.Data
await FlushCacheByTagsAsync(tags2del);
}
-#if false
- ///
- /// Update valore Dossier
- ///
- ///
- ///
- ///
- public async Task updateDossierValue(DossierModel currDoss, FluxLogDTO editFL)
- {
- using var activity = ActivitySource.StartActivity("updateDossierValue");
- string source = "DB";
- bool answ = false;
- // recupero intero set valori dossier deserializzando...
- var fluxLogList = FluxLogDtoGetByFlux(currDoss.Valore);
- // 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);
- }
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"updateDossierValue | {source} | {activity?.Duration.TotalMilliseconds}ms");
- return answ;
- }
-#endif
-#if false
- ///
- /// Elimina i record associati al keyFilt indicato
- ///
- ///
- public bool WipKitDeleteGroup(string KeyFilt)
- {
- using var activity = ActivitySource.StartActivity("WipKitDeleteGroup");
- string source = "DB";
- bool fatto = false;
- // salvo
- fatto = dbController.WipKitDeleteGroup(KeyFilt);
- // svuoto cache
- EmptyWipCache();
- activity?.SetTag("data.source", source);
- activity?.Stop();
- LogTrace($"WipKitDeleteGroup Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return fatto;
- }
-#endif
-
///
/// Reset macchine e gruppi
///
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index de389880..e9b08d76 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 8.16.2605.2808
+ 8.16.2605.2809
1800a78a-6ff1-40f9-b490-87fb8bfc1394
en
diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs
index fbc11aa7..2b759d2d 100644
--- a/MP.SPEC/Pages/ODL.razor.cs
+++ b/MP.SPEC/Pages/ODL.razor.cs
@@ -105,7 +105,7 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync()
{
await getReparto();
- var allGruppiData = MDService.ElencoGruppiFase();
+ var allGruppiData = await MDService.ElencoGruppiFaseAsync();
if (allGruppiData != null)
{
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs
index 1a6b35ac..8e866756 100644
--- a/MP.SPEC/Pages/PODL.razor.cs
+++ b/MP.SPEC/Pages/PODL.razor.cs
@@ -130,7 +130,7 @@ namespace MP.SPEC.Pages
{
await getReparto();
ListAziende = await MDService.ElencoAziendeAsync();
- var allGruppiData = MDService.ElencoGruppiFase();
+ var allGruppiData = await MDService.ElencoGruppiFaseAsync();
if (allGruppiData != null)
{
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
diff --git a/MP.SPEC/Pages/Podl2Kit.razor.cs b/MP.SPEC/Pages/Podl2Kit.razor.cs
index 9e8e270a..d2158b2d 100644
--- a/MP.SPEC/Pages/Podl2Kit.razor.cs
+++ b/MP.SPEC/Pages/Podl2Kit.razor.cs
@@ -1,12 +1,8 @@
using Microsoft.AspNetCore.Components;
-using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.JSInterop;
using MP.Data.DbModels;
using MP.Data.Services;
-using MP.SPEC.Components;
using MP.SPEC.Data;
-using NLog.Layouts;
-using System.Reflection.PortableExecutable;
namespace MP.SPEC.Pages
{
@@ -37,10 +33,6 @@ namespace MP.SPEC.Pages
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
-#if false
- [Inject]
- protected ILocalStorageService localStorage { get; set; } = null!;
-#endif
[Inject]
protected ILocalStorageService localStorage { get; set; } = null!;
@@ -59,13 +51,17 @@ namespace MP.SPEC.Pages
if (sCodComm != value)
{
sCodComm = value;
- currPage = 1;
- ListRecords = null;
- ReloadData();
}
}
}
+ private async Task ResetDataAsync()
+ {
+ currPage = 1;
+ ListRecords = null;
+ await ReloadDataAsync();
+ }
+
protected string sParentCss
{
get => string.IsNullOrEmpty(sCodComm) ? "btn-secondary" : "btn-primary";
@@ -120,8 +116,7 @@ namespace MP.SPEC.Pages
protected async Task DoCancel()
{
EditRecord = null;
- ReloadData();
- await Task.Delay(1);
+ await ResetDataAsync();
}
///
@@ -137,8 +132,7 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
var done = await MDService.IstKitDelete(selRec);
EditRecord = null;
- ReloadData();
- await Task.Delay(1);
+ await ResetDataAsync();
}
protected async Task DoUpdate(IstanzeKitModel selRec)
@@ -149,8 +143,7 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
var done = await MDService.IstKitUpsert(selRec);
EditRecord = null;
- ReloadData();
- await Task.Delay(1);
+ await ResetDataAsync();
}
protected override void OnInitialized()
@@ -176,9 +169,9 @@ namespace MP.SPEC.Pages
setBaseFilt();
}
- protected override void OnParametersSet()
+ protected override async Task OnParametersSetAsync()
{
- ReloadData();
+ await ReloadDataAsync();
}
protected void ResetData()
@@ -191,10 +184,10 @@ namespace MP.SPEC.Pages
idxMaccSel = "*";
}
- protected void ResetParent()
+ protected async Task ResetParent()
{
SearchComm = "";
- ReloadData();
+ await ResetDataAsync();
}
protected void resetReparto()
@@ -228,10 +221,10 @@ namespace MP.SPEC.Pages
numRecord = newNum;
}
- protected void UpdateData()
+ protected async Task UpdateData()
{
EditRecord = null;
- ReloadData();
+ await ResetDataAsync();
}
#endregion Protected Methods
@@ -311,7 +304,7 @@ namespace MP.SPEC.Pages
if (_currPage != value)
{
_currPage = value;
- ReloadData();
+ UpdateTable();
}
}
}
@@ -342,7 +335,7 @@ namespace MP.SPEC.Pages
if (_numRecord != value)
{
_numRecord = value;
- ReloadData();
+ UpdateTable();
}
}
}
@@ -359,11 +352,11 @@ namespace MP.SPEC.Pages
#region Private Methods
- private void ReloadData()
+ private async Task ReloadDataAsync()
{
isLoading = true;
// leggo dati x filtro
- var allGruppiData = MDService.ElencoGruppiFase();
+ var allGruppiData = await MDService.ElencoGruppiFaseAsync();
if (allGruppiData != null)
{
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
@@ -373,10 +366,15 @@ namespace MP.SPEC.Pages
totalCount = SearchRecords.Count;
// conto i kit = distinct...
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
- ListRecords = SearchRecords
- .Skip(numRecord * (currPage - 1))
- .Take(numRecord)
- .ToList();
+ UpdateTable();
+ }
+
+ private void UpdateTable()
+ {
+ ListRecords = SearchRecords?
+ .Skip(numRecord * (currPage - 1))
+ .Take(numRecord)
+ .ToList() ?? new();
isLoading = false;
}
@@ -423,7 +421,7 @@ namespace MP.SPEC.Pages
currPage = 1;
// salvo filtro reparto x utente... spostare in componente?
await localStorage.SetItemAsync("reparto", repartoSel);
- ReloadData();
+ await ReloadDataAsync();
currFilter = newParams;
isLoading = false;
}
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index 1fc88236..64ea7d73 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2808
+ Versione: 8.16.2605.2809
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index 828db479..c5710be8 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2808
+8.16.2605.2809
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index ad15ce10..bb10b8fa 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2808
+ 8.16.2605.2809
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