From db105b8f9ac4a9da0e2e53e3ae1f632d97e18f53 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 10 Oct 2023 17:23:08 +0200 Subject: [PATCH] Salvataggio da esterno componente x commenti --- MP-TAB-SERV/Components/NotesEditor.razor.cs | 25 +++----- MP-TAB-SERV/MP-TAB-SERV.csproj | 12 ++-- MP-TAB-SERV/Pages/ProdStop.razor | 2 +- MP-TAB-SERV/Pages/ProdStop.razor.cs | 66 ++++++++++++--------- MP-TAB-SERV/Resources/ChangeLog.html | 2 +- MP-TAB-SERV/Resources/VersNum.txt | 2 +- MP-TAB-SERV/Resources/manifest.xml | 2 +- MP.Data/Services/MessageService.cs | 21 ++++--- 8 files changed, 72 insertions(+), 60 deletions(-) diff --git a/MP-TAB-SERV/Components/NotesEditor.razor.cs b/MP-TAB-SERV/Components/NotesEditor.razor.cs index 53920831..10b11275 100644 --- a/MP-TAB-SERV/Components/NotesEditor.razor.cs +++ b/MP-TAB-SERV/Components/NotesEditor.razor.cs @@ -47,14 +47,12 @@ namespace MP_TAB_SERV.Components [Parameter] public EventListModel? CurrRecord { - //get; set { if (value != null) { DateSel = value.InizioStato ?? DateTime.Now; UserComment = value.Value; - //ShowBtn = insRealtime; ShowBtn = false; } } @@ -90,12 +88,12 @@ namespace MP_TAB_SERV.Components #region Protected Methods - protected void doCancel() + public void doCancel() { DoReset(); } - protected async Task doSave() + public async Task doSave() { // registro evento EventListModel newRec = new EventListModel() @@ -126,21 +124,16 @@ namespace MP_TAB_SERV.Components protected override async Task OnAfterRenderAsync(bool firstRender) { -#if false - // cerco se ci sia una data-ora rif salvata... - DateSel = await MServ.CommentoDtRifGet(false); - if (!insRealtime) + // verifico SE ci sia una data da usare... + bool hasDtRif = await MServ.SessHasVal(MessageService.KeyCommDtRif); + if (hasDtRif) { await Task.Delay(1); + ShowBtn = false; UserComment = await MServ.CommentoValGet(true); - if (ShowBtn) - { - DateSel = await MServ.CommentoDtRifGet(true); - ShowBtn = false; - await InvokeAsync(StateHasChanged); - } - } -#endif + DateSel = await MServ.CommentoDtRifGet(true); + await InvokeAsync(StateHasChanged); + } } diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index 532b6a48..5d91b08e 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2310.1011 + 6.16.2310.1016 enable MP_TAB_SERV @@ -47,10 +47,10 @@ Always - - - - - + + + + + diff --git a/MP-TAB-SERV/Pages/ProdStop.razor b/MP-TAB-SERV/Pages/ProdStop.razor index 2aa602ca..b0a392ff 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor +++ b/MP-TAB-SERV/Pages/ProdStop.razor @@ -10,7 +10,7 @@ else - +
@if (!string.IsNullOrEmpty(lblOut)) diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs index c4498175..00340524 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor.cs +++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs @@ -2,36 +2,17 @@ using global::Microsoft.AspNetCore.Components; using MP.Data; using MP.Data.DatabaseModels; using MP.Data.Services; +using MP_TAB_SERV.Components; namespace MP_TAB_SERV.Pages { public partial class ProdStop { - #region Public Properties + #region Protected Fields - /// - /// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra - /// selezionata e realtime, se superiore ad X minuti NON � realtime) - /// - public bool insRealtime - { - get - { - bool answ = true; - //try - //{ - // if (Math.Abs(DtRif.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime) - // { - // answ = false; - // } - //} - //catch - //{ } - return answ; - } - } + protected int dltMinRealtime = 1; - #endregion Public Properties + #endregion Protected Fields #region Protected Properties @@ -39,10 +20,29 @@ namespace MP_TAB_SERV.Pages protected MappaStatoExpl? CurrMSE { get; set; } = null; + protected DateTime DtRif { get; set; } = DateTime.Now; + protected List events2show { get; set; } = new List(); protected string IdxMacc { get; set; } = ""; + /// + /// Determina se insert sia Realtime o batch con DataOra (in base a diff tra DataOra + /// selezionata e realtime, se superiore ad X minuti NON � realtime) + /// + protected bool insRealtime + { + get + { + bool answ = true; + if (Math.Abs(DtRif.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime) + { + answ = false; + } + return answ; + } + } + protected string lblOut { get; set; } = ""; [Inject] @@ -51,13 +51,17 @@ namespace MP_TAB_SERV.Pages [Inject] protected MessageService MServ { get; set; } = null!; + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + protected NotesEditor? noteEdit { get; set; } + [Inject] protected SharedMemService SMServ { get; set; } = null!; [Inject] protected TabDataService TabServ { get; set; } = null!; - #endregion Protected Properties #region Protected Methods @@ -99,6 +103,12 @@ namespace MP_TAB_SERV.Pages } else { + // chiamo registrazione commento... + if (noteEdit != null) + { + await noteEdit.doSave(); + } + #if false // in primis disabilito insert... DataLayerObj.taStatoMacchine.setInsEnabled(idxMacchina, false); @@ -187,12 +197,16 @@ namespace MP_TAB_SERV.Pages protected override async Task OnInitializedAsync() { + dltMinRealtime = SMServ.GetConfInt("dltMinRealtime"); // leggo gli altri dati await ReloadData(); } + protected void SetDate(DateTime newDate) + { + DtRif = newDate; + } - #endregion Protected Methods #region Private Properties @@ -203,8 +217,6 @@ namespace MP_TAB_SERV.Pages } #endregion Private Properties - [Inject] - protected NavigationManager NavMan { get; set; } = null!; #region Private Methods diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index f169cfd4..19716452 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2310.1011

+

Versione: 6.16.2310.1016


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index 9738056e..f94afd31 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.1011 +6.16.2310.1016 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index e48d4f65..c8fd3411 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.1011 + 6.16.2310.1016 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false diff --git a/MP.Data/Services/MessageService.cs b/MP.Data/Services/MessageService.cs index 90f2de8a..61581c35 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -153,17 +153,12 @@ namespace MP.Data.Services bool hasKey = await sessionStore.ContainKeyAsync(KeyCommDtRif); if (hasKey) { - //try - //{ - // recupero answ = await sessionStore.GetItemAsync(KeyCommDtRif); // svuoto data registrata se richiesto if (remAfter) { await sessionStore.RemoveItemAsync(KeyCommDtRif); } - //} - //catch { } } return answ; } @@ -176,6 +171,18 @@ namespace MP.Data.Services await sessionStore.SetItemAsync(KeyCommDtRif, DtRif); } + + /// + /// Verifico esistenza chiave in session store + /// + /// + /// + public async Task SessHasVal(string keyName) + { + bool hasKey = await sessionStore.ContainKeyAsync(keyName); + return hasKey; + } + /// /// Commento fermata x recupero in editing /// @@ -342,8 +349,8 @@ namespace MP.Data.Services #region Private Fields - private const string KeyCommDtRif = "DtRifComm"; - private const string KeyCommText = "ValComm"; + public const string KeyCommDtRif = "DtRifComm"; + public const string KeyCommText = "ValComm"; #if false public bool IsActive {