Fix naming + pulizia metodi nonn usati
This commit is contained in:
@@ -231,7 +231,7 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
await MDService.ConfigResetCache();
|
||||
ListGruppiFase = MDService.ElencoGruppiFase();
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListStati = await MDService.AnagStatiCommAsync();
|
||||
selAzienda = await MDService.ConfigTryGetAsync("AZIENDA");
|
||||
giacenzeConf = await MDService.ConfigTryGetAsync("SPEC_ShowGiacenze");
|
||||
ListArticoli = await MDService.ArticoliGetSearchAsync(100000, "*", selAzienda, "");
|
||||
@@ -436,7 +436,7 @@ namespace MP.SPEC.Components
|
||||
private async Task ReloadData(bool setChanged)
|
||||
{
|
||||
isLoading = true;
|
||||
SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtStart, SelDtEnd, MaxRec);
|
||||
SearchRecords = await MDService.DossiersGetLastFiltAsync(SelMacchina, SelArticolo, SelDtStart, SelDtEnd, MaxRec);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListStati = await MDService.AnagStatiCommAsync();
|
||||
ListArtKit = await MDService.ArticoliGetByTipoAsync("KIT", "*");
|
||||
string SPEC_PODL_gest = await MDService.ConfigTryGetAsync("SPEC_PODL_gest");
|
||||
if (!string.IsNullOrEmpty(SPEC_PODL_gest))
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace MP.SPEC.Components
|
||||
.Select(x => x.IdxMacchina)
|
||||
.ToHashSet();
|
||||
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListStati = await MDService.AnagStatiCommAsync();
|
||||
ListArtKit = await MDService.ArticoliGetByTipoAsync("KIT", "*");
|
||||
string strMachRecipe = await MDService.ConfigTryGetAsync("MachineWithRecipe");
|
||||
if (!string.IsNullOrEmpty(strMachRecipe))
|
||||
|
||||
@@ -171,41 +171,6 @@ namespace MP.SPEC.Data
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco EVENTI validi x macchina
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<vSelEventiBCodeModel> AnagEventiGetByMacch(string IdxMacch)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch");
|
||||
string source = "DB";
|
||||
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
|
||||
// cerco in redisConn...
|
||||
string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = dbController.AnagEventiGetByMacc(IdxMacch);
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<vSelEventiBCodeModel>();
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", result.Count);
|
||||
activity?.Stop();
|
||||
LogTrace($"AnagEventiGetByMacch | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete record AnagraficaGruppi
|
||||
/// </summary>
|
||||
@@ -243,42 +208,7 @@ namespace MP.SPEC.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<AnagKeyValueModel>> AnagKeyValGetAll()
|
||||
{
|
||||
// nuovo oggetto span activity
|
||||
using var activity = ActivitySource.StartActivity("AnagKeyValGetAll");
|
||||
string source = "DB";
|
||||
List<AnagKeyValueModel>? result = new List<AnagKeyValueModel>();
|
||||
// cerco in redis...
|
||||
RedisValue rawData = await redisDb.StringGetAsync(Utils.redisAKVKey);
|
||||
if (!string.IsNullOrEmpty($"{rawData}"))
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<AnagKeyValueModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await Task.FromResult(dbController.AnagKeyValGetAll());
|
||||
// serializzo e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
await redisDb.StringSetAsync(Utils.redisConfKey, rawData, getRandTOut(redisLongTimeCache));
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new List<AnagKeyValueModel>();
|
||||
}
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.SetTag("result.count", result.Count);
|
||||
activity?.Stop();
|
||||
LogTrace($"AnagKeyValGetAll Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<List<ListValuesModel>> AnagStatiComm()
|
||||
public async Task<List<ListValuesModel>> AnagStatiCommAsync()
|
||||
{
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "AnagStatiCommAsync",
|
||||
@@ -346,9 +276,7 @@ namespace MP.SPEC.Data
|
||||
public async Task<List<AnagArticoliModel>> ArticoliGetByTipoAsync(string tipo, string azienda = "*")
|
||||
{
|
||||
string sKey = string.IsNullOrWhiteSpace(tipo) ? "ALL" : tipo.Trim();
|
||||
|
||||
string redisKey = $"{Utils.redisArtList}:{azienda}:Tipo:{sKey}";
|
||||
|
||||
return await GetOrFetchAsync(
|
||||
operationName: "ArticoliGetByTipoAsync",
|
||||
cacheKey: redisKey,
|
||||
@@ -527,12 +455,19 @@ namespace MP.SPEC.Data
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("ConfigResetCache");
|
||||
string source = "REDIS";
|
||||
await redisDb.StringSetAsync(Utils.redisConfKey, "");
|
||||
await ResetConfigCache();
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"ConfigResetCache Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
}
|
||||
|
||||
private async Task ResetConfigCache()
|
||||
{
|
||||
await redisDb.StringSetAsync(Utils.redisConfKey, "");
|
||||
List<string> tags2del = new List<string>() { Utils.redisConfKey };
|
||||
await FlushCacheByTagsAsync(tags2del);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce valore della stringa (SE disponibile)
|
||||
/// </summary>
|
||||
@@ -584,6 +519,7 @@ namespace MP.SPEC.Data
|
||||
using var activity = ActivitySource.StartActivity("ConfigUpdateAsync");
|
||||
string source = "DB";
|
||||
var updRes = await dbController.ConfigUpdateAsync(updRec);
|
||||
await ResetConfigCache();
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"ConfigUpdateAsync Read from {source}: {activity?.Duration.TotalMilliseconds}ms");
|
||||
@@ -655,7 +591,7 @@ namespace MP.SPEC.Data
|
||||
/// <param name="DtEnd">Data Massima per estrazione records</param>
|
||||
/// <param name="MaxRec">Num Max records da recuperare</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<DossierModel>> DossiersGetLastFilt(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd, int MaxRec)
|
||||
public async Task<List<DossierModel>> DossiersGetLastFiltAsync(string IdxMacchina, string CodArticolo, DateTime DtStart, DateTime DtEnd, int MaxRec)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("DossiersGetLastFiltAsync");
|
||||
List<DossierModel>? result = new List<DossierModel>();
|
||||
@@ -3332,6 +3268,9 @@ namespace MP.SPEC.Data
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
pattern = new RedisValue($"{Utils.redisArtList}:*");
|
||||
await ExecFlushRedisPatternAsync(pattern);
|
||||
// elimino anche in FusionCache
|
||||
List<string> tags2del = new List<string>() { Utils.redisArtList, Utils.redisArtByDossier };
|
||||
await FlushCacheByTagsAsync(tags2del);
|
||||
activity?.SetTag("data.source", "REDIS");
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
|
||||
}
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListStati = await MDService.AnagStatiCommAsync();
|
||||
ListMacchine = MDService.MacchineGetFilt(selReparto);
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("PadCodXdl");
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
|
||||
}
|
||||
ListStati = await MDService.AnagStatiComm();
|
||||
ListStati = await MDService.AnagStatiCommAsync();
|
||||
currAzienda = await MDService.ConfigTryGetAsync("AZIENDA");
|
||||
padCodXdl = await MDService.ConfigTryGetAsync("padCodXdl");
|
||||
useFasi4KeyRich = await MDService.ConfigTryGetAsync("SPEC_KeyRichiesta");
|
||||
|
||||
Reference in New Issue
Block a user