diff --git a/MP-TAB-SERV/Components/TechSheetMan.razor b/MP-TAB-SERV/Components/TechSheetMan.razor
index 63d0994b..bf0d7934 100644
--- a/MP-TAB-SERV/Components/TechSheetMan.razor
+++ b/MP-TAB-SERV/Components/TechSheetMan.razor
@@ -14,7 +14,7 @@
-
+
@if (ListGruppi.Count == 0)
{
@@ -29,7 +29,7 @@
-
diff --git a/MP-TAB-SERV/Components/TechSheet_ST_Detail.razor b/MP-TAB-SERV/Components/TechSheet_ST_Detail.razor
index 8e41f52f..41019280 100644
--- a/MP-TAB-SERV/Components/TechSheet_ST_Detail.razor
+++ b/MP-TAB-SERV/Components/TechSheet_ST_Detail.razor
@@ -1,10 +1,11 @@
@if (showWarning)
{
-
@txtWarning
+
@txtWarning
}
@if (ListRecord.Count == 0)
{
+
NO record found
}
else
{
diff --git a/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor b/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor
index d190f8da..c76c1844 100644
--- a/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor
+++ b/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor
@@ -1,5 +1,5 @@
-
TechSheet_ObjCheck
-
-@code {
-
-}
+
+ Verifica
+
+
+
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor.cs b/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor.cs
new file mode 100644
index 00000000..7c12852c
--- /dev/null
+++ b/MP-TAB-SERV/Components/TechSheet_ST_ObjCheck.razor.cs
@@ -0,0 +1,167 @@
+using global::System;
+using global::System.Collections.Generic;
+using global::System.Linq;
+using global::System.Threading.Tasks;
+using global::Microsoft.AspNetCore.Components;
+using System.Net.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Components.Authorization;
+using Microsoft.AspNetCore.Components.Forms;
+using Microsoft.AspNetCore.Components.Routing;
+using Microsoft.AspNetCore.Components.Web;
+using Microsoft.AspNetCore.Components.Web.Virtualization;
+using Microsoft.JSInterop;
+using MP_TAB_SERV;
+using MP_TAB_SERV.Shared;
+using MP_TAB_SERV.Components;
+using MP.Data;
+using MP.Data.DatabaseModels;
+using MP.Data.DTO;
+using MP.Data.Services;
+using Newtonsoft.Json;
+using NLog;
+using Amazon.Runtime.Internal.Util;
+
+namespace MP_TAB_SERV.Components
+{
+ public partial class TechSheet_ST_ObjCheck
+ {
+ [Parameter]
+ public string CodArticolo { get; set; } = "";
+ [Parameter]
+ public int idxOdl { get; set; } = 0;
+
+ protected string ScanValue
+ {
+ get => "";
+ set
+ {
+ lastScan = value;
+ // processo
+ processInput();
+ }
+ }
+ [Inject]
+ protected SharedMemService SMServ { get; set; } = null!;
+
+ [Inject]
+ protected TabDataService TabDServ { get; set; } = null!;
+ ///
+ /// procedura pricipale decodifica Barcode
+ ///
+ private void processInput()
+ {
+ bool found = false;
+ bool batchOk = false;
+
+ List
tabRichieste = TabDServ.STAR_pendByOdl(idxOdl);
+ List tabGiacenzeLotto = new List();
+
+ ST_ActRow datiBatchCheck;
+ AnagLottiArca datiLotto;
+ // per prima cosa recupero i valori "Pending" da leggere come candidati...
+#if false
+ if (tabRichieste != null && tabRichieste.Count > 0)
+ {
+ // cerco per EQ come primo step...
+ var trovatoEq = tabRichieste.Where(x => x.CheckType == "EQ" && x.Value == BCodeVal);
+ if (trovatoEq != null && trovatoEq.Count() > 0)
+ {
+ // recupero record..
+ var datiEqCheck = trovatoEq.FirstOrDefault();
+ // registro trovato
+ found = true;
+ lblMessage.Text = $"Parametro acquisito: {BCodeVal}";
+ lblMessage.CssClass = "text-success";
+ // upsert controllo
+ DataLayerObj.taSTChk.upsertQuery(idxOdl, datiEqCheck.IdxST, datiEqCheck.Oggetto, datiEqCheck.Num, BCodeVal, BCodeVal, true, user_std.UtSn.utente, false);
+ }
+
+ // se non trovato
+ if (!found)
+ {
+ // recupero record.. cercando in giacenza il LOTTO...
+ tabGiacenzeLotto = DataLayerObj.taArcaGiac.getBySearch(null, "", BCodeVal, "", false);
+ // controllo condizione tipo BATCH (speciale) - prima solo che CI SIA una richiesta di questo tipo
+ var trovatoBatch = tabRichieste.Where(x => x.CheckType == "BATCH");
+ if (trovatoBatch != null && trovatoBatch.Count() > 0)
+ {
+ datiBatchCheck = trovatoBatch.FirstOrDefault();
+ if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0)
+ {
+ datiLotto = tabGiacenzeLotto.FirstOrDefault();
+
+ // registro trovato
+ found = true;
+ // upsert controllo
+ DataLayerObj.taSTChk.upsertQuery(idxOdl, datiBatchCheck.IdxST, datiBatchCheck.Oggetto, datiBatchCheck.Num, BCodeVal, datiLotto.Cd_AR, true, user_std.UtSn.utente, false);
+ // conto quanti check ci sono dopo, se calati --> ok altrimenti errore
+ var tabRichiestePost = DataLayerObj.taSTAR.getPendingByOdl(idxOdl);
+ if (tabRichiestePost.Count < tabRichieste.Count)
+ {
+ lblMessage.Text = $"Lotto riconosciuto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo acquisito";
+ lblMessage.CssClass = "text-success";
+ batchOk = true;
+ }
+ else
+ {
+ lblMessage.Text = $"Lotto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo NON richiesto";
+ lblMessage.CssClass = "text-danger";
+ }
+ }
+ }
+
+ if (!batchOk)
+ {
+ var currDeroga = DataLayerObj.getDerogaSt(tabRichieste[0].IdxST);
+ // ciclo tra TUTTE le richeiste attive
+ foreach (var item in tabRichieste)
+ {
+ // verifico EVENTUALI deroghe
+ // se è deroga x gruppo/tipo/num corretto...
+ if (currDeroga.CanForce && item.CodGruppo == currDeroga.CodGruppo && item.CodTipo == currDeroga.CodTipo && item.Num == currDeroga.Num && item.Oggetto == currDeroga.Oggetto)
+ {
+ // ... forzo accettazione deroga
+ DataLayerObj.taSTChk.upsertQuery(idxOdl, item.IdxST, item.Oggetto, item.Num, BCodeVal, item.Value, true, user_std.UtSn.utente, true);
+ lblMessage.Text = $"Lotto/articolo non valido: {BCodeVal} --> Forzato a valido per articolo {item.Value}";
+ lblMessage.CssClass = "text-warning";
+ DataLayerObj.setDerogaSt(new MapoSDK.StCheckOverride() { IdxST = item.IdxST, CanForce = false });
+ batchOk = true;
+ }
+ }
+ }
+ }
+
+ // se non trovato
+ if (!found)
+ {
+ if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0)
+ {
+ datiLotto = tabGiacenzeLotto.FirstOrDefault();
+ lblMessage.Text = $"Lotto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo NON richiesto";
+ lblMessage.CssClass = "text-danger";
+ }
+ else
+ {
+ lblMessage.Text = $"Parametro non riconosciuto: {BCodeVal}";
+ lblMessage.CssClass = "text-secondary";
+ }
+ }
+ }
+ else
+ {
+ lblMessage.Text = $"Parametro non valido: {BCodeVal}";
+ lblMessage.CssClass = "text-secondary";
+ }
+
+ // sistemo visualizzaizone componente
+ BCodeVal = "";
+ checkInputData();
+ // sollevo evento
+ reportUpdate();
+#endif
+ }
+
+ private string lastScan = "";
+ }
+}
\ No newline at end of file
diff --git a/MP-TAB-SERV/Components/TechSheet_ST_ObjView.razor b/MP-TAB-SERV/Components/TechSheet_ST_ObjView.razor
index dfcdf612..2c052e40 100644
--- a/MP-TAB-SERV/Components/TechSheet_ST_ObjView.razor
+++ b/MP-TAB-SERV/Components/TechSheet_ST_ObjView.razor
@@ -1,6 +1,6 @@
@if (CurrRec.CodTipo == "IMG")
{
-
+
@(Traduci(CurrRec.Label))
@@ -11,7 +11,7 @@
}
else
{
-
+
@(Traduci(CurrRec.Label))
@@ -31,13 +31,15 @@ else
{
(@CurrRec.ValueRead)
}
- @CurrRec.Value
-
-
+ @CurrRec.Value
+
@if (CurrRec.ShowMissingData)
{
-
-
+
+ }
+ @if (CurrRec.ShowCheckedData)
+ {
+
}
diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj
index a1b61246..9fa8958b 100644
--- a/MP-TAB-SERV/MP-TAB-SERV.csproj
+++ b/MP-TAB-SERV/MP-TAB-SERV.csproj
@@ -3,7 +3,7 @@
net6.0
enable
- 6.16.2310.2616
+ 6.16.2310.2619
enable
MP_TAB_SERV
diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html
index ab18ef6f..aa961ad8 100644
--- a/MP-TAB-SERV/Resources/ChangeLog.html
+++ b/MP-TAB-SERV/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo MAPOSPEC
-
Versione: 6.16.2310.2616
+
Versione: 6.16.2310.2619
Note di rilascio:
-
diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt
index 2e838fa3..3d4f1868 100644
--- a/MP-TAB-SERV/Resources/VersNum.txt
+++ b/MP-TAB-SERV/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2310.2616
+6.16.2310.2619
diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml
index 5be9bc05..d3668781 100644
--- a/MP-TAB-SERV/Resources/manifest.xml
+++ b/MP-TAB-SERV/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2310.2616
+ 6.16.2310.2619
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip
https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html
false
diff --git a/MP-TAB-SERV/appsettings.json b/MP-TAB-SERV/appsettings.json
index 6774f89f..33d6f794 100644
--- a/MP-TAB-SERV/appsettings.json
+++ b/MP-TAB-SERV/appsettings.json
@@ -12,6 +12,7 @@
//"Redis": "localhost:6379,DefaultDatabase=1,connectTimeout=5000,syncTimeout=5000,asyncTimeout=5000,abortConnect=false,ssl=false",
"MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
"MP.Mon": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;",
+ "Mp.IS": "Server=SQL2016DEV;Database=MoonPro_IS_EdilChim; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.INVE;",
"MP.Tab": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=Blazor.ServerApp;"
},
"ServerConf": {
diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs
index ce03850c..f96e2e5d 100644
--- a/MP.Data/Controllers/MpTabController.cs
+++ b/MP.Data/Controllers/MpTabController.cs
@@ -1054,6 +1054,27 @@ namespace MP.Data.Controllers
return fatto;
}
+ ///
+ /// Recupero Righe pending da ODL
+ ///
+ ///
+ ///
+ public List STAR_pendByOdl(int idxODL)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ var IdxODL = new SqlParameter("@IdxODL", idxODL);
+
+ dbResult = dbCtx
+ .DbSetStActRow
+ .FromSqlRaw("exec dbo.stp_ST_AR_getPendingOdl @IdxODL", IdxODL)
+ .AsNoTracking()
+ //.AsEnumerable()
+ .ToList();
+ }
+ return dbResult;
+ }
///
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
///
@@ -1072,7 +1093,7 @@ namespace MP.Data.Controllers
.DbSetStActRow
.FromSqlRaw("exec dbo.stp_ST_AR_getByGrpOdl @CodGruppo, @IdxODL", CodGruppo, IdxODL)
.AsNoTracking()
- .AsEnumerable()
+ //.AsEnumerable()
.ToList();
}
return dbResult;
@@ -1098,7 +1119,7 @@ namespace MP.Data.Controllers
.DbSetStActRow
.FromSqlRaw("exec dbo.stp_ST_AR_getGrpOdlLabel @CodGruppo, @Label, @IdxODL", CodGruppo, Label, IdxODL)
.AsNoTracking()
- .AsEnumerable()
+ //.AsEnumerable()
.ToList();
}
return dbResult;
diff --git a/MP.Data/DatabaseModels/ST_ActRow.cs b/MP.Data/DatabaseModels/ST_ActRow.cs
index c458e5ca..beb6bc23 100644
--- a/MP.Data/DatabaseModels/ST_ActRow.cs
+++ b/MP.Data/DatabaseModels/ST_ActRow.cs
@@ -30,7 +30,13 @@ namespace MP.Data.DatabaseModels
[NotMapped]
public bool ShowMissingData
{
- get => Required && (Value != ExtCode);
+ get => Required && (Value != ExtCode);
+ }
+
+ [NotMapped]
+ public bool ShowCheckedData
+ {
+ get => Required && (Value == ExtCode);
}
}
}
\ No newline at end of file
diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs
index 63aa906f..03c17856 100644
--- a/MP.Data/Services/TabDataService.cs
+++ b/MP.Data/Services/TabDataService.cs
@@ -13,7 +13,6 @@ using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace MP.Data.Services
{
@@ -46,6 +45,8 @@ namespace MP.Data.Services
sb.AppendLine($"TabDataService | MpTabController OK");
dbIocController = new Controllers.MpIocController(configuration);
sb.AppendLine($"TabDataService | MpIocController OK");
+ dbInveController = new Controllers.MpInveController(configuration);
+ sb.AppendLine($"TabDataService | MpInveController OK");
Log.Info(sb.ToString());
// sistemo i parametri x redHas...
CodModulo = _configuration.GetValue("OptConf:CodModulo");
@@ -69,97 +70,14 @@ namespace MP.Data.Services
#endregion Public Constructors
+ #region Public Properties
+
///
/// Conmfig attivo da DB
///
public List CurrConfig { get; set; } = new List();
- ///
- /// Setup oggetto config con lettura da DB
- ///
- ///
- public void SetupConfig()
- {
- CurrConfig = ConfigGetAll();
- }
-
- ///
- /// Recupera il valore in formato STRING
- ///
- /// Valore da cercare
- /// String in cui salvare il valore se trovato
- ///
- public bool ConfigGetVal(string chiave, ref string varObj)
- {
- bool answ = false;
- // se mancasse provo a configurare..
- if (CurrConfig == null || CurrConfig.Count == 0)
- {
- SetupConfig();
- }
- if (CurrConfig != null && CurrConfig.Count > 0)
- {
- // sistemo i parametri opzionali...
- ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
- if (risultato != null)
- {
- varObj = risultato.Valore;
- answ = !string.IsNullOrEmpty(risultato.Valore);
- }
- }
- return answ;
- }
- ///
- /// Recupera il valore in formato INT
- ///
- /// Valore da cercare
- /// Int in cui salvare il valore se trovato
- ///
- public bool ConfigGetVal(string chiave, ref int varObj)
- {
- bool answ = false;
- // se mancasse provo a configurare..
- if (CurrConfig == null || CurrConfig.Count == 0)
- {
- SetupConfig();
- }
- if (CurrConfig != null && CurrConfig.Count > 0)
- {
- // sistemo i parametri opzionali...
- ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
- if (risultato != null)
- {
- answ = int.TryParse(risultato.Valore, out varObj);
- }
- }
- return answ;
- }
- ///
- /// Recupera il valore in formato BOOL
- ///
- /// Valore da cercare
- /// Boolean in cui salvare il valore se trovato
- ///
- public bool ConfigGetVal(string chiave, ref bool varObj)
- {
- bool answ = false;
- // se mancasse provo a configurare..
- if (CurrConfig == null || CurrConfig.Count == 0)
- {
- SetupConfig();
- }
- if (CurrConfig != null && CurrConfig.Count > 0)
- {
- // sistemo i parametri opzionali...
- ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
- if (risultato != null)
- {
- answ = bool.TryParse(risultato.Valore, out varObj);
- }
- }
- return answ;
- }
-
+ #endregion Public Properties
#region Public Methods
@@ -540,6 +458,84 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Recupera il valore in formato STRING
+ ///
+ /// Valore da cercare
+ /// String in cui salvare il valore se trovato
+ ///
+ public bool ConfigGetVal(string chiave, ref string varObj)
+ {
+ bool answ = false;
+ // se mancasse provo a configurare..
+ if (CurrConfig == null || CurrConfig.Count == 0)
+ {
+ SetupConfig();
+ }
+ if (CurrConfig != null && CurrConfig.Count > 0)
+ {
+ // sistemo i parametri opzionali...
+ ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
+ if (risultato != null)
+ {
+ varObj = risultato.Valore;
+ answ = !string.IsNullOrEmpty(risultato.Valore);
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// Recupera il valore in formato INT
+ ///
+ /// Valore da cercare
+ /// Int in cui salvare il valore se trovato
+ ///
+ public bool ConfigGetVal(string chiave, ref int varObj)
+ {
+ bool answ = false;
+ // se mancasse provo a configurare..
+ if (CurrConfig == null || CurrConfig.Count == 0)
+ {
+ SetupConfig();
+ }
+ if (CurrConfig != null && CurrConfig.Count > 0)
+ {
+ // sistemo i parametri opzionali...
+ ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
+ if (risultato != null)
+ {
+ answ = int.TryParse(risultato.Valore, out varObj);
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// Recupera il valore in formato BOOL
+ ///
+ /// Valore da cercare
+ /// Boolean in cui salvare il valore se trovato
+ ///
+ public bool ConfigGetVal(string chiave, ref bool varObj)
+ {
+ bool answ = false;
+ // se mancasse provo a configurare..
+ if (CurrConfig == null || CurrConfig.Count == 0)
+ {
+ SetupConfig();
+ }
+ if (CurrConfig != null && CurrConfig.Count > 0)
+ {
+ // sistemo i parametri opzionali...
+ ConfigModel? risultato = CurrConfig.FirstOrDefault(x => x.Chiave == chiave);
+ if (risultato != null)
+ {
+ answ = bool.TryParse(risultato.Valore, out varObj);
+ }
+ }
+ return answ;
+ }
///
/// Inserimento record in DDB
@@ -574,6 +570,7 @@ namespace MP.Data.Services
// Clear database controller
dbTabController.Dispose();
dbIocController.Dispose();
+ dbInveController.Dispose();
}
///
@@ -806,6 +803,44 @@ namespace MP.Data.Services
return result;
}
+ ///
+ /// Elenco lotti esterni presenti sul db di ARCA
+ ///
+ /// Codice articolo
+ /// Codice lotto
+ /// Codice magazzino
+ ///
+ public async Task
> LottoEsterno(string codArt, string codLotto, string codMagazzino)
+ {
+ // setup parametri costanti
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:LottoExt:{codMagazzino}:{codArt}:{codLotto}";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = dbInveController.LottoEsterno(codArt, codLotto, codMagazzino);
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"LottoEsterno | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
///
/// Effettua ricalcolo MSE x macchina indicata
///
@@ -1025,127 +1060,6 @@ namespace MP.Data.Services
}
return answ;
}
- public async Task ST_CheckCleanByOdl(int idxOdl)
- {
- bool answ = false;
- try
- {
- // inserisco evento
- answ = dbTabController.ST_CheckCleanByOdl(idxOdl);
- await FlushCache("ST");
- }
- catch (Exception exc)
- {
- string logMsg = $"Eccezione in ST_CheckCleanByOdl | idxOdl: {idxOdl}{Environment.NewLine}{exc}";
- Log.Error(logMsg);
- }
- return answ;
- }
-
-
- ///
- /// Restituisce elenco gruppi Scheda tecnica
- ///
- ///
- public async Task> ST_AnagGruppiList()
- {
- // setup parametri costanti
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List? result = new List();
- // cerco in redis...
- string currKey = $"{redisBaseKey}:ST:AnagGruppi";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = dbTabController.ST_AnagGruppiList();
- // serializzp e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
- }
- if (result == null)
- {
- result = new List();
- }
- sw.Stop();
- Log.Debug($"ST_AnagGruppiList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
- public bool ST_DerogaSet(StCheckOverride deroga)
- {
- bool fatto = false;
- try
- {
- string keyDerogaST = redHash($"DerogaSt:{deroga.Utente}:{deroga.IdxST:000}");
- string rawData = JsonConvert.SerializeObject(deroga);
- redisDb.StringSet(keyDerogaST, rawData, TimeSpan.FromMinutes(2));
- fatto = true;
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione in ST_DerogaSet | Utente: {deroga.Utente} | IdxST: {deroga.IdxST}{Environment.NewLine}{exc}");
- }
- return fatto;
- }
-
- ///
- /// Dati deroga SchedaTecnica serializzati in REDIS
- ///
- public StCheckOverride ST_DerogaGet(string Utente, int IdxST)
- {
- StCheckOverride answ = new StCheckOverride() { IdxST = 0 };
- string keyDerogaST = redHash($"DerogaSt:{Utente}:{IdxST:000}");
- string rawData = redisDb.StringGet(keyDerogaST);
- if (!string.IsNullOrEmpty(rawData))
- {
- try
- {
- answ = JsonConvert.DeserializeObject(rawData);
- }
- catch (Exception exc)
- {
- Log.Error($"Eccezione in ST_DerogaSet | Utente: {Utente} | IdxST: {IdxST}{Environment.NewLine}{exc}");
- }
- }
- return answ;
- }
-
- public List VocabolarioGetAll()
- {
- // setup parametri costanti
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List? result = new List();
- // cerco in redis...
- string currKey = $"{redisBaseKey}:Vocab";
- RedisValue rawData = redisDb.StringGet(currKey);
- if (rawData.HasValue)
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = dbTabController.VocabolarioGetAll();
- // serializzp e salvo...
- rawData = JsonConvert.SerializeObject(result);
- redisDb.StringSet(currKey, rawData, UltraLongCache);
- }
- if (result == null)
- {
- result = new List();
- }
- sw.Stop();
- Log.Debug($"VocabolarioGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
///
/// Aggiunta record RegistroScarti
@@ -1430,6 +1344,141 @@ namespace MP.Data.Services
return answ;
}
+ ///
+ /// Setup oggetto config con lettura da DB
+ ///
+ ///
+ public void SetupConfig()
+ {
+ CurrConfig = ConfigGetAll();
+ }
+
+ ///
+ /// Restituisce elenco gruppi Scheda tecnica
+ ///
+ ///
+ public async Task> ST_AnagGruppiList()
+ {
+ // setup parametri costanti
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:ST:AnagGruppi";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = dbTabController.ST_AnagGruppiList();
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"ST_AnagGruppiList | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
+ public async Task ST_CheckCleanByOdl(int idxOdl)
+ {
+ bool answ = false;
+ try
+ {
+ // inserisco evento
+ answ = dbTabController.ST_CheckCleanByOdl(idxOdl);
+ await FlushCache("ST");
+ }
+ catch (Exception exc)
+ {
+ string logMsg = $"Eccezione in ST_CheckCleanByOdl | idxOdl: {idxOdl}{Environment.NewLine}{exc}";
+ Log.Error(logMsg);
+ }
+ return answ;
+ }
+
+ ///
+ /// Dati deroga SchedaTecnica serializzati in REDIS
+ ///
+ public StCheckOverride ST_DerogaGet(string Utente, int IdxST)
+ {
+ StCheckOverride answ = new StCheckOverride() { IdxST = 0 };
+ string keyDerogaST = redHash($"DerogaSt:{Utente}:{IdxST:000}");
+ string rawData = redisDb.StringGet(keyDerogaST);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ try
+ {
+ answ = JsonConvert.DeserializeObject(rawData);
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione in ST_DerogaSet | Utente: {Utente} | IdxST: {IdxST}{Environment.NewLine}{exc}");
+ }
+ }
+ return answ;
+ }
+
+ public bool ST_DerogaSet(StCheckOverride deroga)
+ {
+ bool fatto = false;
+ try
+ {
+ string keyDerogaST = redHash($"DerogaSt:{deroga.Utente}:{deroga.IdxST:000}");
+ string rawData = JsonConvert.SerializeObject(deroga);
+ redisDb.StringSet(keyDerogaST, rawData, TimeSpan.FromMinutes(2));
+ fatto = true;
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione in ST_DerogaSet | Utente: {deroga.Utente} | IdxST: {deroga.IdxST}{Environment.NewLine}{exc}");
+ }
+ return fatto;
+ }
+
+ ///
+ /// Recupero Righe pending da ODL
+ ///
+ ///
+ ///
+ public List STAR_pendByOdl(int idxODL)
+ {
+ // setup parametri costanti
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:STAR:Pend:{idxODL}";
+ RedisValue rawData = redisDb.StringGet(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = dbTabController.STAR_pendByOdl(idxODL);
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ redisDb.StringSet(currKey, rawData, LongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"STAR_pendByOdl | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
///
/// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL
///
@@ -1444,7 +1493,7 @@ namespace MP.Data.Services
sw.Start();
List? result = new List();
// cerco in redis...
- string currKey = $"{redisBaseKey}:START:{codGruppo}:{idxODL}";
+ string currKey = $"{redisBaseKey}:STAR:{codGruppo}:{idxODL}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
@@ -1483,7 +1532,7 @@ namespace MP.Data.Services
sw.Start();
List? result = new List();
// cerco in redis...
- string currKey = $"{redisBaseKey}:START:{codGruppo}:{label}:{idxODL}";
+ string currKey = $"{redisBaseKey}:STAR:{codGruppo}:{label}:{idxODL}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
@@ -1784,6 +1833,37 @@ namespace MP.Data.Services
return result;
}
+ public List VocabolarioGetAll()
+ {
+ // setup parametri costanti
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:Vocab";
+ RedisValue rawData = redisDb.StringGet(currKey);
+ if (rawData.HasValue)
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = dbTabController.VocabolarioGetAll();
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ redisDb.StringSet(currKey, rawData, UltraLongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"VocabolarioGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
///
/// Elenco causali scarto
///
@@ -1890,8 +1970,8 @@ namespace MP.Data.Services
#region Private Properties
+ private static Controllers.MpInveController dbInveController { get; set; } = null!;
private static Controllers.MpIocController dbIocController { get; set; } = null!;
-
private static Controllers.MpTabController dbTabController { get; set; } = null!;
#endregion Private Properties