From 900d2edc34ccd8d168f314af3c91795d773f989d Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 25 Nov 2022 11:54:46 +0100 Subject: [PATCH] refresh generale --- MP.Data/DTO/OperatoreDTO.cs | 2 +- MP.INVE/Components/DossiersFilter.razor | 84 ---- MP.INVE/Components/DossiersFilter.razor.cs | 173 -------- MP.INVE/Components/ListDossiers.razor | 339 --------------- MP.INVE/Components/ListDossiers.razor.cs | 459 --------------------- MP.INVE/Data/MpDataService.cs | 197 +++++++-- MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/DOSS.razor | 36 -- MP.INVE/Pages/DOSS.razor.cs | 142 ------- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 16 files changed, 169 insertions(+), 1279 deletions(-) delete mode 100644 MP.INVE/Components/DossiersFilter.razor delete mode 100644 MP.INVE/Components/DossiersFilter.razor.cs delete mode 100644 MP.INVE/Components/ListDossiers.razor delete mode 100644 MP.INVE/Components/ListDossiers.razor.cs delete mode 100644 MP.INVE/Pages/DOSS.razor delete mode 100644 MP.INVE/Pages/DOSS.razor.cs diff --git a/MP.Data/DTO/OperatoreDTO.cs b/MP.Data/DTO/OperatoreDTO.cs index 93f27e5a..eb421c5b 100644 --- a/MP.Data/DTO/OperatoreDTO.cs +++ b/MP.Data/DTO/OperatoreDTO.cs @@ -11,6 +11,6 @@ namespace MP.Data.DTO public int MatrOpr { get; set; } = 0; public string Cognome { get; set; } = ""; public string Nome { get; set; } = ""; - public string hashAuthKey { get; set; } + public string hashAuthKey { get; set; } = ""; } } diff --git a/MP.INVE/Components/DossiersFilter.razor b/MP.INVE/Components/DossiersFilter.razor deleted file mode 100644 index d8607670..00000000 --- a/MP.INVE/Components/DossiersFilter.razor +++ /dev/null @@ -1,84 +0,0 @@ -
-
- @if (filtActive) - { -
- @**@ - @if (selMacchina != "*") - { - - } - @if (selArticolo != "*") - { - - } -
- } -
- - - -
-
-
-
-

FILTRI

- -
-
-
- Seleziona i filtri per: -
-
- -
-
- - -
-
- -
-
- - -
- -
- -
-
- - -
-
- -
-
- - -
-
-
-
- - - diff --git a/MP.INVE/Components/DossiersFilter.razor.cs b/MP.INVE/Components/DossiersFilter.razor.cs deleted file mode 100644 index 1a513f8c..00000000 --- a/MP.INVE/Components/DossiersFilter.razor.cs +++ /dev/null @@ -1,173 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MP.INVE.Data; - -namespace MP.INVE.Components -{ - public partial class DossiersFilter - { - #region Public Properties - - [Parameter] - public EventCallback FilterChanged { get; set; } - - [Parameter] - public SelectDossierParams SelFilterDossier { get; set; } = null!; - - #endregion Public Properties - - #region Protected Properties - - [Inject] - protected MpDataService MDService { get; set; } = null!; - - protected string selArticolo - { - get - { - return SelFilterDossier.CodArticolo; - } - set - { - if (!SelFilterDossier.CodArticolo.Equals(value)) - { - SelFilterDossier.CurrPage = 1; - SelFilterDossier.CodArticolo = value; - StateHasChanged(); - Task.Delay(1); - reportChange(); - } - } - } - private bool filtActive - { - get => selMacchina != "*" || selArticolo != "*"; - } - protected void resetMacchina() - { - selMacchina = "*"; - } - protected void resetArticolo() - { - selArticolo = "*"; - } - protected DateTime selDtMax - { - get - { - return SelFilterDossier.DtEnd; - } - - set - { - if (!SelFilterDossier.DtEnd.Equals(value)) - { - SelFilterDossier.DtEnd = value; - reportChange(); - } - } - } - - protected DateTime selDtMin - { - get - { - return SelFilterDossier.DtStart; - } - - set - { - if (!SelFilterDossier.DtStart.Equals(value)) - { - SelFilterDossier.DtStart = value; - reportChange(); - } - } - } - - protected string selMacchina - { - get - { - return SelFilterDossier.IdxMacchina; - } - set - { - if (!SelFilterDossier.IdxMacchina.Equals(value)) - { - SelFilterDossier.CurrPage = 1; - SelFilterDossier.IdxMacchina = value; - StateHasChanged(); - Task.Delay(1); - reportChange(); - } - } - } - - protected int selMaxRecord - { - get - { - return SelFilterDossier.MaxRecord; - } - - set - { - if (!SelFilterDossier.MaxRecord.Equals(value)) - { - SelFilterDossier.MaxRecord = value; - reportChange(); - } - } - } - - protected bool showParam { get; set; } = false; - - #endregion Protected Properties - - #region Protected Methods - - protected override async Task OnInitializedAsync() - { - SelFilterDossier = new SelectDossierParams(); - DateTime dtEnd = SelFilterDossier.DtEnd; - DateTime dtStart = dtEnd.Subtract(SelFilterDossier.DtStart).TotalDays < 15 ? SelFilterDossier.DtStart : dtEnd.AddDays(-14); - ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd); - ListArticoli = await MDService.ArticleWithDossier(); - await FilterChanged.InvokeAsync(SelFilterDossier); - } - - protected void toggleParams() - { - showEditPar = !showEditPar; - } - - #endregion Protected Methods - - #region Private Fields - - private List? ListArticoli = null; - private List? ListMacchine = null; - - #endregion Private Fields - - #region Private Properties - - private bool showEditPar { get; set; } = false; - - #endregion Private Properties - - #region Private Methods - - private void reportChange() - { - FilterChanged.InvokeAsync(SelFilterDossier); - } - - private void toggleShowParams() - { - showParam = !showParam; - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP.INVE/Components/ListDossiers.razor b/MP.INVE/Components/ListDossiers.razor deleted file mode 100644 index 1db332f6..00000000 --- a/MP.INVE/Components/ListDossiers.razor +++ /dev/null @@ -1,339 +0,0 @@ -@using MP.INVE.Components -@using MP.INVE.Data - - - - -@if (ListRecords == null) -{ - -} -else if (totalCount == 0) -{ -
Nessun record trovato
-} -else -{ - - @if (currFluxLogDto != null) - { -
-
-
-
-
- Modifica Parametro -
-
- @if (isEditing) - { - PENDING CHANGES... - } -
-
-
-
-
-
- MACCHINA - -
-
-
-
- DATA - -
-
-
-
- DATA TYPE - -
-
-
-
- VALORE - -
-
-
-
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
- } - - - - @if (currRecordClone != null) - { -
-
-
-
-
- Nuovo Dossier -
-
-
- -
-
-
- MACCHINA - -
-
-
-
- FASE - -
-
- -
-
- ARTICOLI - - -
-
-
- - - -
-
-
-
-
-
-
- -
-
-
-
- -
-
-
-
-
-
-
- } - - - - - - - - - - -
-
- - - - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - - - } - -
-
- - @if (currRecord != null) - { - - - } -
-
Articolo Fase Macchina Data Snap ODL
- @if (isEditing == false) - { - - - - @**@ - } - else - { - - } - - @record.CodArticolo -
@record.ArticoloNav.DescArticolo
-
- @tradFase(record.KeyRichiesta) - - @record.IdxMacchina - @*
@record.MachineNav.Descrizione
*@ -
- @record.DtRif - - @record.IdxODL - - @if (isEditing == false) - { - - - } - else - { - - - } -
- - @if (!visualizzaFlux) - { - if (listaFlux == null) - { -
Nessun record trovato
- } - else - { -
- - - - - - - - - - - - @foreach (var record in listaFlux) - { - - - - - - - - } - -
- - Macchina Data Data Type - Valore -
- - - @record.IdxMacchina - - @record.dtEvento - - @traduci(record.CodFlux) -
@record.CodFlux
-
- @if (record.ValoreEdit != record.Valore) - { -
@record.ValoreEdit
-
(@record.Valore)
- } - else - { -
@record.ValoreEdit
- } -
-
- } - } -
-
-} - - - - - - diff --git a/MP.INVE/Components/ListDossiers.razor.cs b/MP.INVE/Components/ListDossiers.razor.cs deleted file mode 100644 index 1973f623..00000000 --- a/MP.INVE/Components/ListDossiers.razor.cs +++ /dev/null @@ -1,459 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using MP.Data.DatabaseModels; -using MP.Data.DTO; -using MP.INVE.Data; -using Newtonsoft.Json; - -namespace MP.INVE.Components -{ - public partial class ListDossiers : IDisposable - { - #region Public Properties - - [Parameter] - public EventCallback RecordSel { get; set; } - - [Parameter] - public EventCallback RecordSelFlux { get; set; } - - [Parameter] - public SelectDossierParams SelFilter { get; set; } = null!; - - [Parameter] - public EventCallback TotRecordChanged { get; set; } - - #endregion Public Properties - - #region Public Methods - - public string checkSelect(DossierModel recordSel) - { - string answ = ""; - if (currRecord != null) - { - try - { - answ = (currRecord.IdxMacchina == recordSel.IdxMacchina && currRecord.DtRif == recordSel.DtRif) ? "table-info" : ""; - } - catch - { } - } - return answ; - } - - public string checkSelPar(FluxLogDTO recordSel) - { - string answ = ""; - if (currFluxLogDto != null) - { - try - { - answ = (currFluxLogDto.CodFlux == recordSel.CodFlux && currFluxLogDto.dtEvento == recordSel.dtEvento) ? "table-info" : ""; - } - catch - { } - } - return answ; - } - - public void Dispose() - { - currRecord = null; - SearchRecords = null; - ListRecords = null; - GC.Collect(); - } - - public async Task flushCache() - { - await Task.Delay(1); - await MDService.FlushRedisCache(); - await Task.Delay(1); - // rimando a pagina corrente - NavManager.NavigateTo(NavManager.Uri, true); - } - - #endregion Public Methods - - #region Protected Properties - - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - [Inject] - protected MpDataService MDService { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - - protected async Task cancel() - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler annullare TUTTE le modifiche? i dati saranno ricaricati."); - if (alert) - { - currFluxLogDto = null; - isEditing = false; - await Task.Delay(1); - if (currRecord != null) - { - listaFlux = MDService.getFluxLog(currRecord.Valore); - } - StateHasChanged(); - } - } - - protected async Task cancelNewDoss() - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler annullare l'aggiunta di un nuovo dossier? i dati saranno ricaricati."); - if (alert) - { - currRecordClone = null; - isEditing = false; - await Task.Delay(1); - StateHasChanged(); - } - } - - protected async Task cloneRecord(DossierModel selRec) - { - // creo record duplicato... - DossierModel newRec = new DossierModel() - { - //IdxDossier = 0, - DataType = selRec.DataType, - KeyRichiesta = selRec.KeyRichiesta, - DtRif = DateTime.Now, - IdxMacchina = selRec.IdxMacchina, - CodArticolo = selRec.CodArticolo, - IdxODL = 0, - Valore = selRec.Valore - }; - currRecordClone = newRec; - await Task.Delay(1); - } - - /// - /// Eliminazione record selezionato (previa conferma) - /// - /// - /// - protected async Task deleteRecord(DossierModel selRec) - { - if (!await JSRuntime.InvokeAsync("confirm", "Eliminazione Dossier: sei sicuro di voler procedere?")) - return; - await Task.Delay(1); - var done = await MDService.DossiersDeleteRecord(selRec); - currRecord = null; - await reloadData(true); - visualizzaFlux = true; - await Task.Delay(1); - } - - protected async Task editRecord(FluxLogDTO selRec) - { - currFluxLogDto = selRec; - // indico record selezionato - await RecordSelFlux.InvokeAsync(selRec); - } - - protected async Task newDossier(DossierModel selRec) - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezionato?"); - - if (alert) - { - await Task.Delay(1); - if (currRecordClone != null) - { - // serializzo valore x flux log... - - DossierFluxLogDTO? valoreDeserializzato = JsonConvert.DeserializeObject(selRec.Valore); - if (valoreDeserializzato != null) - { - listaFlux = valoreDeserializzato - .ODL - .OrderBy(x => x.CodFlux) - .ToList(); - } - - if (listaFlux != null) - { - foreach (var item in listaFlux) - { - item.IdxMacchina = selRec.IdxMacchina; - item.Valore = "0"; - item.ValoreEdit = "0"; - item.dtEvento = DateTime.Now; - } - } - - DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux }; - string newVal = JsonConvert.SerializeObject(updatedResult); - // preparo x insert - currRecordClone.DtRif = DateTime.Now; - currRecordClone.IdxMacchina = selRec.IdxMacchina; - currRecordClone.CodArticolo = selRec.CodArticolo; - currRecordClone.KeyRichiesta = selRec.KeyRichiesta; - currRecordClone.Valore = newVal; - // METODO PER INSERT DOSSIER + FLUX - await MDService.DossiersInsert(currRecordClone); - //await reloadData(true); - currRecordClone = null; - isEditing = false; - await Task.Delay(1); - await flushCache(); - } - return; - } - else - { - currRecordClone = null; - await Task.Delay(1); - NavManager.NavigateTo(NavManager.Uri, true); - } - } - - protected override async Task OnInitializedAsync() - { - ListGruppiFase = await MDService.ElencoGruppiFase(); - ListStati = await MDService.AnagStatiComm(); - ListArticoli = await MDService.ArticoliGetSearch(100000, "BAGLIETTO", ""); - ListMacchine = await MDService.MacchineGetAll(); - await reloadData(true); - } - - protected override async Task OnParametersSetAsync() - { - if (!lastFilter.Equals(SelFilter)) - { - lastFilter = SelFilter.clone(); - await reloadData(true); - } - } - - protected async void OnSeachUpdated() - { - await InvokeAsync(() => - { - currPage = 1; - StateHasChanged(); - }); - } - - protected async Task selRecord(DossierModel selRec) - { - currRecord = selRec; - await RecordSel.InvokeAsync(selRec); - listaFlux = MDService.getFluxLog(selRec.Valore); - await toggleTableFlux(); - } - - protected async Task update(FluxLogDTO selRec) - { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler salvare TUTTE le modifiche? queste saranno parte del dossier inviato all'impianto"); - - if (alert) - { - await Task.Delay(1); - if (currRecord != null) - { - // serializzo valore x flux log... - DossierFluxLogDTO updatedResult = new DossierFluxLogDTO() { ODL = listaFlux }; - string newVal = JsonConvert.SerializeObject(updatedResult); - currRecord.Valore = newVal; - // METODO PER UPDATE FLUX - await MDService.DossiersUpdateValore(currRecord); - currFluxLogDto = null; - isEditing = false; - await Task.Delay(1); - StateHasChanged(); - } - return; - } - else - { - currFluxLogDto = null; - await Task.Delay(1); - // rimando a pagina corrente - NavManager.NavigateTo(NavManager.Uri, true); - } - } - - protected async Task UpdateData() - { - currRecord = null; - await reloadData(true); - } - - #endregion Protected Methods - - #region Private Fields - - private int _totalCount = 0; - - private FluxLogDTO? currFluxLogDto = null; - - private DossierModel? currRecord = null; - - private DossierModel? currRecordClone = null; - - private List? ListArticoli; - private List? ListGruppiFase; - - private List? ListMacchine; - private List? ListRecords; - - private List? ListStati; - - private List? SearchRecords; - - #endregion Private Fields - - #region Private Properties - - private int currPage - { - get => SelFilter.CurrPage; - set => SelFilter.CurrPage = value; - } - - private bool isEditing - { - get => SelFilter.isEditing; - set => SelFilter.isEditing = value; - } - - private bool isLoading { get; set; } = false; - - private SelectDossierParams lastFilter { get; set; } = new SelectDossierParams() { CurrPage = -1 }; - - private List? listaFlux { get; set; } = null; - - private int MaxRecord - { - get => SelFilter.MaxRecord; - } - - [Inject] - private NavigationManager NavManager { get; set; } = null!; - - private int numRecord - { - get => SelFilter.NumRec; - set => SelFilter.NumRec = value; - } - - private string SelArticolo - { - get => SelFilter.CodArticolo; - } - - private DateTime SelDtEnd - { - get => SelFilter.DtEnd; - } - - private DateTime SelDtStart - { - get => SelFilter.DtStart; - } - - private string SelMacchina - { - get => SelFilter.IdxMacchina; - } - - private int totalCount - { - get => _totalCount; - set - { - if (_totalCount != value) - { - _totalCount = value; - TotRecordChanged.InvokeAsync(value); - } - } - } - - private bool visualizzaFlux { get; set; } = true; - - #endregion Private Properties - - #region Private Methods - - private async Task closeTableFlux() - { - currFluxLogDto = null; - currRecord = null; - currRecordClone = null; - visualizzaFlux = true; - isEditing = false; - await RecordSelFlux.InvokeAsync(currFluxLogDto); - await Task.Delay(1); - } - - private string css() - { - string answ = ""; - if (isEditing) - { - answ = "visible"; - } - else - { - answ = "hidden"; - } - return answ; - } - - private void enableEditing() - { - isEditing = true; - } - - private async Task reloadData(bool setChanged) - { - isLoading = true; - SearchRecords = await MDService.DossiersGetLastFilt(SelMacchina, SelArticolo, SelDtStart, SelDtEnd); - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - await Task.Delay(1); - if (setChanged) - { - await InvokeAsync(() => StateHasChanged()); - } - isLoading = false; - } - - private async Task toggleTableFlux() - { - visualizzaFlux = false; - await Task.Delay(1); - } - - private string tradFase(string codFase) - { - string answ = codFase; - if (ListStati != null && ListStati.Count > 0) - { - var recSel = ListStati.FirstOrDefault(x => x.value == codFase); - if (recSel != null) - { - answ = recSel.label; - } - } - return answ; - } - - private string traduci(string lemma) - { - var answ = MDService.Traduci(lemma, "IT"); - return answ; - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP.INVE/Data/MpDataService.cs b/MP.INVE/Data/MpDataService.cs index e44df918..4e6329a8 100644 --- a/MP.INVE/Data/MpDataService.cs +++ b/MP.INVE/Data/MpDataService.cs @@ -312,6 +312,27 @@ namespace MP.INVE.Data return result; } + /// + /// Restituisce valore della stringa (SE disponibile) + /// + /// + /// + public async Task tryGetConfig(string keyName) + { + string answ = ""; + // preselezione valori + var configData = await ConfigGetAll(); + var currRec = configData.FirstOrDefault(x => x.Chiave == keyName); + if (currRec != null) + { + answ = currRec.Valore; + } + + return answ; + } + + + /// /// Reset dati cache config /// @@ -478,13 +499,42 @@ namespace MP.INVE.Data /// public Task> ElencoGruppiFase() { - return Task.FromResult(dbController.AnagGruppiFase()); +#if false + return Task.FromResult(dbController.AnagGruppiFase()); +#endif + List result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisAnagGruppi}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = dbController.AnagGruppiFase(); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache / 5)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ElencoGruppiFase | Read from {readType}: {ts.TotalMilliseconds}ms"); + return Task.FromResult(result); } - //public Task> ElencoLink() - //{ - // return Task.FromResult(dbController.ElencoLink()); - //} + public Task> ElencoLink() + { + return Task.FromResult(dbController.ElencoLink()); + } /// /// Aggiunta record EventList @@ -506,6 +556,7 @@ namespace MP.INVE.Data return answ; } + /// /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione) /// @@ -515,7 +566,7 @@ namespace MP.INVE.Data /// *=tutti, altrimenti solo selezionato /// numero massimo record da restituire /// - public async Task> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec) + public async Task> FluxLogGetLastFilt(DateTime DtMax, DateTime DtMin, string IdxMacchina, string CodFlux, int MaxRec, int redisCacheSec) { List? result = new List(); Stopwatch stopWatch = new Stopwatch(); @@ -534,7 +585,7 @@ namespace MP.INVE.Data result = await Task.FromResult(dbController.FluxLogGetLastFilt(DtMax, DtMin, IdxMacchina, CodFlux, MaxRec)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(10)); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisCacheSec / 2)); } if (result == null) { @@ -600,11 +651,43 @@ namespace MP.INVE.Data /// Stato ODL: true=in corso/completato /// Cod articolo /// KeyRich (parziale) da cercare (es cod stato x yacht) - /// id macchina da cercare + /// Reparto selezionato + /// Macchina selezionata + /// Data inizio + /// Data fine /// - public async Task> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string IdxMacchina, DateTime startDate, DateTime endDate) + public async Task> ListODLFilt(bool inCorso, string codArt, string keyRichPart, string Reparto, string IdxMacchina, DateTime startDate, DateTime endDate) { - return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, IdxMacchina, startDate, endDate)); + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisOdlList}:{inCorso}:{codArt}:{keyRichPart}:{Reparto}:{IdxMacchina}:{startDate:yyyyMMdd_HHmmss}:{endDate:yyyyMMdd_HHmmss}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + + + //return await Task.FromResult(dbController.ListODLFilt(inCorso, codArt, keyRichPart, Reparto, IdxMacchina, startDate, endDate)); } /// @@ -613,13 +696,51 @@ namespace MP.INVE.Data /// Cod articolo /// KeyRich (parziale) da cercare (es cod stato x yacht) /// - public async Task> ListPODLFilt(string codArt, string keyRichPart) + public async Task> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo) + { + List? result = new List(); + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + string readType = "DB"; + string currKey = $"{redisPOdlList}:{lanciato}:{keyRichPart}:{idxMacchina}:{codGruppo}"; + // cerco in redis dato valore sel macchina... + RedisValue rawData = redisDb.StringGet(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + readType = "REDIS"; + } + else + { + result = await Task.FromResult(dbController.ListPODLFilt(lanciato, keyRichPart, idxMacchina, codGruppo)); + // serializzo e salvo... + rawData = JsonConvert.SerializeObject(result); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); + } + if (result == null) + { + result = new List(); + } + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); + return result; + } + + + /// + /// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato) + /// + /// Cod articolo + /// KeyRich (parziale) da cercare (es cod stato x yacht) + /// + public async Task> ListPODLFiltNOOdl(string codArt, string keyRichPart) { List? result = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; - string currKey = $"{redisPOdlList}:{codArt}:{keyRichPart}"; + string currKey = $"{redisPOdlListNOOdl}:{codArt}:{keyRichPart}"; // cerco in redis dato valore sel macchina... RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) @@ -629,7 +750,7 @@ namespace MP.INVE.Data } else { - result = await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart)); + result = await Task.FromResult(dbController.ListPODLFiltNOOdl(codArt, keyRichPart)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3)); @@ -640,7 +761,7 @@ namespace MP.INVE.Data } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); + Log.Debug($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; } @@ -872,7 +993,7 @@ namespace MP.INVE.Data } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms"); + Log.Trace($"PODL_getByKey | Read from {readType}: {ts.TotalMilliseconds}ms"); } else { @@ -915,7 +1036,7 @@ namespace MP.INVE.Data } stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms"); + Log.Trace($"PODL_getByOdl | Read from {readType}: {ts.TotalMilliseconds}ms"); } else { @@ -929,7 +1050,7 @@ namespace MP.INVE.Data /// /// /// - public async Task PODLDeleteRecord(PODLModel currRec) + public async Task PODLDeleteRecord(PODLExpModel currRec) { return await dbController.PODLDeleteRecord(currRec); } @@ -939,7 +1060,7 @@ namespace MP.INVE.Data /// /// /// - public async Task POdlDoSetup(PODLModel currRec) + public async Task POdlDoSetup(PODLExpModel currRec) { return await dbController.PODL_startSetup(currRec, 0, 1, 1, ""); } @@ -949,7 +1070,7 @@ namespace MP.INVE.Data /// /// /// - public async Task POdlUpdateRecord(PODLModel currRec) + public async Task POdlUpdateRecord(PODLExpModel currRec) { var dbResult = await dbController.PODLUpdateRecord(currRec); // elimino cache redis... @@ -1090,37 +1211,38 @@ namespace MP.INVE.Data #region Private Fields - private const string redisArtByDossier = redisBaseAddr + ":Cache:ArtByDossier"; + private const string redisAnagGruppi = redisBaseAddr + "SPEC:Cache:AnagGruppi"; - private const string redisArtList = redisBaseAddr + ":Cache:ArtList"; + private const string redisArtByDossier = redisBaseAddr + "SPEC:Cache:ArtByDossier"; - private const string redisBaseAddr = "MP:SPEC"; + private const string redisArtList = redisBaseAddr + "SPEC:Cache:ArtList"; - private const string redisConfKey = redisBaseAddr + ":Cache:Config"; + private const string redisBaseAddr = "MP:"; - private const string redisDossByMac = redisBaseAddr + ":Cache:DossByMac"; + private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config"; - private const string redisFluxByMac = redisBaseAddr + ":Cache:FluxByMac"; + private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac"; - private const string redisFluxLogFilt = redisBaseAddr + ":Cache:FluxLogFilt"; + private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac"; - private const string redisMacByFlux = redisBaseAddr + ":Cache:MacByFlux"; + private const string redisFluxLogFilt = redisBaseAddr + "SPEC:Cache:FluxLogFilt"; - private const string redisMacList = redisBaseAddr + ":Cache:MacList"; + private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux"; - private const string redisOdlCurrByMac = redisBaseAddr + ":Cache:OdlByMac"; + private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList"; - private const string redisPOdlList = redisBaseAddr + ":Cache:POdlList"; + private const string redisOdlCurrByMac = redisBaseAddr + "SPEC:Cache:OdlByMac"; + private const string redisOdlList = redisBaseAddr + "SPEC:Cache:OdlList"; - private const string redisPOdlByPOdl = redisBaseAddr + ":Cache:POdlByPOdl"; + private const string redisPOdlByOdl = redisBaseAddr + "SPEC:Cache:POdlByOdl"; + private const string redisPOdlByPOdl = redisBaseAddr + "SPEC:Cache:POdlByPOdl"; + private const string redisPOdlList = redisBaseAddr + "SPEC:Cache:POdlList"; + private const string redisPOdlListNOOdl = redisBaseAddr + "SPEC:Cache:POdlListNOOdl"; + private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom"; - private const string redisPOdlByOdl = redisBaseAddr + ":Cache:POdlByOdl"; + private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt"; - private const string redisStatoCom = redisBaseAddr + ":Cache:StatoCom"; - - private const string redisTipoArt = redisBaseAddr + ":Cache:TipoArt"; - - private const string redisVocabolario = redisBaseAddr + ":Cache:Vocabolario"; + private const string redisVocabolario = redisBaseAddr + "SPEC:Cache:Vocabolario"; private static IConfiguration _configuration = null!; @@ -1149,6 +1271,7 @@ namespace MP.INVE.Data private IDatabase redisDb = null!; private int redisLongTimeCache = 5; + private int redisShortTimeCache = 4; #endregion Private Fields diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 3bbca691..cd614fb4 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2211.2409 + 6.16.2211.2511 diff --git a/MP.INVE/Pages/DOSS.razor b/MP.INVE/Pages/DOSS.razor deleted file mode 100644 index edbc2926..00000000 --- a/MP.INVE/Pages/DOSS.razor +++ /dev/null @@ -1,36 +0,0 @@ -@page "/DOSS" - -
-
-
-
-

DOSSIERS

-
-
- @if (isFiltering) - { - - filtro x macchina / periodo - } - else - { - - - } -
-
-
-
- @if (isLoading) - { - - } - else - { - - } -
- -
diff --git a/MP.INVE/Pages/DOSS.razor.cs b/MP.INVE/Pages/DOSS.razor.cs deleted file mode 100644 index f73a37ab..00000000 --- a/MP.INVE/Pages/DOSS.razor.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using MP.Data.DatabaseModels; -using MP.INVE.Components; -using MP.INVE.Data; - -namespace MP.INVE.Pages -{ - public partial class DOSS - { - #region Protected Fields - - protected DataPager? pagerODL = null!; - - #endregion Protected Fields - - #region Protected Properties - - [Inject] - protected IJSRuntime JSRuntime { get; set; } = null!; - - [Inject] - protected MpDataService MDService { get; set; } = null!; - - #endregion Protected Properties - - #region Protected Methods - - protected void ForceReload(int newNum) - { - numRecord = newNum; - } - - protected void ForceReloadPage(int newNum) - { - currPage = newNum; - StateHasChanged(); - } - - protected override async Task OnInitializedAsync() - { - isLoading = true; - isFiltering = true; - // fix pagina - await Task.Delay(1); - var modFilter = currFilter; - modFilter.CurrPage = 1; - currFilter = modFilter; - await Task.Delay(1); - isFiltering = false; - } - - protected async Task selRecordDoss(DossierModel selDoss) - { - currRecordDoss = selDoss; - 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 DossierModel? 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 = ""; - if (isEditing == false) - { - answ = "hidden"; - } - else - { - answ = "visible"; - } - return answ; - } - - private void enableEditing() - { - isEditing = true; - } - - private async Task updateFilter(SelectDossierParams newParams) - { - isFiltering = false; - isLoading = true; - await Task.Delay(1); - currPage = 1; - await Task.Delay(1); - await InvokeAsync(() => StateHasChanged()); - currFilter = newParams; - isLoading = false; - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index e04041b3..c76269ce 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2211.2409

+

Versione: 6.16.2211.2511


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 994b8650..aa57caba 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2409 +6.16.2211.2511 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 9e7d53cd..128741b4 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2409 + 6.16.2211.2511 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index f504fa4f..bc527dfa 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2508 + 6.16.2211.2511 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 8f084fb1..8b2ffb41 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

    Versione: 6.16.2211.2508

    +

    Versione: 6.16.2211.2511


    Note di rilascio:
    • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 232fe766..aa57caba 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2508 +6.16.2211.2511 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 91d7c675..344fe68c 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2508 + 6.16.2211.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