diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4ebde410 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +[*.cs] + +# CS8765: Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes). +dotnet_diagnostic.CS8765.severity = none diff --git a/MP-SPEC.sln b/MP-SPEC.sln index cf0cb950..6254dfdb 100644 --- a/MP-SPEC.sln +++ b/MP-SPEC.sln @@ -7,6 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.SPEC", "MP.SPEC\MP.SPEC.csproj", "{C777A098-6F91-45AF-A85E-0AD08CBCAC52}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1B6A7550-F6C9-468E-B3B4-C30FF6FE8933}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 5c169377..7e67c870 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -354,6 +354,32 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// insert di un record Dossier + /// + /// record dossier da modificare + /// + public async Task DossiersInsert(Dossiers newRec) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + dbCtx + .DbSetDossiers + .Add(newRec); + await dbCtx.SaveChangesAsync(); + fatto = true; + } + catch (Exception exc) + { + Log.Error($"Eccezione durante DossiersInsert{Environment.NewLine}{exc}"); + } + } + return fatto; + } + /// /// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis /// @@ -401,7 +427,7 @@ namespace MP.Data.Controllers } /// - /// Update ddel campo VALORE di un dossier (che contiene json flux log serializzati) + /// Update del campo VALORE di un dossier (che contiene json flux log serializzati) /// /// record dossier da modificare /// @@ -555,7 +581,7 @@ namespace MP.Data.Controllers .AsNoTracking() .Include(m => m.MachineNav) .Include(a => a.ArticoloNav) - .OrderBy(x => x.InsertDate) + .OrderByDescending(x => x.InsertDate) .ToList(); } return dbResult; @@ -744,7 +770,7 @@ namespace MP.Data.Controllers } /// - /// Recupero Odl CORRENTI + /// Recupero Odl CORRENTI /// /// public List OdlGetCurrent() @@ -1001,6 +1027,24 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Elenco Vocabolario (completo) + /// + /// + public List VocabolarioGetAll() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbSetVocabolario + .AsNoTracking() + .OrderBy(x => x.Lemma) + .ToList(); + } + return dbResult; + } + #endregion Public Methods #region Private Fields diff --git a/MP.Data/DatabaseModels/VocabolarioModel.cs b/MP.Data/DatabaseModels/VocabolarioModel.cs new file mode 100644 index 00000000..9583e936 --- /dev/null +++ b/MP.Data/DatabaseModels/VocabolarioModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.Data.DatabaseModels +{ + [Table("Vocabolario")] + public partial class VocabolarioModel + { + #region Public Properties + + public string Lingua { get; set; } + public string Lemma { get; set; } + public string Traduzione { get; set; } + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.Data/MP.Data.csproj b/MP.Data/MP.Data.csproj index 587b0971..8f08d1cd 100644 --- a/MP.Data/MP.Data.csproj +++ b/MP.Data/MP.Data.csproj @@ -11,6 +11,10 @@ + + + + diff --git a/MP.Data/MessagePipe.cs b/MP.Data/MessagePipe.cs index 098cdc4e..dde3b73a 100644 --- a/MP.Data/MessagePipe.cs +++ b/MP.Data/MessagePipe.cs @@ -69,7 +69,7 @@ namespace MP.Data private bool enableLog = false; private IConnectionMultiplexer redis; - private IDatabase? redisDb; + private IDatabase redisDb; #endregion Private Fields @@ -90,7 +90,7 @@ namespace MP.Data //Subscribe to the channel named messages sub.Subscribe(_channel, (channel, message) => { - Log.Trace($"ch {channel} | {message}"); + Log.Trace($"req setup ch {channel} | {message}"); // messaggio PubSubEventArgs mea = new PubSubEventArgs(message); // se qualcuno ascolta sollevo evento nuovo valore... diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs index 99ddb37e..2ed53d5e 100644 --- a/MP.Data/MoonProContext.cs +++ b/MP.Data/MoonProContext.cs @@ -51,6 +51,7 @@ namespace MP.Data public virtual DbSet DbSetStatOdl { get; set; } public virtual DbSet DbSetStatoProd { get; set; } public virtual DbSet DbSetEvList { get; set; } + public virtual DbSet DbSetVocabolario { get; set; } #endregion Public Properties @@ -303,7 +304,12 @@ namespace MP.Data modelBuilder.Entity(entity => { - entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo}); + entity.HasKey(e => new { e.IdxMacchina, e.InizioStato, e.IdxTipo }); + + }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => new { e.Lingua, e.Lemma }); }); diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 583536b7..46488966 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2209.2118 + 6.16.2210.2110 @@ -60,6 +60,12 @@ + + + Always + + + diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 85af7886..16b19149 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO - Versione: 6.16.2209.2118 + Versione: 6.16.2210.2110 Note di rilascio: diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index ebf3f94a..148d3a17 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2209.2118 +6.16.2210.2110 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 8037398c..06b6c830 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2209.2118 + 6.16.2210.2110 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.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index 0e94de4f..536bb21c 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -48,6 +48,9 @@ Always + + Always + diff --git a/MP.SPEC/Components/Chart/Doughnut.razor.cs b/MP.SPEC/Components/Chart/Doughnut.razor.cs index e8c77ffb..db7524d9 100644 --- a/MP.SPEC/Components/Chart/Doughnut.razor.cs +++ b/MP.SPEC/Components/Chart/Doughnut.razor.cs @@ -26,13 +26,12 @@ namespace MP.SPEC.Components.Chart public ChartType Type { get; set; } [Parameter] - public double[] Data { get; set; } + public double[] Data { get; set; } = null!; + [Parameter] + public List BackgroundColor { get; set; } = null!; [Parameter] - public List BackgroundColor { get; set; } - - [Parameter] - public string[] Labels { get; set; } + public string[] Labels { get; set; } = null!; protected override async Task OnAfterRenderAsync(bool firstRender) { diff --git a/MP.SPEC/Components/CmpFooter.razor.cs b/MP.SPEC/Components/CmpFooter.razor.cs index 9e72abd9..1633f803 100644 --- a/MP.SPEC/Components/CmpFooter.razor.cs +++ b/MP.SPEC/Components/CmpFooter.razor.cs @@ -39,7 +39,8 @@ namespace MP.SPEC.Components protected override void OnInitialized() { - version = typeof(Program).Assembly.GetName().Version; + var rawVers = typeof(Program).Assembly.GetName().Version; ; + version = rawVers != null ? rawVers : new Version("0.0.0.0"); } #endregion Protected Methods diff --git a/MP.SPEC/Components/CmpTop.razor b/MP.SPEC/Components/CmpTop.razor index 8061e546..4ac9d6d0 100644 --- a/MP.SPEC/Components/CmpTop.razor +++ b/MP.SPEC/Components/CmpTop.razor @@ -10,7 +10,10 @@ @userName - + + flushCache()" title="Forza Refresh Dati correnti"> Force Reload + + @* @TipoSearch @@ -18,7 +21,7 @@ { } - + *@ @code { @@ -62,4 +65,22 @@ userName = "N.A."; } } + + public async Task flushCache() + { + await Task.Delay(1); + await MDService.FlushRedisCache(); + await JSRuntime.InvokeAsync("location.reload"); + // rimando a home + //NavManager.NavigateTo("", true); + } + + [Inject] + private NavigationManager NavManager { get; set; } = null!; + + [Inject] + protected MpDataService MDService { get; set; } = null!; + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; } diff --git a/MP.SPEC/Components/DataPager.razor.cs b/MP.SPEC/Components/DataPager.razor.cs index 5fdb615f..cf560eb5 100644 --- a/MP.SPEC/Components/DataPager.razor.cs +++ b/MP.SPEC/Components/DataPager.razor.cs @@ -78,9 +78,9 @@ namespace MP.SPEC.Components #region Public Methods - public async Task resetCurrPage() + public void resetCurrPage() { - await Task.Delay(1); + //await Task.Delay(1); currPage = 1; } diff --git a/MP.SPEC/Components/DossiersFilter.razor b/MP.SPEC/Components/DossiersFilter.razor index df7df4c3..d8607670 100644 --- a/MP.SPEC/Components/DossiersFilter.razor +++ b/MP.SPEC/Components/DossiersFilter.razor @@ -1,7 +1,25 @@ - - - + + @if (filtActive) + { + + @**@ + @if (selMacchina != "*") + { + resetMacchina()" title="Rimuovi Filtro Impianto">   + } + @if (selArticolo != "*") + { + resetArticolo()" title="Rimuovi Filtro Articolo">   + } + + } + + + + + + FILTRI @@ -14,7 +32,7 @@ Articolo - + --- Tutti --- @@ -30,7 +48,7 @@ Macchina - + --- Tutti --- diff --git a/MP.SPEC/Components/DossiersFilter.razor.cs b/MP.SPEC/Components/DossiersFilter.razor.cs index f5dd2bbe..98cdbe8f 100644 --- a/MP.SPEC/Components/DossiersFilter.razor.cs +++ b/MP.SPEC/Components/DossiersFilter.razor.cs @@ -38,7 +38,18 @@ namespace MP.SPEC.Components } } } - + private bool filtActive + { + get => selMacchina != "*" || selArticolo != "*"; + } + protected void resetMacchina() + { + selMacchina = "*"; + } + protected void resetArticolo() + { + selArticolo = "*"; + } protected DateTime selDtMax { get diff --git a/MP.SPEC/Components/ListDossiers.razor b/MP.SPEC/Components/ListDossiers.razor index f8e127e8..5e031017 100644 --- a/MP.SPEC/Components/ListDossiers.razor +++ b/MP.SPEC/Components/ListDossiers.razor @@ -181,6 +181,7 @@ else @record.CodFlux + @traduci(record.CodFlux) @if (record.ValoreEdit != record.Valore) diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs index 64c3f06a..2e88dc72 100644 --- a/MP.SPEC/Components/ListDossiers.razor.cs +++ b/MP.SPEC/Components/ListDossiers.razor.cs @@ -81,6 +81,12 @@ namespace MP.SPEC.Components #region Protected Properties + private string traduci(string lemma) + { + var answ = MDService.Traduci(lemma, "IT"); + return answ; + } + [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -127,7 +133,10 @@ namespace MP.SPEC.Components currFluxLogDto = null; isEditing = false; await Task.Delay(1); - listaFlux = MDService.getFluxLog(currRecord.Valore); + if (currRecord != null) + { + listaFlux = MDService.getFluxLog(currRecord.Valore); + } StateHasChanged(); } } @@ -215,7 +224,6 @@ namespace MP.SPEC.Components private Dossiers? currRecord = null; - private FluxLogDTO? currRecordFlux; private List? ListRecords; private List? ListStati; diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 1ca54e7c..f93b41fc 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -274,7 +274,7 @@ namespace MP.SPEC.Components { get { - List answ = new List(); + List? answ = new List(); if (hideSpenta) { answ = ListOdlStatsNetto; diff --git a/MP.SPEC/Components/ListPARAMS.razor b/MP.SPEC/Components/ListPARAMS.razor index 7d93b2da..d49a30f6 100644 --- a/MP.SPEC/Components/ListPARAMS.razor +++ b/MP.SPEC/Components/ListPARAMS.razor @@ -22,6 +22,7 @@ else Data Macchina Parametro + Nome Valore @@ -41,6 +42,9 @@ else @record.CodFlux + + @traduci(record.CodFlux) + @record.Valore diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 2ef8726a..67a203e0 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -3,6 +3,7 @@ using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.SPEC.Data; using System.Diagnostics; +using MP.Data; namespace MP.SPEC.Components { @@ -135,7 +136,7 @@ namespace MP.SPEC.Components #region Protected Methods - protected override async Task OnInitializedAsync() + protected override void OnInitialized() { StartTimer(); } @@ -156,6 +157,7 @@ namespace MP.SPEC.Components protected async Task resetSel() { currRecord = null; + setDtMax(); await RecordSel.InvokeAsync(null); } @@ -163,8 +165,13 @@ namespace MP.SPEC.Components { currRecord = selRec; SelFilter.IdxMacchina = selRec.IdxMacchina; + SelDtMax = selRec.dtEvento; + // imposto pag 1 filtro + SelFilter.CurrPage = 1; + //selDtMin = RoundDatetime(5).AddHours(-25); await reloadData(false); await RecordSel.InvokeAsync(selRec); + await PagerResetReq.InvokeAsync(true); } protected async Task UpdateData() @@ -175,6 +182,13 @@ namespace MP.SPEC.Components #endregion Protected Methods + + private string traduci(string lemma) + { + var answ = MDService.Traduci(lemma, "IT"); + return answ; + } + #region Private Fields private static System.Timers.Timer aTimer = null!; @@ -224,8 +238,33 @@ namespace MP.SPEC.Components private DateTime? SelDtMax { get => SelFilter.dtMax; + set => SelFilter.dtMax = value; + } + protected void setDtMax() + { + // copio il filtro + var currFilt = SelFilter; + // fermo update + //currFilt.LiveUpdate = true; + currFilt.CurrPage = 0; + currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; + currFilt.dtMax = RoundDatetime(5); + currFilt.dtMin = RoundDatetime(5).AddHours(-25); + SelFilter = currFilt; } + /// + /// Inizializzazione con periodo e arrotondamento + /// + /// + /// + public static DateTime RoundDatetime(int minRound) + { + TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); + int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; + DateTime endRounded = DateTime.Today.AddMinutes(minDay); + return endRounded; + } private int totalCount { get => _totalCount; diff --git a/MP.SPEC/Components/ListPODL.razor b/MP.SPEC/Components/ListPODL.razor index 85641a6c..4bcc0552 100644 --- a/MP.SPEC/Components/ListPODL.razor +++ b/MP.SPEC/Components/ListPODL.razor @@ -37,13 +37,13 @@ else cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"> @if (canStartOdl(record.IdxMacchina)) { - startOdl(record)" class="btn btn-success btn-sm" title="Avvia PODL"> + startOdl(record)" class="btn btn-success btn-sm mx-1" title="Avvia PODL"> } else - { - + { + } diff --git a/MP.SPEC/Components/ParamsFilter.razor b/MP.SPEC/Components/ParamsFilter.razor index 769761eb..60bfd4ab 100644 --- a/MP.SPEC/Components/ParamsFilter.razor +++ b/MP.SPEC/Components/ParamsFilter.razor @@ -3,13 +3,13 @@ @if (!liveUpdate) { - toggleUpdate()" title="Click per tornare a Valori Live"> + live()" title="Click per tornare a Valori Live"> @lastUpdate } else { - toggleUpdate()"> + notLive()"> Valori live @@ -38,89 +38,106 @@ - - - - - - FILTRI - + + @if (filtActive) + { + @**@ + @if (selMacchina != "*") + { + resetMacchina()" title="Rimuovi Filtro Impianto">   + } + @if (selFlux != "*") + { + resetFase()" title="Rimuovi Filtro Parametro">   + } + + } + + + + - - - Impianto - - - - - --- Tutti --- - @if (ListMacchine != null) + + + + + FILTRI + + + + + Impianto + + + + + --- Tutti --- + @if (ListMacchine != null) + { + foreach (var item in ListMacchine) { - foreach (var item in ListMacchine) - { - @item - } + @item } - - - - Parametro - - - - - --- Tutti --- - @if (ListFlux != null) + } + + + + Parametro + + + + + --- Tutti --- + @if (ListFlux != null) + { + foreach (var item in ListFlux) { - foreach (var item in ListFlux) - { - @item - } + @item } - - - - Inizio Periodo - - - - - - - Fine Periodo - - - - - - - Refresh rate (sec) - - - - - 2 - 5 - 10 - 30 - 60 - - - - Max Record - - - - - 50 - 100 - 250 - 500 - 1000 - 2500 - 5000 - - + } + + + + Inizio Periodo + + + + + + + Fine Periodo + + + + + + + Refresh rate (sec) + + + + + 2 + 5 + 10 + 30 + 60 + + + + Max Record + + + + + 50 + 100 + 250 + 500 + 1000 + 2500 + 5000 + diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs index 219b6633..c29423a6 100644 --- a/MP.SPEC/Components/ParamsFilter.razor.cs +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -165,6 +165,10 @@ namespace MP.SPEC.Components NavManager.NavigateTo("DOSS", true); } + private bool filtActive + { + get => selMacchina != "*" || selFlux != "*"; + } protected override async Task OnInitializedAsync() { SelFilter = new SelectFluxParams(); @@ -207,6 +211,14 @@ namespace MP.SPEC.Components aTimer.Enabled = true; aTimer.Start(); } + protected void resetMacchina() + { + selMacchina = "*"; + } + protected void resetFase() + { + selFlux = "*"; + } protected async Task takeSnapshot() { @@ -230,18 +242,19 @@ namespace MP.SPEC.Components selDtMax = null; } - protected async Task toggleUpdate() + protected async Task notLive() { - liveUpdate = !liveUpdate; + liveUpdate = false; await Task.Delay(1); if (!liveUpdate) { lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; } - else - { - selDtMax = null; - } + } + protected async Task live() + { + liveUpdate = true; + await Task.Delay(1); } #endregion Protected Methods diff --git a/MP.SPEC/Data/MessageService.cs b/MP.SPEC/Data/MessageService.cs index 02a690b2..512434b6 100644 --- a/MP.SPEC/Data/MessageService.cs +++ b/MP.SPEC/Data/MessageService.cs @@ -4,13 +4,13 @@ { #region Public Events - public event Action EA_PageUpdated; + public event Action EA_PageUpdated = null!; - public event Action EA_SearchUpdated; + public event Action EA_SearchUpdated = null!; - public event Action EA_ShowSearch; + public event Action EA_ShowSearch = null!; - public event Action EA_StatoSearch; + public event Action EA_StatoSearch = null!; #endregion Public Events diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 12805cc6..b0c3db2e 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -29,10 +29,6 @@ namespace MP.SPEC.Data _logger.LogInformation("Redis INIT"); - // setup canali pub/sub - dataPipe = new MessagePipe(redisConn, Constants.ACT_MSE_DATA_KEY); - blinkPipe = new MessagePipe(redisConn, Constants.ACT_BLINK_KEY); - // conf DB string connStr = _configuration.GetConnectionString("Mp.Data"); if (string.IsNullOrEmpty(connStr)) @@ -52,15 +48,11 @@ namespace MP.SPEC.Data public static MP.Data.Controllers.MpSpecController dbController { get; set; } = null!; - public MessagePipe blinkPipe { get; set; } = null!; - /// /// Dizionario dei tag configurati per IOB /// public Dictionary> currTagConf { get; set; } = new Dictionary>(); - public MessagePipe dataPipe { get; set; } = null!; - #endregion Public Properties #region Public Methods @@ -100,15 +92,14 @@ namespace MP.SPEC.Data { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); + string source = "DB"; List? result = new List(); // cerco in redis... RedisValue rawData = await redisDb.StringGetAsync(redisTipoArt); if (!string.IsNullOrEmpty($"{rawData}")) { result = JsonConvert.DeserializeObject>($"{rawData}"); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"AnagTipoArtLV Read from REDIS: {ts.TotalMilliseconds}ms"); + source = "REDIS"; } else { @@ -116,10 +107,10 @@ namespace MP.SPEC.Data // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); await redisDb.StringSetAsync(redisTipoArt, rawData, getRandTOut(redisLongTimeCache)); - stopWatch.Stop(); - TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"AnagTipoArtLV Read from DB: {ts.TotalMilliseconds}ms"); } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"AnagTipoArtLV Read from {source}: {ts.TotalMilliseconds}ms"); if (result == null) { result = new List(); @@ -180,7 +171,7 @@ namespace MP.SPEC.Data /// public async Task> ArticoliGetSearch(int numRecord, string azienda, string searchVal) { - List result = new List(); + List? result = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; @@ -197,7 +188,7 @@ namespace MP.SPEC.Data result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache/5)); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5)); } if (result == null) { @@ -247,7 +238,7 @@ namespace MP.SPEC.Data { // cerco in cache se ci sia la tabella con gli articoli impiegati... string rawTable = redisDb.StringGet(redKeyTabCheckArt); - List artList = new List(); + List? artList = new List(); if (!string.IsNullOrEmpty(rawTable)) { artList = JsonConvert.DeserializeObject>(rawTable); @@ -401,6 +392,19 @@ namespace MP.SPEC.Data return result; } + /// + /// Inserimento nuovo record dossier + /// + /// + /// + public async Task DossiersInsert(Dossiers currDoss) + { + // aggiorno record sul DB + bool answ = await dbController.DossiersUpdateValore(currDoss); + + return answ; + } + /// /// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis /// @@ -442,6 +446,19 @@ namespace MP.SPEC.Data return answ; } + /// + /// Update valore dossier + /// + /// + /// + public async Task DossiersUpdateValore(Dossiers currDoss) + { + // aggiorno record sul DB + bool answ = await dbController.DossiersUpdateValore(currDoss); + + return answ; + } + /// /// Restitusice elenco aziende /// @@ -480,6 +497,8 @@ namespace MP.SPEC.Data await Task.Delay(1); RedisValue pattern = new RedisValue($"{redisBaseAddr}*"); bool answ = await ExecFlushRedisPattern(pattern); + // rileggo vocabolario.,.. + ObjVocabolario = VocabolarioGetAll(); return answ; } @@ -618,8 +637,6 @@ namespace MP.SPEC.Data TimeSpan ts = stopWatch.Elapsed; Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; - - } /// @@ -746,7 +763,7 @@ namespace MP.SPEC.Data /// public List OdlGetCurrent() { - List dbResult = new List(); + List? dbResult = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; @@ -777,7 +794,6 @@ namespace MP.SPEC.Data TimeSpan ts = stopWatch.Elapsed; Log.Debug($"OdlGetCurrent | Read from {readType}: {ts.TotalMilliseconds}ms"); - return dbResult; } @@ -871,6 +887,29 @@ namespace MP.SPEC.Data return dbController.OdlStart(IdxOdl); } + /// + /// Esegue traduzione dato vocabolario da Lingua + Lemma + /// + /// + /// + /// + public string Traduci(string lemma, string lingua) + { + string answ = $"[{lemma}]"; + // verifico se ho qualcosa nell'obj vocabolario... + if (ObjVocabolario == null || ObjVocabolario.Count == 0) + { + // inizializzo il vocabolario... + ObjVocabolario = VocabolarioGetAll(); + } + var record = ObjVocabolario.Where(x => x.Lingua == lingua && x.Lemma == lemma).FirstOrDefault(); + if (record != null) + { + answ = record.Traduzione; + } + return answ; + } + public async Task updateDossierValue(Dossiers currDoss, FluxLogDTO editFL) { bool answ = false; @@ -911,13 +950,38 @@ namespace MP.SPEC.Data return answ; } - - public async Task DossiersUpdateValore(Dossiers currDoss) + /// + /// Elenco completo tabella Vocabolario + /// + /// + public List VocabolarioGetAll() { - // aggiorno record sul DB - bool answ = await dbController.DossiersUpdateValore(currDoss); - - return answ; + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + List? result = new List(); + string source = "REDIS"; + // cerco in redis... + RedisValue rawData = redisDb.StringGet(redisVocabolario); + if (!string.IsNullOrEmpty($"{rawData}")) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + } + else + { + result = dbController.VocabolarioGetAll(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(redisVocabolario, rawData, getRandTOut(redisLongTimeCache / 5)); + source = "DB"; + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"VocabolarioGetAll Read from {source}: {ts.TotalMilliseconds}ms"); + if (result == null) + { + result = new List(); + } + return result; } #endregion Public Methods @@ -946,7 +1010,9 @@ namespace MP.SPEC.Data #region Private Fields private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier"; + private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList"; + private const string redisBaseAddr = "MP:"; private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config"; @@ -954,23 +1020,34 @@ namespace MP.SPEC.Data private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac"; private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac"; - private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac"; + + private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; + private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; + + private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac"; + private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList"; - private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt"; + private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario"; + private static IConfiguration _configuration = null!; private static ILogger _logger = null!; private static Logger Log = LogManager.GetCurrentClassLogger(); + /// + /// Oggetto vocabolario x uso continuo traduzione + /// + private List ObjVocabolario = new List(); + /// /// Oggetto per connessione a REDIS /// diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index 64c4f598..b31710e7 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.2017 + 6.16.2211.312 diff --git a/MP.SPEC/NLog.config b/MP.SPEC/NLog.config index 3e4185f4..b32ba10a 100644 --- a/MP.SPEC/NLog.config +++ b/MP.SPEC/NLog.config @@ -39,7 +39,7 @@ Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f" --> - + diff --git a/MP.SPEC/Pages/Articoli.razor.cs b/MP.SPEC/Pages/Articoli.razor.cs index ffb568d3..0d45f5de 100644 --- a/MP.SPEC/Pages/Articoli.razor.cs +++ b/MP.SPEC/Pages/Articoli.razor.cs @@ -58,7 +58,7 @@ namespace MP.SPEC.Pages protected MpDataService MDService { get; set; } = null!; [Inject] - protected NavigationManager NavManager { get; set; } + protected NavigationManager NavManager { get; set; } = null!; protected int totalCount { diff --git a/MP.SPEC/Pages/DOSS.razor.cs b/MP.SPEC/Pages/DOSS.razor.cs index 6e08e9c0..af62c038 100644 --- a/MP.SPEC/Pages/DOSS.razor.cs +++ b/MP.SPEC/Pages/DOSS.razor.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DatabaseModels; -using MP.Data.DTO; using MP.SPEC.Components; using MP.SPEC.Data; @@ -11,7 +10,7 @@ namespace MP.SPEC.Pages { #region Protected Fields - protected DataPager pagerODL = null!; + protected DataPager? pagerODL = null!; #endregion Protected Fields @@ -23,7 +22,6 @@ namespace MP.SPEC.Pages [Inject] protected MpDataService MDService { get; set; } = null!; - #endregion Protected Properties #region Protected Methods @@ -58,6 +56,56 @@ namespace MP.SPEC.Pages await Task.Delay(1); } + protected void updateTotal(int newTotCount) + { + totalCount = newTotCount; + } + + protected void UpdateTotCount(int newTotCount) + { + totalCount = newTotCount; + } + + #endregion Protected Methods + + #region Private Properties + + private SelectDossierParams currFilter { get; set; } = new SelectDossierParams(); + + private int currPage + { + get => currFilter.CurrPage; + set => currFilter.CurrPage = value; + } + + private Dossiers? currRecordDoss { get; set; } = null; + + private bool isEditing + { + get => currFilter.isEditing; + set => currFilter.isEditing = value; + } + + private bool isFiltering { get; set; } = false; + + private bool isLoading { get; set; } = true; + + private int numRecord + { + get => currFilter.NumRec; + set => currFilter.NumRec = value; + } + + private int totalCount + { + get => currFilter.TotCount; + set => currFilter.TotCount = value; + } + + #endregion Private Properties + + #region Private Methods + private string css() { string answ = ""; @@ -77,55 +125,6 @@ namespace MP.SPEC.Pages isEditing = true; } - protected void updateTotal(int newTotCount) - { - totalCount = newTotCount; - } - - #endregion Protected Methods - - #region Private Fields - - private FluxLogDTO? _currDetFluxLogRecord = null; - - #endregion Private Fields - - #region Private Properties - - - - private SelectDossierParams currFilter { get; set; } = new SelectDossierParams(); - - private int currPage - { - get => currFilter.CurrPage; - set => currFilter.CurrPage = value; - } - - private Dossiers? currRecordDoss { get; set; } = null; - private bool isFiltering { get; set; } = false; - private bool isLoading { get; set; } = true; - - private int numRecord - { - get => currFilter.NumRec; - set => currFilter.NumRec = value; - } - private bool isEditing - { - get => currFilter.isEditing; - set => currFilter.isEditing = value; - } - private int totalCount - { - get => currFilter.TotCount; - set => currFilter.TotCount = value; - } - - #endregion Private Properties - - #region Private Methods - private async Task updateFilter(SelectDossierParams newParams) { isFiltering = false; @@ -137,10 +136,6 @@ namespace MP.SPEC.Pages currFilter = newParams; isLoading = false; } - protected void UpdateTotCount(int newTotCount) - { - totalCount = newTotCount; - } #endregion Private Methods } diff --git a/MP.SPEC/Pages/Index.razor.cs b/MP.SPEC/Pages/Index.razor.cs index 5d774ba8..0751fffd 100644 --- a/MP.SPEC/Pages/Index.razor.cs +++ b/MP.SPEC/Pages/Index.razor.cs @@ -18,7 +18,7 @@ namespace MP.SPEC.Pages protected MpDataService MDService { get; set; } = null!; [Inject] - protected MessageService MessageService { get; set; } + protected MessageService MessageService { get; set; } = null!; #endregion Protected Properties diff --git a/MP.SPEC/Pages/ODL.razor b/MP.SPEC/Pages/ODL.razor index e1d49972..b31a35a4 100644 --- a/MP.SPEC/Pages/ODL.razor +++ b/MP.SPEC/Pages/ODL.razor @@ -20,9 +20,27 @@ - - - + + @if (filtActive) + { + + @**@ + @if (selMacchina != "*") + { + resetMacchina()" title="Rimuovi Filtro Impianto">   + } + @if (selStato != "*") + { + resetFase()" title="Rimuovi Filtro Parametro">   + } + + } + + + + + + FILTRI diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs index a29dcdd0..1925fb7c 100644 --- a/MP.SPEC/Pages/ODL.razor.cs +++ b/MP.SPEC/Pages/ODL.razor.cs @@ -26,7 +26,7 @@ namespace MP.SPEC.Pages #region Protected Fields - protected DataPager pagerODL = null!; + protected DataPager? pagerODL = null!; #endregion Protected Fields @@ -71,7 +71,19 @@ namespace MP.SPEC.Pages #endregion Protected Properties #region Protected Methods + private bool filtActive + { + get => selMacchina != "*" || selStato != "*"; + } + protected void resetMacchina() + { + selMacchina = "*"; + } + protected void resetFase() + { + selStato = "*"; + } protected void ForceReload(int newNum) { numRecord = newNum; @@ -92,7 +104,11 @@ namespace MP.SPEC.Pages { if (doReset) { - await pagerODL.resetCurrPage(); + await Task.Delay(1); + if (pagerODL != null) + { + pagerODL.resetCurrPage(); + } } } diff --git a/MP.SPEC/Pages/PARAMS.razor.cs b/MP.SPEC/Pages/PARAMS.razor.cs index a04de781..e0598d34 100644 --- a/MP.SPEC/Pages/PARAMS.razor.cs +++ b/MP.SPEC/Pages/PARAMS.razor.cs @@ -9,7 +9,7 @@ namespace MP.SPEC.Pages { #region Protected Fields - protected DataPager pagerODL = null!; + protected DataPager? pagerODL = null!; #endregion Protected Fields @@ -30,7 +30,8 @@ namespace MP.SPEC.Pages currPage = newNum; DateTime adesso = DateTime.Now.AddSeconds(1); var updFilter = currFilter; - updFilter.LiveUpdate = (currPage == 1); + //updFilter.LiveUpdate = (currPage == 1); + updFilter.LiveUpdate = (currFilter.CurrPage == 1); updFilter.lastUpdate = updFilter.LiveUpdate ? "-" : $"{adesso:yyyy/MM/dd HH:mm:ss}"; // salvo filtro currFilter = updFilter; @@ -55,7 +56,11 @@ namespace MP.SPEC.Pages { if (doReset) { - await pagerODL.resetCurrPage(); + await Task.Delay(1); + if (pagerODL != null) + { + pagerODL.resetCurrPage(); + } } } @@ -127,7 +132,7 @@ namespace MP.SPEC.Pages } else { - newParams.LiveUpdate = (currPage == 1); + //newParams.LiveUpdate = (currPage == 1); } await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index edd74ebb..929bc105 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -12,7 +12,7 @@ @if (addEnabled) { - reqNewPODL()">@btnNewText + reqNewPODL()">Nuovo PODL } @@ -21,19 +21,20 @@ @* - @if (ListAziende != null) - { - foreach (var item in ListAziende) - { - @item.DescrGruppo - } - } + @if (ListAziende != null) + { + foreach (var item in ListAziende) + { + @item.DescrGruppo + } + } *@ --- Tutti --- @if (ListStati != null) { + foreach (var item in ListStati) { @item.label @@ -126,7 +127,14 @@ { foreach (var item in ListMacchine) { - @item.IdxMacchina | @item.Descrizione + if (selectFirst(item.IdxMacchina) == true) + { + @item.IdxMacchina | @item.Descrizione + } + else + { + @item.IdxMacchina | @item.Descrizione + } } } diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index 56c65581..379e469d 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -87,7 +87,8 @@ namespace MP.SPEC.Pages { if (doReset) { - await pagerODL.resetCurrPage(); + await Task.Delay(1); + pagerODL.resetCurrPage(); } } @@ -203,6 +204,22 @@ namespace MP.SPEC.Pages } } + private bool selectFirst(string idxMacchina) + { + string firstMacchina=""; + bool answ = false; + if (ListMacchine != null) + { + var rawData = ListMacchine.Select(x => x.IdxMacchina).FirstOrDefault(); + firstMacchina = rawData != null ? rawData : ""; + } + if (firstMacchina == idxMacchina) + { + answ = true; + } + return answ; + } + private string btnNewText { get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL"; diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 2728c632..df775592 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC - Versione: 6.16.2210.2017 + Versione: 6.16.2211.312 Note di rilascio: diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 8564b4af..f4d62064 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.2017 +6.16.2211.312 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 286026b9..f915a747 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.2017 + 6.16.2211.312 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 b/MP.SPEC/Shared/NavMenu.razor index a21d13ba..f0496859 100644 --- a/MP.SPEC/Shared/NavMenu.razor +++ b/MP.SPEC/Shared/NavMenu.razor @@ -38,6 +38,7 @@ { foreach (var item in ElencoLink) { + diff --git a/MP.SPEC/appsettings.json b/MP.SPEC/appsettings.json index 098b7be2..b8e6b52e 100644 --- a/MP.SPEC/appsettings.json +++ b/MP.SPEC/appsettings.json @@ -14,8 +14,8 @@ }, "ServerConf": { "maxAge": "2000", - "cacheCheckArtUsato": 2, - "redisLongTimeCache": 15, + "cacheCheckArtUsato": "2", + "redisLongTimeCache": "15", "MpIoBaseUrl": "http://localhost:20967/" } } diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index d7726462..8683fb68 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,7 +4,7 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2210.1708 + 6.16.2210.2110 @@ -203,6 +203,9 @@ PreserveNewest + + Always + Always diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index 476f07b6..c3a834ed 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO - Versione: 6.16.2210.1708 + Versione: 6.16.2210.2110 Note di rilascio: diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index ccf0292a..148d3a17 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.1708 +6.16.2210.2110 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index e4fe64f1..b9e7e7bc 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.1708 + 6.16.2210.2110 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false