diff --git a/MP.AppAuth/Services/AppAuthService.cs b/MP.AppAuth/Services/AppAuthService.cs index 07d6962f..7a05fa57 100644 --- a/MP.AppAuth/Services/AppAuthService.cs +++ b/MP.AppAuth/Services/AppAuthService.cs @@ -692,24 +692,6 @@ namespace MP.AppAuth.Services } } answ = true; -#if false - var listEndpoints = redisConn.GetEndPoints(); - foreach (var endPoint in listEndpoints) - { - //var server = redisConnAdmin.GetServer(listEndpoints[0]); - var server = redisConn.GetServer(endPoint); - if (server != null) - { - var keyList = server.Keys(redisDb.Database, pattern); - foreach (var item in keyList) - { - await redisDb.KeyDeleteAsync(item); - } - answ = true; - } - } -#endif - return answ; } diff --git a/MP.Data/Controllers/MpMonController.cs b/MP.Data/Controllers/MpMonController.cs index 4003acf1..300bfe46 100644 --- a/MP.Data/Controllers/MpMonController.cs +++ b/MP.Data/Controllers/MpMonController.cs @@ -6,6 +6,7 @@ using NLog; using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; namespace MP.Data.Controllers { @@ -136,18 +137,18 @@ namespace MP.Data.Controllers /// Elenco da tabella MappaStatoExplModel /// /// - public List MseGetAll(int maxAge = 2000) + public async Task> MseGetAllAsync(int maxAge = 2000) { - List dbResult = new List(); + List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) { var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge); - dbResult = dbCtx + dbResult = await dbCtx .DbSetMSE .FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec) .AsNoTracking() - .ToList(); + .ToListAsync(); } return dbResult; } diff --git a/MP.Data/Services/StatusData.cs b/MP.Data/Services/StatusData.cs index 66aaf74a..02d66bcc 100644 --- a/MP.Data/Services/StatusData.cs +++ b/MP.Data/Services/StatusData.cs @@ -30,9 +30,15 @@ namespace MP.Data.Services // conf DB string connStr = _configuration.GetConnectionString("MP.Mon"); + // se non trovo cerco con MP.All... if (string.IsNullOrEmpty(connStr)) { - Log.Error("ConnString empty!"); + connStr = _configuration.GetConnectionString("MP.All"); + } + + if (string.IsNullOrEmpty(connStr)) + { + Log.Error("ConnString empty! [MP.Mon / MP.All]"); } else { @@ -329,7 +335,7 @@ namespace MP.Data.Services } else { - result = await Task.FromResult(dbController.MseGetAll(maxAge)); + result = await dbController.MseGetAllAsync(maxAge); // serializzp e salvo... rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(Constants.redisMseKey, rawData, UltraFastCache); @@ -339,7 +345,7 @@ namespace MP.Data.Services result = new List(); } sw.Stop(); - Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + Log.Debug($"MseGetAllAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); return result; } diff --git a/MP.SPEC/Components/Fermate/ListFerm.razor.cs b/MP.SPEC/Components/Fermate/ListFerm.razor.cs index 8a00ba7c..8a3e93c5 100644 --- a/MP.SPEC/Components/Fermate/ListFerm.razor.cs +++ b/MP.SPEC/Components/Fermate/ListFerm.razor.cs @@ -12,20 +12,17 @@ namespace MP.SPEC.Components.Fermate { public partial class ListFerm { - - [Parameter] - public List ListaFermate { get; set; } = new List(); + #region Public Properties [Parameter] public EventCallback EC_EventSelected { get; set; } - private bool isProcessing = false; + [Parameter] + public List ListaFermate { get; set; } = new List(); - //[Inject] - //protected SharedMemService SMServ { get; set; } = null!; + #endregion Public Properties - //[Inject] - //protected TabDataService TabDServ { get; set; } = null!; + #region Protected Methods /// /// Sollevo evento click @@ -34,9 +31,10 @@ namespace MP.SPEC.Components.Fermate /// protected async Task ReportEvent(SelEventDTO selEv) { - isProcessing = true; // solleva evento selezione... await EC_EventSelected.InvokeAsync(selEv); } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP.SPEC/Components/Fermate/ListMacc.razor b/MP.SPEC/Components/Fermate/ListMacc.razor index 4c6f5bfc..006559fa 100644 --- a/MP.SPEC/Components/Fermate/ListMacc.razor +++ b/MP.SPEC/Components/Fermate/ListMacc.razor @@ -11,7 +11,7 @@
- + @* *@
@@ -68,7 +68,7 @@ - + diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 7a6daa12..f0cf41b7 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -368,10 +368,6 @@ namespace MP.SPEC.Components SearchRecords = await MDService.OdlListGetFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodFase, currFilter.CodReparto, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - await Task.Delay(1); -#if false - await InvokeAsync(StateHasChanged); -#endif isLoading = false; } diff --git a/MP.SPEC/Components/ProdKit/GestKitPodl.razor.cs b/MP.SPEC/Components/ProdKit/GestKitPodl.razor.cs index dc5671e3..bac741bc 100644 --- a/MP.SPEC/Components/ProdKit/GestKitPodl.razor.cs +++ b/MP.SPEC/Components/ProdKit/GestKitPodl.razor.cs @@ -182,11 +182,6 @@ namespace MP.SPEC.Components.ProdKit #region Private Fields - /// - /// Boolear controllo visualizzazione ricerca articoli - /// - private bool doSearchArt = false; - /// /// Elenco singoli podl esplosi /// diff --git a/MP.SPEC/Components/ScratchPodlKit.razor.cs b/MP.SPEC/Components/ScratchPodlKit.razor.cs index 27f3f0ab..e51d9229 100644 --- a/MP.SPEC/Components/ScratchPodlKit.razor.cs +++ b/MP.SPEC/Components/ScratchPodlKit.razor.cs @@ -84,7 +84,6 @@ namespace MP.SPEC.Components return answ; } - /// /// Verifica eliminabilit del record: se avviato il PODL non liminabile... /// @@ -126,8 +125,6 @@ namespace MP.SPEC.Components await Task.Delay(1); } - private bool OptAdmKitEnabled = false; - protected override void OnInitialized() { numRecord = 10; @@ -150,22 +147,6 @@ namespace MP.SPEC.Components } } -#if false - protected override void OnAfterRender(bool firstRender) - { - if (firstRender) - { - if (OptAdmKitEnabled) - { - doReset(); - } - } - //base.OnAfterRender(firstRender); - } -#endif - - - protected override void OnParametersSet() { ReloadData(); @@ -219,10 +200,9 @@ namespace MP.SPEC.Components private bool doSearchArt = false; private IstanzeKitModel? EditRecord = null; - private List? ListRecords; - private int minChar = 2; + private bool OptAdmKitEnabled = false; /// /// RegExp x SAVE KIT @@ -326,209 +306,5 @@ namespace MP.SPEC.Components } #endregion Private Methods - - -#if false - - - public string codKitTemp - { - get - { - return memLayer.ML.StringSessionObj(string.Format("codKitTemp_{0}", uid)); - } - set - { - memLayer.ML.setSessionVal(string.Format("codKitTemp_{0}", uid), value); - hlCodKitTemp.Value = value; - grViewWSK.DataBind(); - } - } - - /// - /// Ultimo Codice KIT creato - /// - public string lastKitMade - { - get - { - return memLayer.ML.StringSessionObj("lastKitMade"); - } - set - { - memLayer.ML.setSessionVal("lastKitMade", value); - } - } - - /// - /// Aggiunge (in obj OrdineKit) l'ordine coi parametri indicati - /// - /// - /// - /// - /// - /// - public bool addOrdArt(string codOrd, string codArt, string descArt, int qta) - { - bool answ = false; - // verifico di avere un codiceKIT - checkCodKit(); - // salvo info x il cod temporaneo... - DataLayerObj.taWKS.insertQuery(codKitTemp, codOrd, codArt, descArt, qta); - // verifico SE HO un KIT riconosciuto e quindi un CodArt di KIT valido... - string currCodArtKit = "###"; - var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); - bool showPODL = false; - if (TksTab.Rows.Count > 0) - { - // verifico se ho aderenza 100%... - if (TksTab[0].TotalScore == 1) - { - currCodArtKit = TksTab[0].CodArtParent; - showPODL = true; - } - } - hfCodArtKit.Value = currCodArtKit; - divPODL.Visible = showPODL; - answ = true; - grViewWSK.DataBind(); - grViewKitSel.DataBind(); - grViewPODL.DataBind(); - grViewIstanzeKIT.DataBind(); - return answ; - } - - - private void doReset() - { - // elimino eventuali record ODL - DataLayerObj.taWKS.deleteQuery(codKitTemp); - codKitTemp = ""; - divPODL.Visible = false; - checkCodKit(); - } - - /// - /// Ultimo input registrato - /// - public string lastInput - { - get - { - return hlLastInput.Value; - } - set - { - hlLastInput.Value = value; - } - } - - /// - /// Aggiorno controllo secondo ULTIMO input - /// - public void doUpdate() - { - // aggiorno label... - messOut = ""; - // controllo input (reset/inizio o salva...) - if (lastInput == regExp_KO) - { - // resetto dati - doReset(); - messOut = "Effettuato reset!"; - } - else if (lastInput == regExp_KitStart) - { - // resetto dati - doReset(); - messOut = "Inizio configurazione KIT"; - } - else if (lastInput == regExp_KitSave) - { - // controllo SE HO un kit selezionato... - string currCodArtKit = "###"; - var TksTab = DataLayerObj.taTKS.GetData(codKitTemp, 1); - bool showPODL = false; - if (TksTab.Rows.Count > 0) - { - // verifico se ho aderenza 100%... - if (TksTab[0].TotalScore == 1) - { - currCodArtKit = TksTab[0].CodArtParent; - showPODL = true; - } - } - if (showPODL) - { - // in questo caso creo istanza! - creazioneIstanzaKit(currCodArtKit); - } - } - else if (lastInput == regExp_OK) - { - } - // ennesimo check cod TEMP - checkCodKit(); - } - - /// - /// Verifico SE HO un codKit Temporaneo senn lo creo... - /// - private void checkCodKit() - { - if (codKitTemp == "") - { - // genero un NUOVO cod temp kit... - codKitTemp = string.Format("KIT_{0:yyMMdd_HHmmss}", DateTime.Now); - } - } - - public string messOut - { - set - { - lblOut.Text = value; - } - get - { - return lblOut.Text; - } - } - - protected void grViewKitSel_SelectedIndexChanged(object sender, EventArgs e) - { - // se ho selezionato recupero CHIAVE = CodArticolo del KIT - string CodArtParent = grViewKitSel.SelectedValue.ToString(); - // crea KIT x quel CodArtParent... - creazioneIstanzaKit(CodArtParent); - } - /// - /// Crea una NUOVA istanza KIT - /// - /// CodArt dell'Assieme/KIT - private void creazioneIstanzaKit(string CodArtParent) - { - // calcolo NUOVO codice kit... - var tabKey = DataLayerObj.taIstK.getNewKey(); - if (tabKey.Rows.Count == 1) - { - // stacco un NUOVO codice KIT - lastKitMade = tabKey[0].KeyKit; - // inserisco ISTANZA KIT! - DataLayerObj.taIstK.insertByWKS(lastKitMade, CodArtParent, codKitTemp); - // faccio reset valori WKS... - doReset(); - // ora resetto ordine caricato... - messOut = string.Format("Creato NUOVA P.ODL cod {0} per il KIT {1}", lastKitMade, CodArtParent); - // sollevo evento x impostare lettura KIT a BARCODE (x conferma successiva...) - // sollevo evento nuovo valore... - if (eh_selKit != null) - { - eh_selKit(this, new EventArgs()); - } - } - } -#endif - } } \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 2a3400e4..c0b1514c 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -1898,7 +1898,7 @@ namespace MP.SPEC.Data /// public async Task> MseGetAll(bool forceDb = false) { - using var activity = ActivitySource.StartActivity("MseGetAll"); + using var activity = ActivitySource.StartActivity("MseGetAllAsync"); string source = "DB"; List? result = new List(); // cerco in redisConn... @@ -1922,7 +1922,7 @@ namespace MP.SPEC.Data activity?.SetTag("data.source", source); activity?.SetTag("result.count", result.Count); activity?.Stop(); - LogTrace($"MseGetAll | {source} | {activity?.Duration.TotalMilliseconds}ms"); + LogTrace($"MseGetAllAsync | {source} | {activity?.Duration.TotalMilliseconds}ms"); return result; } diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index c00fd578..24b720e6 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2602.2510 + 6.16.2602.2511 1800a78a-6ff1-40f9-b490-87fb8bfc1394 en diff --git a/MP.SPEC/Pages/RepStop.razor.cs b/MP.SPEC/Pages/RepStop.razor.cs index 310c96d2..77729a4c 100644 --- a/MP.SPEC/Pages/RepStop.razor.cs +++ b/MP.SPEC/Pages/RepStop.razor.cs @@ -6,13 +6,14 @@ using MP.Data.DbModels; using MP.Data.Services; using MP.SPEC.Components.Reparti; using MP.SPEC.Data; +using Newtonsoft.Json; using NLog.LayoutRenderers; using static MP.Core.Objects.Enums; using static MP.Data.Services.ExecStatsCollector; namespace MP.SPEC.Pages { - public partial class RepStop + public partial class RepStop: IDisposable { #region Protected Properties @@ -35,6 +36,49 @@ namespace MP.SPEC.Pages protected override async Task OnInitializedAsync() { await ReloadData(); + TDFeeder.dataPipe.EA_NewMessage += DataPipe_EA_NewMessage; + } + + [Inject] + protected TabDataFeeder TDFeeder { get; set; } = null!; + + public void Dispose() + { + TDFeeder.dataPipe.EA_NewMessage -= DataPipe_EA_NewMessage; + } + + /// + /// Ricevuto nuovi dati da mostrare! + /// + /// + /// + private void DataPipe_EA_NewMessage(object? sender, EventArgs e) + { + PubSubEventArgs currArgs = (PubSubEventArgs)e; + // conversione on-the-fly List --> allarmi + if (!string.IsNullOrEmpty(currArgs.newMessage)) + { + try + { + List? dataList = JsonConvert.DeserializeObject>(currArgs.newMessage); + if (dataList != null) + { + InvokeAsync(() => SaveData(dataList)); + } + } + catch + { } + } + InvokeAsync(() => + { + StateHasChanged(); + }); + } + + protected async Task SaveData(List newList) + { + // salvo valori ricevuti + CurrMSE = newList; } #endregion Protected Methods @@ -64,7 +108,10 @@ namespace MP.SPEC.Pages private async Task DoReload(bool forceReload) { + isLoading = true; + await Task.Delay(100); CurrMSE = await MDService.MseGetAll(true); + isLoading = false; } /// diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index 8c36172f..884af766 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -131,84 +131,6 @@ else logger.Info("⏸️ Telemetria e Tracing completamente disabilitati."); } -//// Check develop e conseguente Uptrace setup -//// CONTROLLO GLOBALE: Tutto questo gira SOLO in Development -//if (builder.Environment.IsDevelopment()) -//{ -// var uptraceEndpoint = builder.Configuration["UptraceDev:Endpoint"]; -// var uptraceDsn = builder.Configuration["UptraceDev:Dsn"]; - -// // Se le variabili di configurazione esistono nel json locale, attiviamo la magia -// if (!string.IsNullOrEmpty(uptraceEndpoint) && !string.IsNullOrEmpty(uptraceDsn)) -// { -// // ==================================================================== -// // 1. SETUP NLOG (Per i log in tempo reale) -// // ==================================================================== -// var otlpTarget = new OtlpTarget -// { -// Name = "UptraceRealtime", -// Endpoint = uptraceEndpoint, -// ServiceName = "MP.DATA.Tracer", -// Headers = $"uptrace-dsn={uptraceDsn}" -// }; - -// var config = LogManager.Configuration ?? new NLog.Config.LoggingConfiguration(); -// config.AddTarget(otlpTarget); -// config.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, otlpTarget); -// LogManager.Configuration = config; -// LogManager.ReconfigExistingLoggers(); - -// Console.WriteLine("🚀 NLog OTLP Target attivato per Uptrace in Development!"); - -// // ==================================================================== -// // 2. SETUP OPENTELEMETRY (Per gli Span, HTTP, DB e Redis in tempo reale) -// // ==================================================================== -// var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0"; - -// builder.Services.AddOpenTelemetry() -// .WithTracing(tracerProviderBuilder => -// { -// tracerProviderBuilder -// // Definiamo il nome e versione del servizio CORRENTE su Uptrace -// .SetResourceBuilder(ResourceBuilder.CreateDefault() -// .AddService(serviceName: "MAPO.SPEC", serviceVersion: appVersion)) - -// // Diciamo a OTel di ascoltare gli Span manuali generati -// .AddSource("MP.DATA.Tracer") - -// // Strumentazione Automatica -// .AddAspNetCoreInstrumentation(options => -// { -// options.Filter = (httpContext) => !httpContext.Request.Path.StartsWithSegments("/health"); -// }) -// .AddSqlClientInstrumentation(options => -// { -// options.RecordException = true; -// }) -// // Assicurati che redisMultiplexer sia inizializzato PRIMA di questo blocco -// .AddRedisInstrumentation(redisMultiplexer) - -// // Esporta i dati verso Uptrace -// .AddOtlpExporter(options => -// { -// options.Endpoint = new Uri(uptraceEndpoint); -// options.Headers = $"uptrace-dsn={uptraceDsn}"; -// options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc; -// }); - -// // Scommenta per testare in console -// // .AddConsoleExporter(); -// }); - -// Console.WriteLine("🚀 OpenTelemetry Tracing attivato per Uptrace in Development!"); -// } -// else -// { -// Console.WriteLine("⚠️ Variabili UptraceDev mancanti nel json. Telemetria realtime disabilitata."); -// } -//} - - // Add services to the container. logger.Info("Setup Auth"); builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) @@ -231,6 +153,7 @@ builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); builder.Services.AddBlazoredLocalStorage(); builder.Services.AddBlazoredSessionStorage(); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index d0b18b50..c176ca23 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2602.2510

+

Versione: 6.16.2602.2511


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index ce979628..367b5e2a 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2602.2510 +6.16.2602.2511 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index c27a75d0..d4f209cd 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2602.2510 + 6.16.2602.2511 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 diff --git a/MP.SPEC/Shared/NavMenu.razor.cs b/MP.SPEC/Shared/NavMenu.razor.cs index 4f30688e..958012e7 100644 --- a/MP.SPEC/Shared/NavMenu.razor.cs +++ b/MP.SPEC/Shared/NavMenu.razor.cs @@ -43,18 +43,9 @@ namespace MP.SPEC.Shared protected override void OnInitialized() { - //base.OnInitialized(); ElencoLink = MDService.ElencoLink(); } -#if false - protected override async Task OnInitializedAsync() - { - // recupero elenco JQM - await Task.Delay(1); - } -#endif - protected void ToggleCompress() { showText = !showText;