diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index 5383c22b..33b5ba9f 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -595,8 +595,10 @@ namespace MP.Data.Controllers /// /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) /// - /// Cod articolo + /// Solo lanciati (1) o ancora disponibili (0) /// KeyRich (parziale) da cercare (es cod stato x yacht) + /// Macchina + /// Gruppo /// public List ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo) { @@ -604,28 +606,18 @@ namespace MP.Data.Controllers List dbResult = new List(); using (var dbCtx = new MoonProContext(_configuration)) { - var Lanciato = new SqlParameter("@Lanciato", lanciato); + var Lanc = new SqlParameter("@Lanciato", lanciato); var KeyRich = new SqlParameter("@KeyRich", keyRichPart); - var CodGruppo = new SqlParameter("@CodGruppo", codGruppo); var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); + var CodGrp = new SqlParameter("@CodGruppo", codGruppo); dbResult = dbCtx .DbSetPODLExp - .FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina", Lanciato, KeyRich, CodGruppo, IdxMacc) + .FromSqlRaw("EXEC stp_PODL_getByFiltSpec @Lanciato, @KeyRich, @CodGruppo, @IdxMacchina", Lanc, KeyRich, CodGrp, IdxMacc) .AsNoTracking() //.AsEnumerable() .ToList(); } -#if false - dbResult = dbCtx - .DbSetPODL - .Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt))) - .AsNoTracking() - .Include(m => m.MachineNav) - .Include(a => a.ArticoloNav) - .OrderByDescending(x => x.InsertDate) - .ToList(); -#endif return dbResult; } 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/CodeScan.razor b/MP.INVE/Components/CodeScan.razor index 87285322..5e0b794a 100644 --- a/MP.INVE/Components/CodeScan.razor +++ b/MP.INVE/Components/CodeScan.razor @@ -1,5 +1,5 @@  - + @if (rawScan != null) { 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/Components/ProcOperat.razor b/MP.INVE/Components/ProcOperat.razor index 221eceda..801609d8 100644 --- a/MP.INVE/Components/ProcOperat.razor +++ b/MP.INVE/Components/ProcOperat.razor @@ -9,9 +9,8 @@ elenco di buttons che servono a confermare operazione: *@
- - - + +
diff --git a/MP.INVE/Components/ProcSuggestion.razor b/MP.INVE/Components/ProcSuggestion.razor index 3373b414..1381b0bf 100644 --- a/MP.INVE/Components/ProcSuggestion.razor +++ b/MP.INVE/Components/ProcSuggestion.razor @@ -23,14 +23,19 @@
  • Lotto: @udc.lottoNav.Lotto
  • Articolo: @udc.lottoNav.CodArt
  • -
  • Quantità: @Math.Round(udc.Qta, 0) pz.
  • +
  • + Quantità: +
    + +
    +
+
+ +
-
- -
} else { 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..71ae1822 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.2513 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..ccac4bba 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.2513


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index 994b8650..39f901eb 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2409 +6.16.2211.2513 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 9e7d53cd..90627f44 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2409 + 6.16.2211.2513 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/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 63a6533b..35159bb7 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -12,7 +12,7 @@ namespace MP.SPEC.Components #region Public Properties [Parameter] - public SelectOdlParams currFilter { get; set; } = null!; + public SelectXdlParams currFilter { get; set; } = null!; [Parameter] public string padCodXdl { get; set; } = "0000"; @@ -409,7 +409,7 @@ namespace MP.SPEC.Components private async Task reloadData() { isLoading = true; - SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodStato, currFilter.CodReparto, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd); + SearchRecords = await MDService.ListODLFilt(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); diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index b5a7d77e..73730092 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -4,7 +4,6 @@ using MP.Data.DatabaseModels; using MP.SPEC.Data; using MP.SPEC.Services; using NLog; -using StackExchange.Redis; namespace MP.SPEC.Components { @@ -13,7 +12,7 @@ namespace MP.SPEC.Components #region Public Properties [Parameter] - public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams(); + public SelectXdlParams actFilter { get; set; } = new SelectXdlParams(); [Parameter] public string padCodXdl { get; set; } = "0000"; @@ -68,6 +67,9 @@ namespace MP.SPEC.Components [Inject] protected IOApiService MpIoApiCall { get; set; } = null!; + [Inject] + protected NavigationManager NavManager { get; set; } = null!; + #endregion Protected Properties #region Protected Methods @@ -208,10 +210,6 @@ namespace MP.SPEC.Components } } - - [Inject] - protected NavigationManager NavManager { get; set; } = null!; - protected async Task UpdateData() { currRecord = null; @@ -253,18 +251,12 @@ namespace MP.SPEC.Components private bool hasOdl { - get => actFilter.hasOdl; - set => actFilter.hasOdl = value; + get => actFilter.HasOdl; + set => actFilter.HasOdl = value; } private bool isLoading { get; set; } = false; - private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams() { CurrPage = -1 }; - - private int numRecord - { - get => actFilter.NumRec; - set => actFilter.NumRec = value; - } + private SelectXdlParams lastFilter { get; set; } = new SelectXdlParams() { CurrPage = -1 }; private string macchina { @@ -272,22 +264,28 @@ namespace MP.SPEC.Components set => actFilter.IdxMacchina = value; } + private int numRecord + { + get => actFilter.NumRec; + set => actFilter.NumRec = value; + } + private string reparto { get => actFilter.CodReparto; set => actFilter.CodReparto = value; } - private string StatoSel - { - get => actFilter.CodFase; - set => actFilter.CodFase = value; - } private string SearchVal { get => string.IsNullOrEmpty(actFilter.SearchVal) ? "*" : actFilter.SearchVal; } + private string StatoSel + { + get => actFilter.CodFase; + set => actFilter.CodFase = value; + } private int totalCount { @@ -415,15 +413,6 @@ namespace MP.SPEC.Components { ListRecords = null; isLoading = true; -#if false - if (hasOdl) - { - SearchRecords = await MDService.ListPODLFiltNOOdl(SearchVal, StatoSel); - } - else - { - } -#endif SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, reparto); totalCount = SearchRecords.Count; ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); diff --git a/MP.SPEC/Components/SelFilterPODL.razor.cs b/MP.SPEC/Components/SelFilterPODL.razor.cs index 667dee76..7ac096f7 100644 --- a/MP.SPEC/Components/SelFilterPODL.razor.cs +++ b/MP.SPEC/Components/SelFilterPODL.razor.cs @@ -1,3 +1,4 @@ +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.SPEC.Data; @@ -27,6 +28,21 @@ namespace MP.SPEC.Components #region Protected Properties + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + protected async Task getReparto() + { + string keyStor = "reparto"; + string localReparto = await localStorage.GetItemAsync(keyStor); + if (!string.IsNullOrEmpty(localReparto)) + { + selReparto = localReparto; + } + else + { + await localStorage.SetItemAsync(keyStor, selReparto); + } + } protected bool hasOdl { get => currFilter.hasOdl; @@ -78,7 +94,12 @@ namespace MP.SPEC.Components } } } - + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + //selReparto = localStorage.GetItemAsync("reparto").ToString(); + await getReparto(); + } #endregion Private Properties #region Private Methods diff --git a/MP.SPEC/Components/SelFilterXDL.razor b/MP.SPEC/Components/SelFilterXDL.razor index 725429e9..891c9f2e 100644 --- a/MP.SPEC/Components/SelFilterXDL.razor +++ b/MP.SPEC/Components/SelFilterXDL.razor @@ -42,7 +42,7 @@ { foreach (var item in ListMacchine) { - + } } @@ -67,7 +67,7 @@ - @if (!isActive) + @if (!isActive || hasOdl) {
    diff --git a/MP.SPEC/Components/SelFilterXDL.razor.cs b/MP.SPEC/Components/SelFilterXDL.razor.cs index 3cfd8408..039b0c0b 100644 --- a/MP.SPEC/Components/SelFilterXDL.razor.cs +++ b/MP.SPEC/Components/SelFilterXDL.razor.cs @@ -1,3 +1,4 @@ +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.SPEC.Data; @@ -9,16 +10,16 @@ namespace MP.SPEC.Components #region Public Properties [Parameter] - public SelectOdlParams currFilter { get; set; } = new SelectOdlParams(); + public SelectXdlParams currFilter { get; set; } = new SelectXdlParams(); [Parameter] - public EventCallback FilterChanged { get; set; } + public EventCallback FilterChanged { get; set; } [Parameter] public List? ListGruppiFase { get; set; } = null; [Parameter] - public List? ListMacchine { get; set; } = null; + public List? ListMacchine { get; set; } = null; [Parameter] public List? ListStati { get; set; } = null; @@ -27,11 +28,19 @@ namespace MP.SPEC.Components #region Protected Properties + protected bool hasOdl + { + get => currFilter.HasOdl; + } + protected bool isActive { get => currFilter.IsActive; } + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + protected DateTime selDtEnd { get => currFilter.DtEnd; @@ -62,6 +71,29 @@ namespace MP.SPEC.Components #endregion Protected Properties + #region Protected Methods + + protected async Task getReparto() + { + string keyStor = "reparto"; + string localReparto = await localStorage.GetItemAsync(keyStor); + if (!string.IsNullOrEmpty(localReparto)) + { + selReparto = localReparto; + } + else + { + await localStorage.SetItemAsync(keyStor, selReparto); + } + } + + protected override async Task OnInitializedAsync() + { + await getReparto(); + } + + #endregion Protected Methods + #region Private Properties private string selMacchina @@ -94,12 +126,12 @@ namespace MP.SPEC.Components private string selStato { - get => currFilter.CodStato; + get => currFilter.CodFase; set { - if (currFilter.CodStato != value) + if (currFilter.CodFase != value) { - currFilter.CodStato = value; + currFilter.CodFase = value; Task.Delay(1); reportChange(); } diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index b34dafe3..af80d0d3 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -511,7 +511,11 @@ namespace MP.SPEC.Data RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) { - result = JsonConvert.DeserializeObject>($"{rawData}"); + var rawResult = JsonConvert.DeserializeObject>($"{rawData}"); + if (rawResult != null) + { + result = rawResult; + } readType = "REDIS"; } else @@ -693,8 +697,10 @@ namespace MP.SPEC.Data /// /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) /// - /// Cod articolo + /// Solo lanciati (1) o ancora disponibili (0) /// KeyRich (parziale) da cercare (es cod stato x yacht) + /// Macchina + /// Gruppo /// public async Task> ListPODLFilt(bool lanciato, string keyRichPart, string idxMacchina, string codGruppo) { @@ -1020,7 +1026,11 @@ namespace MP.SPEC.Data RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) { - result = JsonConvert.DeserializeObject($"{rawData}"); + var rawResult = JsonConvert.DeserializeObject($"{rawData}"); + if (rawResult != null) + { + result = rawResult; + } readType = "REDIS"; } else diff --git a/MP.SPEC/Data/SelectPOdlParams.cs b/MP.SPEC/Data/SelectPOdlParams.cs index a09d3fbd..82ae7daf 100644 --- a/MP.SPEC/Data/SelectPOdlParams.cs +++ b/MP.SPEC/Data/SelectPOdlParams.cs @@ -1,6 +1,4 @@ -using MP.Data.DatabaseModels; - -namespace MP.SPEC.Data +namespace MP.SPEC.Data { public class SelectPOdlParams { @@ -15,9 +13,9 @@ namespace MP.SPEC.Data public string CodFase { get; set; } = "*"; - public int CurrPage { get; set; } = 1; public string CodReparto { get; set; } = "*"; - + public int CurrPage { get; set; } = 1; + public bool hasOdl { get; set; } = false; public string IdxMacchina { get; set; } = "*"; public int MaxRecord { get; set; } = 100; @@ -27,7 +25,6 @@ namespace MP.SPEC.Data public string SearchVal { get; set; } = "*"; public int TotCount { get; set; } = 0; - public bool hasOdl { get; set; } = false; #endregion Public Properties diff --git a/MP.SPEC/Data/SelectXdlParams.cs b/MP.SPEC/Data/SelectXdlParams.cs new file mode 100644 index 00000000..e52e1b14 --- /dev/null +++ b/MP.SPEC/Data/SelectXdlParams.cs @@ -0,0 +1,104 @@ +using MP.Data; + +namespace MP.SPEC.Data +{ + public class SelectXdlParams + { + #region Public Constructors + + public SelectXdlParams() + { } + + #endregion Public Constructors + + #region Public Properties + + public string CodFase { get; set; } = "*"; + public string CodReparto { get; set; } = "*"; + public int CurrPage { get; set; } = 1; + public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5); + public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-10); + public bool HasOdl { get; set; } = false; + public string IdxMacchina { get; set; } = "*"; + public bool IsActive { get; set; } = true; + public int MaxRecord { get; set; } = 100; + public int NumRec { get; set; } = 10; + public string SearchVal { get; set; } = "*"; + public int TotCount { get; set; } = 0; + + #endregion Public Properties + + #region Public Methods + + public SelectXdlParams clone() + { + SelectXdlParams clonedData = new SelectXdlParams() + { + CodFase = this.CodFase, + CodReparto = this.CodReparto, + CurrPage = this.CurrPage, + DtEnd = this.DtEnd, + DtStart = this.DtStart, + HasOdl = this.HasOdl, + IdxMacchina = this.IdxMacchina, + IsActive = this.IsActive, + MaxRecord = this.MaxRecord, + NumRec = this.NumRec, + SearchVal = this.SearchVal, + TotCount = this.TotCount + }; + return clonedData; + } + + public override bool Equals(object obj) + { + if (!(obj is SelectXdlParams item)) + return false; + + if (CodFase != item.CodFase) + return false; + + if (CodReparto != item.CodReparto) + return false; + + if (CurrPage != item.CurrPage) + return false; + + if (DtEnd != item.DtEnd) + return false; + + if (DtStart != item.DtStart) + return false; + + if (HasOdl != item.HasOdl) + return false; + + if (IdxMacchina != item.IdxMacchina) + return false; + + if (IsActive != item.IsActive) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (NumRec != item.NumRec) + return false; + + if (SearchVal != item.SearchVal) + return false; + + if (TotCount != item.TotCount) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index f504fa4f..ad52035d 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.2519 @@ -27,6 +27,7 @@ + diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs index 46dac323..929351a5 100644 --- a/MP.SPEC/Pages/ODL.razor.cs +++ b/MP.SPEC/Pages/ODL.razor.cs @@ -1,3 +1,4 @@ +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DatabaseModels; @@ -42,6 +43,9 @@ namespace MP.SPEC.Pages [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + [Inject] protected MpDataService MDService { get; set; } = null!; @@ -83,15 +87,31 @@ namespace MP.SPEC.Pages currPage = newNum; } + protected async Task getReparto() + { + string keyStor = "reparto"; + string localReparto = await localStorage.GetItemAsync(keyStor); + if (!string.IsNullOrEmpty(localReparto)) + { + selReparto = localReparto; + } + else + { + selReparto = "*"; + await localStorage.SetItemAsync(keyStor, selReparto); + } + } + protected override async Task OnInitializedAsync() { + await getReparto(); var allGruppiData = await MDService.ElencoGruppiFase(); if (allGruppiData != null) { ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList(); } ListStati = await MDService.AnagStatiComm(); - ListMacchine = await MDService.MacchineWithFlux(currFilter.DtStart, currFilter.DtEnd); + ListMacchine = await MDService.MacchineGetAll(); padCodXdl = await MDService.tryGetConfig("padCodXdl"); } @@ -133,15 +153,14 @@ namespace MP.SPEC.Pages #region Private Fields - private List? ListMacchine; - + private List? ListMacchine; private List? ListStati; #endregion Private Fields #region Private Properties - private SelectOdlParams currFilter { get; set; } = new SelectOdlParams(); + private SelectXdlParams currFilter { get; set; } = new SelectXdlParams(); private int currPage { @@ -162,6 +181,7 @@ namespace MP.SPEC.Pages } private List? ListGruppiFase { get; set; } = null; + private string localReparto { get; set; } = ""; private int numRecord { @@ -182,10 +202,16 @@ namespace MP.SPEC.Pages set => currFilter.IdxMacchina = value; } + private string selReparto + { + get => currFilter.CodReparto; + set => currFilter.CodReparto = value; + } + private string selStato { - get => currFilter.CodStato; - set => currFilter.CodStato = value; + get => currFilter.CodFase; + set => currFilter.CodFase = value; } private int totalCount @@ -198,11 +224,13 @@ namespace MP.SPEC.Pages #region Private Methods - private async Task updateFilter(SelectOdlParams newParams) + private async Task updateFilter(SelectXdlParams newParams) { isLoading = true; await Task.Delay(1); currPage = 1; + // salvo comunque filtro reparto x utente + await localStorage.SetItemAsync("reparto", selReparto); await Task.Delay(1); await InvokeAsync(() => StateHasChanged()); currFilter = newParams; diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor index e88f24d7..c9a05e53 100644 --- a/MP.SPEC/Pages/PODL.razor +++ b/MP.SPEC/Pages/PODL.razor @@ -9,7 +9,7 @@

    Promesse ODL

    -
    +
    Da Produrre @@ -53,12 +53,13 @@ } } *@ + @**@ + -
    diff --git a/MP.SPEC/Pages/PODL.razor.cs b/MP.SPEC/Pages/PODL.razor.cs index 5f9d9162..6f1b20e6 100644 --- a/MP.SPEC/Pages/PODL.razor.cs +++ b/MP.SPEC/Pages/PODL.razor.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Components; +using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; using MP.Data.DatabaseModels; using MP.SPEC.Components; @@ -12,7 +13,7 @@ namespace MP.SPEC.Pages { #region Protected Fields - protected DataPager pagerODL = null!; + protected DataPager? pagerODL = null!; protected bool reqNew = false; @@ -23,6 +24,9 @@ namespace MP.SPEC.Pages [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + protected ILocalStorageService localStorage { get; set; } = null!; + [Inject] protected MpDataService MDService { get; set; } = null!; @@ -66,8 +70,24 @@ namespace MP.SPEC.Pages currPage = newNum; } + protected async Task getReparto() + { + string keyStor = "reparto"; + string localReparto = await localStorage.GetItemAsync(keyStor); + if (!string.IsNullOrEmpty(localReparto)) + { + selReparto = localReparto; + } + else + { + selReparto = "*"; + await localStorage.SetItemAsync(keyStor, selReparto); + } + } + protected override async Task OnInitializedAsync() { + await getReparto(); ListAziende = await MDService.ElencoAziende(); var allGruppiData = await MDService.ElencoGruppiFase(); if (allGruppiData != null) @@ -76,16 +96,7 @@ namespace MP.SPEC.Pages } ListMacchine = await MDService.MacchineGetAll(); ListStati = await MDService.AnagStatiComm(); - SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, reparto); -#if false - // preselezione valori - configData = await MDService.ConfigGetAll(); - var currRec = configData.FirstOrDefault(x => x.Chiave == "AZIENDA"); - if (currRec != null) - { - currAzienda = currRec.Valore; - } -#endif + SearchRecords = await MDService.ListPODLFilt(hasOdl, StatoSel, macchina, selReparto); currAzienda = await MDService.tryGetConfig("AZIENDA"); padCodXdl = await MDService.tryGetConfig("padCodXdl"); // carico dati @@ -97,7 +108,10 @@ namespace MP.SPEC.Pages if (doReset) { await Task.Delay(1); - pagerODL.resetCurrPage(); + if (pagerODL != null) + { + pagerODL.resetCurrPage(); + } } } @@ -162,16 +176,6 @@ namespace MP.SPEC.Pages hasOdl = !hasOdl; await Task.Delay(1); } - private async Task updateFilter(SelectPOdlParams newParams) - { - isLoading = true; - await Task.Delay(1); - currPage = 1; - await Task.Delay(1); - await InvokeAsync(() => StateHasChanged()); - currFilter = newParams; - isLoading = false; - } protected async Task update(PODLExpModel selRec) { @@ -198,24 +202,29 @@ namespace MP.SPEC.Pages #region Private Fields private static Logger Log = LogManager.GetCurrentClassLogger(); + private PODLExpModel? _currRecord = null; + private PODLExpModel currRecordControlli = new PODLExpModel(); + private List? ListArticoli; + private List? ListAziende; + private List? ListGruppiFase; + private List? ListMacchine; + private List? ListStati; + private List? SearchRecords; #endregion Private Fields -#if false - private PODLModel? _currRecordControlli = null; -#endif - #region Private Properties private string _artSearch { get; set; } = ""; + private string _currAzienda { get; set; } = "*"; private bool addEnabled @@ -245,9 +254,6 @@ namespace MP.SPEC.Pages get => currArticolo == "" ? "Sel Articolo" : "Nuovo PODL"; } -#if false - private List? configData { get; set; } = null; -#endif private string currArticolo { get; set; } = ""; private string currAzienda @@ -280,7 +286,7 @@ namespace MP.SPEC.Pages } } - private SelectPOdlParams currFilter { get; set; } = new SelectPOdlParams(); + private SelectXdlParams currFilter { get; set; } = new SelectXdlParams(); private int currPage { @@ -300,18 +306,24 @@ namespace MP.SPEC.Pages private bool hasOdl { - get => currFilter.hasOdl; + get => currFilter.HasOdl; set { - if (currFilter.hasOdl != value) + if (currFilter.HasOdl != value) { - currFilter.hasOdl = value; + currFilter.HasOdl = value; } } } private bool isLoading { get; set; } = false; + private string macchina + { + get => currFilter.IdxMacchina; + set => currFilter.IdxMacchina = value; + } + private int numRecord { get => currFilter.NumRec; @@ -320,29 +332,24 @@ namespace MP.SPEC.Pages private string padCodXdl { get; set; } = "00000"; - private int totalCount - { - get => currFilter.TotCount; - set => currFilter.TotCount = value; - } - - private string macchina - { - get => currFilter.IdxMacchina; - set => currFilter.IdxMacchina = value; - } - - private string reparto + private string selReparto { get => currFilter.CodReparto; set => currFilter.CodReparto = value; } + private string StatoSel { get => currFilter.CodFase; set => currFilter.CodFase = value; } + private int totalCount + { + get => currFilter.TotCount; + set => currFilter.TotCount = value; + } + #endregion Private Properties #region Private Methods @@ -382,6 +389,19 @@ namespace MP.SPEC.Pages isLoading = false; } + private async Task updateFilter(SelectXdlParams newParams) + { + isLoading = true; + await Task.Delay(1); + currPage = 1; + // salvo comunque filtro reparto x utente + await localStorage.SetItemAsync("reparto", selReparto); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + currFilter = newParams; + isLoading = false; + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index 75d78ad3..acb4bdc5 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -1,3 +1,4 @@ +using Blazored.LocalStorage; using Microsoft.AspNetCore.Authentication.Negotiate; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; @@ -38,6 +39,7 @@ builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(redisMultiplexer); builder.Services.AddSingleton(); builder.Services.AddScoped(); +builder.Services.AddBlazoredLocalStorage(); builder.Services.AddHttpClient(); builder.Services.AddSingleton(); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 8f084fb1..a93c4d7d 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.2519


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