diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index 652a1412..4186b6d5 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -1273,18 +1273,14 @@ namespace MP.Data.Controllers
///
///
///
- public List IstKitFilt(string keyKit, string keyExtOrd)
+ public async Task> IstKitFiltAsync(string keyKit, string keyExtOrd)
{
- List dbResult = new List();
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
+ using var dbCtx = new MoonProContext(options);
+ return await dbCtx
.DbSetInstKit
.Where(x => (string.IsNullOrEmpty(keyKit) && string.IsNullOrEmpty(keyExtOrd)) || (x.KeyKit.Contains(keyKit) && !string.IsNullOrEmpty(keyKit)) || (x.KeyExtOrd.Contains(keyExtOrd) && !string.IsNullOrEmpty(keyExtOrd)))
.AsNoTracking()
- .ToList();
- }
- return dbResult;
+ .ToListAsync() ?? new();
}
///
@@ -2590,22 +2586,19 @@ namespace MP.Data.Controllers
///
///
///
- public List TksScore(string KeyFilt, int MaxResult)
+ public async Task> TksScoreAsync(string KeyFilt, int MaxResult)
{
List dbResult = new List();
if (!string.IsNullOrEmpty(KeyFilt))
{
- using (var dbCtx = new MoonProContext(options))
- {
- var pKeyFilt = new SqlParameter("@KeyFilt", KeyFilt);
- var pMaxRes = new SqlParameter("@maxResult", MaxResult);
-
- dbResult = dbCtx
- .DbSetTksScore
- .FromSqlRaw("EXEC stp_TKS_Search @KeyFilt, @maxResult", pKeyFilt, pMaxRes)
- .AsNoTracking()
- .ToList();
- }
+ using var dbCtx = new MoonProContext(options);
+ var pKeyFilt = new SqlParameter("@KeyFilt", KeyFilt);
+ var pMaxRes = new SqlParameter("@maxResult", MaxResult);
+ dbResult = await dbCtx
+ .DbSetTksScore
+ .FromSqlRaw("EXEC stp_TKS_Search @KeyFilt, @maxResult", pKeyFilt, pMaxRes)
+ .AsNoTracking()
+ .ToListAsync();
}
return dbResult;
}
@@ -2712,20 +2705,18 @@ namespace MP.Data.Controllers
///
///
///
- public List WipKitFilt(string KeyFilt)
+ public async Task> WipKitFiltAsync(string KeyFilt)
{
List dbResult = new List();
// solo se filtro valido...
if (!string.IsNullOrEmpty(KeyFilt))
{
- using (var dbCtx = new MoonProContext(options))
- {
- dbResult = dbCtx
- .DbSetWipKit
- .Where(x => x.KeyFilt.Contains(KeyFilt))
- .AsNoTracking()
- .ToList();
- }
+ using var dbCtx = new MoonProContext(options);
+ dbResult = await dbCtx
+ .DbSetWipKit
+ .Where(x => x.KeyFilt.Contains(KeyFilt))
+ .AsNoTracking()
+ .ToListAsync();
}
return dbResult;
}
diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj
index 31066432..2792aac7 100644
--- a/MP.Land/MP.Land.csproj
+++ b/MP.Land/MP.Land.csproj
@@ -3,7 +3,7 @@
net8.0
MP.Land
- 8.16.2605.2810
+ 8.16.2605.2811
Debug;Release;Debug_LiManDebug
en
True
diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html
index 1b09f5c9..0b3d6084 100644
--- a/MP.Land/Resources/ChangeLog.html
+++ b/MP.Land/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo Tablet MAPO - DotNet6
- Versione: 8.16.2605.2810
+ Versione: 8.16.2605.2811
Note di rilascio:
diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt
index 7076e6d6..378864b8 100644
--- a/MP.Land/Resources/VersNum.txt
+++ b/MP.Land/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2810
+8.16.2605.2811
diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml
index 27aee25f..0ef06353 100644
--- a/MP.Land/Resources/manifest.xml
+++ b/MP.Land/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2810
+ 8.16.2605.2811
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip
https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html
false
diff --git a/MP.SPEC/Components/ProdKit/Manager.razor.cs b/MP.SPEC/Components/ProdKit/Manager.razor.cs
index c1bf0bc7..73b7368f 100644
--- a/MP.SPEC/Components/ProdKit/Manager.razor.cs
+++ b/MP.SPEC/Components/ProdKit/Manager.razor.cs
@@ -68,10 +68,9 @@ namespace MP.SPEC.Components.ProdKit
DateTime oggi = DateTime.Today;
}
- protected override void OnParametersSet()
+ protected override async Task OnParametersSetAsync()
{
- //base.OnParametersSet();
- ReloadData();
+ await ReloadDataAsync();
}
///
@@ -106,7 +105,7 @@ namespace MP.SPEC.Components.ProdKit
await EC_IsComposing.InvokeAsync(isComposing);
// rileggo
- ReloadData();
+ await ReloadDataAsync();
}
}
@@ -162,7 +161,7 @@ namespace MP.SPEC.Components.ProdKit
{
calcKitCode();
}
- ReloadData();
+ await ReloadDataAsync();
isComposing = false;
await EC_IsComposing.InvokeAsync(isComposing);
}
@@ -171,7 +170,7 @@ namespace MP.SPEC.Components.ProdKit
{
ActFilt.HasOdl = setHasOdl;
await EC_FiltUpdated.InvokeAsync(ActFilt);
- ReloadData();
+ await ReloadDataAsync();
}
private async Task ForceReset()
@@ -184,13 +183,13 @@ namespace MP.SPEC.Components.ProdKit
await EC_FiltUpdated.InvokeAsync(ActFilt);
}
- private void ReloadData()
+ private async Task ReloadDataAsync()
{
listPOdlCheck = new List();
- listPOdlAct = MDService.POdlListGetFilt(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd);
- listWSM = MDService.WipKitFilt(keyFilt);
- listTSM = MDService.TksScore(keyFilt, 1000, true);
- listIKP = MDService.IstKitFilt("", "");
+ listPOdlAct = await MDService.POdlListGetFiltAsync(ActFilt.HasOdl, ActFilt.CodFase, ActFilt.IdxMacchina, ActFilt.CodReparto, ActFilt.DtStart, ActFilt.DtEnd);
+ listWSM = await MDService.WipKitFiltAsync(keyFilt);
+ listTSM = await MDService.TksScoreAsync(keyFilt, 1000, true);
+ listIKP = await MDService.IstKitFiltAsync("", "");
// verifico se ho score 100%...
var recMaxScore = listTSM
.Where(x => x.TotalScore == 1)
diff --git a/MP.SPEC/Components/ScratchPodlKit.razor b/MP.SPEC/Components/ScratchPodlKit.razor
index 97b46602..49004db1 100644
--- a/MP.SPEC/Components/ScratchPodlKit.razor
+++ b/MP.SPEC/Components/ScratchPodlKit.razor
@@ -12,7 +12,7 @@
-
+
diff --git a/MP.SPEC/Components/ScratchPodlKit.razor.cs b/MP.SPEC/Components/ScratchPodlKit.razor.cs
index e51d9229..a9c7c38a 100644
--- a/MP.SPEC/Components/ScratchPodlKit.razor.cs
+++ b/MP.SPEC/Components/ScratchPodlKit.razor.cs
@@ -46,13 +46,17 @@ namespace MP.SPEC.Components
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";
@@ -92,8 +96,7 @@ namespace MP.SPEC.Components
protected async Task DoCancel()
{
EditRecord = null;
- ReloadData();
- await Task.Delay(1);
+ await ResetDataAsync();
}
///
@@ -106,11 +109,9 @@ namespace MP.SPEC.Components
if (!await JSRuntime.InvokeAsync("confirm", "Eliminazione riga Istanza KIT: sei sicuro di voler procedere?"))
return;
- 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)
@@ -118,11 +119,9 @@ namespace MP.SPEC.Components
if (!await JSRuntime.InvokeAsync("confirm", "Confermi di voler salvare le modifiche?"))
return;
- await Task.Delay(1);
var done = await MDService.IstKitUpsert(selRec);
EditRecord = null;
- ReloadData();
- await Task.Delay(1);
+ await ResetDataAsync();
}
protected override void OnInitialized()
@@ -147,20 +146,16 @@ namespace MP.SPEC.Components
}
}
- protected override void OnParametersSet()
+ protected override async Task OnParametersSetAsync()
{
- ReloadData();
+ await ReloadDataAsync();
}
- protected void ResetData()
- {
- EditRecord = null;
- }
- protected void ResetParent()
+ protected async Task ResetParent()
{
SearchComm = "";
- ReloadData();
+ await ResetDataAsync();
}
protected void ResetSel()
@@ -184,10 +179,10 @@ namespace MP.SPEC.Components
numRecord = newNum;
}
- protected void UpdateData()
+ protected async Task UpdateData()
{
EditRecord = null;
- ReloadData();
+ await ResetDataAsync();
}
#endregion Protected Methods
@@ -242,7 +237,7 @@ namespace MP.SPEC.Components
if (_currPage != value)
{
_currPage = value;
- ReloadData();
+ ReloadDataAsync();
}
}
}
@@ -257,7 +252,7 @@ namespace MP.SPEC.Components
if (_numRecord != value)
{
_numRecord = value;
- ReloadData();
+ ReloadDataAsync();
}
}
}
@@ -270,17 +265,22 @@ namespace MP.SPEC.Components
#region Private Methods
- private void ReloadData()
+ private async Task ReloadDataAsync()
{
isLoading = true;
- SearchRecords = MDService.IstKitFilt("", "");
+ SearchRecords = await MDService.IstKitFiltAsync("", "");
totalCount = SearchRecords.Count;
// conto i kit = distinct...
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
- ListRecords = SearchRecords
+ UpdateTable();
+ }
+
+ private void UpdateTable()
+ {
+ ListRecords = SearchRecords?
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
- .ToList();
+ .ToList() ?? new();
isLoading = false;
}
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 1ebed9ac..0bd00253 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -1102,38 +1102,19 @@ namespace MP.SPEC.Data
}
///
- /// Elenco Gruppi
+ /// Elenco FluxLog in modalità Pareto
///
///
public async Task> FluxLogParetoAsync(string idxMacchina, DateTime dtFrom, DateTime dtTo)
{
- using var activity = ActivitySource.StartActivity("FluxLogParetoAsync");
- string source = "DB";
- List? result = new List();
- // cerco in redis...
string redKey = $"{Utils.redisParetoFLKey}:{idxMacchina}:{dtFrom:yyyyMMdd}:{dtTo:yyyyMMdd}";
- RedisValue rawData = await redisDb.StringGetAsync(redKey);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await dbController.FluxLogParetoAsync(idxMacchina, dtFrom, dtTo);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(redKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- activity?.SetTag("data.source", source);
- activity?.SetTag("result.count", result.Count);
- activity?.Stop();
- LogTrace($"FluxLogParetoAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return result;
+ return await GetOrFetchAsync(
+ operationName: "FluxLogParetoAsync",
+ cacheKey: redKey,
+ expiration: TimeSpan.FromMinutes(redisLongTimeCache),
+ fetchFunc: async () => await dbController.FluxLogParetoAsync(idxMacchina, dtFrom, dtTo) ?? new List(),
+ tagList: [Utils.redisParetoFLKey]
+ );
}
///
@@ -1270,14 +1251,14 @@ namespace MP.SPEC.Data
///
///
///
- public List IstKitFilt(string keyKit, string keyExtOrd)
+ public async Task> IstKitFiltAsync(string keyKit, string keyExtOrd)
{
- using var activity = ActivitySource.StartActivity("IstKitFilt");
+ using var activity = ActivitySource.StartActivity("IstKitFiltAsync");
string source = "DB";
List? result = new List();
// cerco in redis...
string currKey = $"{Utils.redisKitInst}:{keyKit}:{keyExtOrd}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -1285,10 +1266,10 @@ namespace MP.SPEC.Data
}
else
{
- result = dbController.IstKitFilt(keyKit, keyExtOrd);
+ result = await dbController.IstKitFiltAsync(keyKit, keyExtOrd);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
+ await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
}
if (result == null)
{
@@ -1297,7 +1278,7 @@ namespace MP.SPEC.Data
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
activity?.Stop();
- LogTrace($"IstKitFilt | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"IstKitFiltAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
return result;
}
@@ -1547,33 +1528,14 @@ namespace MP.SPEC.Data
///
public async Task> MacchineWithFluxAsync(DateTime dtStart, DateTime dtEnd)
{
- using var activity = ActivitySource.StartActivity("MacchineWithFluxAsync");
- List? result = new List();
- string source = "DB";
string currKey = $"{Utils.redisMacByFlux}:{dtStart:yyyyMMddHHmm}:{dtEnd:yyyyMMddHHmm}";
- // cerco in redis dato valore sel idxMaccSel...
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await dbController.MacchineWithFluxAsync(dtStart, dtEnd);
- // serializzo e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
- }
- if (result == null)
- {
- result = new List();
- }
- activity?.SetTag("data.source", source);
- activity?.SetTag("result.count", result.Count);
- activity?.Stop();
- LogTrace($"MacchineWithFluxAsync | Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
- return result;
+ return await GetOrFetchAsync(
+ operationName: "MacchineWithFluxAsync",
+ cacheKey: currKey,
+ expiration: TimeSpan.FromMinutes(redisLongTimeCache),
+ fetchFunc: async () => await dbController.MacchineWithFluxAsync(dtStart, dtEnd) ?? new List(),
+ tagList: [Utils.redisMacByFlux]
+ );
}
public async Task> MachineWithOdlAsync()
@@ -2526,14 +2488,14 @@ namespace MP.SPEC.Data
///
///
///
- public List TksScore(string KeyFilt, int MaxResult, bool ForceDb)
+ public async Task> TksScoreAsync(string KeyFilt, int MaxResult, bool ForceDb)
{
- using var activity = ActivitySource.StartActivity("TksScore");
+ using var activity = ActivitySource.StartActivity("TksScoreAsync");
string source = "DB";
List? result = new List();
// cerco in redis...
string currKey = $"{Utils.redisKitScore}:{KeyFilt}:{MaxResult}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue && !ForceDb)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2541,10 +2503,10 @@ namespace MP.SPEC.Data
}
else
{
- result = dbController.TksScore(KeyFilt, MaxResult);
+ result = await dbController.TksScoreAsync(KeyFilt, MaxResult);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
+ await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
}
if (result == null)
{
@@ -2553,7 +2515,7 @@ namespace MP.SPEC.Data
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
activity?.Stop();
- LogTrace($"TksScore | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"TksScoreAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
return result;
}
@@ -2657,14 +2619,14 @@ namespace MP.SPEC.Data
///
///
///
- public List WipKitFilt(string KeyFilt)
+ public async Task> WipKitFiltAsync(string KeyFilt)
{
- using var activity = ActivitySource.StartActivity("WipKitFilt");
+ using var activity = ActivitySource.StartActivity("WipKitFiltAsync");
string source = "DB";
List? result = new List();
// cerco in redis...
string currKey = $"{Utils.redisKitWip}:{KeyFilt}";
- RedisValue rawData = redisDb.StringGet(currKey);
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject>($"{rawData}");
@@ -2672,10 +2634,10 @@ namespace MP.SPEC.Data
}
else
{
- result = dbController.WipKitFilt(KeyFilt);
+ result = await dbController.WipKitFiltAsync(KeyFilt);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
+ await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromMinutes(redisLongTimeCache));
}
if (result == null)
{
@@ -2684,7 +2646,7 @@ namespace MP.SPEC.Data
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
activity?.Stop();
- LogTrace($"WipKitFilt | {source} | {activity?.Duration.TotalMilliseconds}ms");
+ LogTrace($"WipKitFiltAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
return result;
}
diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj
index ceaa572e..8f6e41c9 100644
--- a/MP.SPEC/MP.SPEC.csproj
+++ b/MP.SPEC/MP.SPEC.csproj
@@ -5,7 +5,7 @@
enable
enable
MP.SPEC
- 8.16.2605.2810
+ 8.16.2605.2811
1800a78a-6ff1-40f9-b490-87fb8bfc1394
en
diff --git a/MP.SPEC/Pages/Podl2Kit.razor.cs b/MP.SPEC/Pages/Podl2Kit.razor.cs
index 8846fa07..f73d2fe0 100644
--- a/MP.SPEC/Pages/Podl2Kit.razor.cs
+++ b/MP.SPEC/Pages/Podl2Kit.razor.cs
@@ -361,8 +361,8 @@ namespace MP.SPEC.Pages
{
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
}
- ListMacchine = MDService.MacchineGetFilt(repartoSel);
- SearchRecords = MDService.IstKitFilt("", "");
+ ListMacchine = await MDService.MacchineGetFiltAsync(repartoSel);
+ SearchRecords = await MDService.IstKitFiltAsync("", "");
totalCount = SearchRecords.Count;
// conto i kit = distinct...
kitCount = SearchRecords.GroupBy(x => x.CodArtParent).Count();
diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html
index a6dbd98e..9b69bf46 100644
--- a/MP.SPEC/Resources/ChangeLog.html
+++ b/MP.SPEC/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
- Versione: 8.16.2605.2810
+ Versione: 8.16.2605.2811
Note di rilascio:
-
diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt
index 7076e6d6..378864b8 100644
--- a/MP.SPEC/Resources/VersNum.txt
+++ b/MP.SPEC/Resources/VersNum.txt
@@ -1 +1 @@
-8.16.2605.2810
+8.16.2605.2811
diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml
index 9ea0c762..d3e3fe22 100644
--- a/MP.SPEC/Resources/manifest.xml
+++ b/MP.SPEC/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 8.16.2605.2810
+ 8.16.2605.2811
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