From 221a39ceaf6faa8d8d800700edacb59e5497b53e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 15 Feb 2023 19:37:50 +0100 Subject: [PATCH] CodeMaid + inizio fix conf string const x SPEC --- MP.SPEC/Data/MpDataService.cs | 109 +++++++++++++++---------------- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 5 files changed, 58 insertions(+), 59 deletions(-) diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 80e555e7..bbd0ff09 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -71,54 +71,10 @@ namespace MP.SPEC.Data #endregion Public Properties - /// - /// Init ricetta - /// - /// - /// - /// - /// - public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary CalcArgs) - { - return mongoController.InitRecipe(confPath, idxPODL, CalcArgs); - } - - /// - /// Salva ricetta su MongoDB - /// - /// - /// - public async Task RecipeSetByPODL(RecipeModel currRecord) - { - bool answ = false; - answ = await mongoController.RecipeSetByPODL(currRecord); - return answ; - } - /// - /// Ricerca ricetta su MongoDB dato PODL - /// - /// - /// - public async Task RecipeGetByPODL(int idxPODL) - { - RecipeModel? result = null; - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - string readType = "MongoDB"; - result = await mongoController.RecipeGetByPODL(idxPODL); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms"); - return result; - } - - public string CalcRecipe(RecipeModel currRecipe) - { - return mongoController.CalcRecipe(currRecipe); - } - #region Public Methods + + /// /// Recupera eventuali azioni richieste /// @@ -129,7 +85,7 @@ namespace MP.SPEC.Data stopWatch.Start(); DisplayAction? result = null; // cerco in redis... - RedisValue rawData = await redisDb.StringGetAsync(redisActionReq); + RedisValue rawData = await redisDb.StringGetAsync(Utils.redisActionReq); if (!string.IsNullOrEmpty($"{rawData}")) { result = JsonConvert.DeserializeObject($"{rawData}"); @@ -157,8 +113,7 @@ namespace MP.SPEC.Data // cerco in redis... string rawData = JsonConvert.SerializeObject(act2save); // invio broadcast + salvo in redis - BroadastMsgPipe.saveAndSendMessage(redisActionReq, rawData); - //await redisDb.StringSetAsync(redisActionReq, rawData); + BroadastMsgPipe.saveAndSendMessage(Utils.redisActionReq, rawData); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Debug($"ActionSetReq REDIS send to broadcast + Write cache: {ts.TotalMilliseconds}ms"); @@ -171,7 +126,7 @@ namespace MP.SPEC.Data stopWatch.Start(); List? result = new List(); // cerco in redis... - RedisValue rawData = await redisDb.StringGetAsync(redisStatoCom); + RedisValue rawData = await redisDb.StringGetAsync(Utils.redisStatoCom); if (!string.IsNullOrEmpty($"{rawData}")) { result = JsonConvert.DeserializeObject>($"{rawData}"); @@ -184,7 +139,7 @@ namespace MP.SPEC.Data result = await Task.FromResult(dbController.AnagStatiComm()); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(redisStatoCom, rawData, getRandTOut(redisLongTimeCache)); + await redisDb.StringSetAsync(Utils.redisStatoCom, rawData, getRandTOut(redisLongTimeCache)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Debug($"AnagStatiComm Read from DB: {ts.TotalMilliseconds}ms"); @@ -390,6 +345,11 @@ namespace MP.SPEC.Data return answ; } + public string CalcRecipe(RecipeModel currRecipe) + { + return mongoController.CalcRecipe(currRecipe); + } + public async Task> ConfigGetAll() { Stopwatch stopWatch = new Stopwatch(); @@ -755,6 +715,18 @@ namespace MP.SPEC.Data return outVal; } + /// + /// Init ricetta + /// + /// + /// + /// + /// + public RecipeModel InitRecipe(string confPath, int idxPODL, Dictionary CalcArgs) + { + return mongoController.InitRecipe(confPath, idxPODL, CalcArgs); + } + /// /// /// id odl da cercare @@ -1357,6 +1329,36 @@ namespace MP.SPEC.Data return dbResult; } + /// + /// Ricerca ricetta su MongoDB dato PODL + /// + /// + /// + public async Task RecipeGetByPODL(int idxPODL) + { + RecipeModel? result = null; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "MongoDB"; + result = await mongoController.RecipeGetByPODL(idxPODL); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"RecipeGetByPODL | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + + /// + /// Salva ricetta su MongoDB + /// + /// + /// + public async Task RecipeSetByPODL(RecipeModel currRecord) + { + bool answ = false; + answ = await mongoController.RecipeSetByPODL(currRecord); + return answ; + } + /// /// Statistiche ODL calcolate (da stored stp_STAT_ODL) /// @@ -1544,14 +1546,11 @@ namespace MP.SPEC.Data private const string redisPOdlByOdl = redisXdlData + "POdlByOdl"; private const string redisPOdlByPOdl = redisXdlData + "POdlByPOdl"; private const string redisPOdlList = redisXdlData + "POdlList"; + private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf"; private const string redisStatoCom = redisBaseAddrSpec + "Cache:StatoCom"; private const string redisTipoArt = redisBaseAddrSpec + "Cache:TipoArt"; private const string redisVocabolario = redisBaseAddrSpec + "Cache:Vocabolario"; private const string redisXdlData = redisBaseAddrSpec + "Cache:XDL:"; - - private const string redisRecipeConf = redisBaseAddrSpec + "Cache:Recipe:Conf"; - - private static IConfiguration _configuration = null!; private static ILogger _logger = null!; diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index cde0cc15..7460feb5 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2302.1419 + 6.16.2302.1519 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index f5a412ce..6980b489 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2302.1419

+

Versione: 6.16.2302.1519


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 9b798361..c97e0676 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2302.1419 +6.16.2302.1519 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index d8c73ced..d1c87922 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2302.1419 + 6.16.2302.1519 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