diff --git a/MP-TAB-SERV/Components/LongStopList.razor.cs b/MP-TAB-SERV/Components/LongStopList.razor.cs index 635f305e..5669ceab 100644 --- a/MP-TAB-SERV/Components/LongStopList.razor.cs +++ b/MP-TAB-SERV/Components/LongStopList.razor.cs @@ -1,34 +1,12 @@ -using global::System; -using global::System.Collections.Generic; -using global::System.Linq; -using global::System.Threading.Tasks; using global::Microsoft.AspNetCore.Components; -using System.Net.Http; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Components.Authorization; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Components.Routing; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.AspNetCore.Components.Web.Virtualization; -using Microsoft.JSInterop; -using MP_TAB_SERV; -using MP_TAB_SERV.Shared; -using MP_TAB_SERV.Components; -using MP.Data; -using MP.Data.DatabaseModels; -using MP.Data.DTO; using MP.Data.Services; -using Newtonsoft.Json; -using NLog; using System.Reflection.Metadata; namespace MP_TAB_SERV.Components { public partial class LongStopList { - - [Parameter] - public string fnqName { get; set; } = ""; + #region Public Properties [Parameter] public string fnqArticle { get; set; } = ""; @@ -39,11 +17,26 @@ namespace MP_TAB_SERV.Components [Parameter] public double fnqDurMin { get; set; } = 0; + [Parameter] + public string fnqName { get; set; } = ""; + [Parameter] public string fnqSemaforo { get; set; } = ""; + + #endregion Public Properties + + #region Protected Properties + [Inject] protected MessageService MsgServ { get; set; } = null!; + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + /// /// Rimanda alla pagina fermate selezionando periodo corretto... /// @@ -52,10 +45,10 @@ namespace MP_TAB_SERV.Components { await Task.Delay(1); // salva la data-ora evento richiesto... - await MsgServ.DtRifCommentoSet(fnqDateTime); + await MsgServ.CommentoDtRifSet(fnqDateTime); NavMan.NavigateTo("prod-stop"); } - [Inject] - protected NavigationManager NavMan { get; set; } = null!; + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-TAB-SERV/Components/NotesEditor.razor.cs b/MP-TAB-SERV/Components/NotesEditor.razor.cs index 62954484..fc67f2e8 100644 --- a/MP-TAB-SERV/Components/NotesEditor.razor.cs +++ b/MP-TAB-SERV/Components/NotesEditor.razor.cs @@ -1,4 +1,4 @@ -using global::System; +using global::System; using global::System.Collections.Generic; using global::System.Linq; using global::System.Threading.Tasks; @@ -45,7 +45,7 @@ namespace MP_TAB_SERV.Components [Parameter] public string Title { get; set; } = "NA"; [Parameter] - public EventListModel? CurrComm + public EventListModel? CurrRecord { //get; set @@ -107,7 +107,7 @@ namespace MP_TAB_SERV.Components MatrOpr = MatrOpr, pallet = "-" }; - // elimino vecchio se c'è... + // elimino vecchio se c'è... await TabServ.EvListDelete(IdxMacc, DateSel); // inserisco await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.commento); @@ -120,6 +120,48 @@ namespace MP_TAB_SERV.Components protected override void OnInitialized() { idxTipoCommento = SMServ.GetConfInt("idxTipoCommento"); + dltMinRealtime = SMServ.GetConfInt("dltMinRealtime"); + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + // cerco se ci sia una data-ora rif salvata... + DateSel = await MServ.CommentoDtRifGet(false); + if (!insRealtime) + { + await Task.Delay(1); + UserComment = await MServ.CommentoValGet(true); + if (ShowBtn) + { + DateSel = await MServ.CommentoDtRifGet(true); + ShowBtn = false; + await InvokeAsync(StateHasChanged); + } + } + } + + + protected int dltMinRealtime = 1; + /// + /// 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(DateSel.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime) + { + answ = false; + } + } + catch + { } + return answ; + } } protected void ToggleCtrl() diff --git a/MP-TAB-SERV/Components/NotesMan.razor b/MP-TAB-SERV/Components/NotesMan.razor index bbec5f1e..fe630733 100644 --- a/MP-TAB-SERV/Components/NotesMan.razor +++ b/MP-TAB-SERV/Components/NotesMan.razor @@ -80,10 +80,10 @@
- +
- +
diff --git a/MP-TAB-SERV/Components/NotesMan.razor.cs b/MP-TAB-SERV/Components/NotesMan.razor.cs index bb4b3ee4..2bfda06c 100644 --- a/MP-TAB-SERV/Components/NotesMan.razor.cs +++ b/MP-TAB-SERV/Components/NotesMan.razor.cs @@ -1,6 +1,6 @@ using global::Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; using MP.Data.DatabaseModels; -using MP.Data.DTO; using MP.Data.Services; namespace MP_TAB_SERV.Components @@ -16,30 +16,6 @@ namespace MP_TAB_SERV.Components #region Protected Properties - protected int NumComm - { - get => numComm; - set - { - if (numComm != value) - { - numComm = value; - ReloadComments().ConfigureAwait(false); - } - } - } - protected int NumGiorni - { - get => _numGiorni; - set - { - if (_numGiorni != value) - { - _numGiorni = value; - ReloadFnq().ConfigureAwait(false); - } - } - } protected int DurataMin { get => _durataMin; @@ -48,13 +24,57 @@ namespace MP_TAB_SERV.Components if (_durataMin != value) { _durataMin = value; - ReloadFnq().ConfigureAwait(false); + var pUpd = Task.Run(async () => + { + await ReloadFnq(); + }); + pUpd.Wait(); + } + } + } + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + [Inject] + protected MessageService MsgServ { get; set; } = null!; + + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + protected int NumComm + { + get => numComm; + set + { + if (numComm != value) + { + numComm = value; + var pUpd = Task.Run(async () => + { + await ReloadComments(); + }); + pUpd.Wait(); + } + } + } + + protected int NumGiorni + { + get => _numGiorni; + set + { + if (_numGiorni != value) + { + _numGiorni = value; + var pUpd = Task.Run(async () => + { + await ReloadFnq(); + }); + pUpd.Wait(); } } } - private int numComm { get; set; } = 10; - private int _numGiorni { get; set; } = 3; - private int _durataMin { get; set; } = 30; protected List RecordListComments { get; set; } = new List(); protected List RecordListFnq { get; set; } = new List(); @@ -66,6 +86,28 @@ namespace MP_TAB_SERV.Components #region Protected Methods + protected async Task DeteleRec(CommentiModel currRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voelr eliminare il record?")) + return; + + await Task.Delay(1); + await TabServ.EvListDelete(currRec.IdxMacchina, currRec.InizioStato); + // ricarico + await ReloadComments(); + await ReloadFnq(); + } + + protected async Task EditRec(CommentiModel currRec) + { + await Task.Delay(1); + // salvo + await MsgServ.CommentoDtRifSet(currRec.InizioStato); + await MsgServ.CommentoValSet(currRec.Value); + // navigo + NavMan.NavigateTo("notes"); + } + protected override async Task OnParametersSetAsync() { await ReloadComments(); @@ -74,16 +116,15 @@ namespace MP_TAB_SERV.Components #endregion Protected Methods - #region Private Methods + #region Private Properties - private async Task ReloadComments() - { - RecordListComments = await TabServ.CommentiGetLastByMacc(RecMSE?.IdxMacchina, NumComm); - } - private async Task ReloadFnq() - { - RecordListFnq = await TabServ.FermiNonQualificatiFilt(RecMSE?.IdxMacchina, NumGiorni, DurataMin); - } + private int _durataMin { get; set; } = 30; + private int _numGiorni { get; set; } = 3; + private int numComm { get; set; } = 10; + + #endregion Private Properties + + #region Private Methods private async Task DoUpdate(bool forceReload) { @@ -93,18 +134,28 @@ namespace MP_TAB_SERV.Components } } + private async Task ReloadComments() + { + RecordListComments = await TabServ.CommentiGetLastByMacc(RecMSE?.IdxMacchina, NumComm); + } + + private async Task ReloadFnq() + { + RecordListFnq = await TabServ.FermiNonQualificatiFilt(RecMSE?.IdxMacchina, NumGiorni, DurataMin); + } + private string setSemaforo(string sem) { string answ = ""; - if(sem == "sBl") + if (sem == "sBl") { answ = "bg-primary text-warning"; } - else if(sem == "sGr") + else if (sem == "sGr") { answ = "bg-secondary text-dark"; } - else if(sem == "sGi") + else if (sem == "sGi") { answ = "bg-warning text-dark"; } diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index 942f31fc..771be58c 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.914 + 6.16.2310.916 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs index fcacbcee..288b6cc6 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor.cs +++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs @@ -17,17 +17,15 @@ namespace MP_TAB_SERV.Pages get { bool answ = true; -#if false - try - { - if (Math.Abs(dataOraEv.Subtract(DateTime.Now).TotalMinutes) > memLayer.ML.CRI("dltMinRealtime")) - { - answ = false; - } - } - catch - { } -#endif + //try + //{ + // if (Math.Abs(DtRif.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime) + // { + // answ = false; + // } + //} + //catch + //{ } return answ; } } @@ -53,16 +51,11 @@ namespace MP_TAB_SERV.Pages protected MessageService MServ { get; set; } = null!; [Inject] - protected MessageService MsgServ { get; set; } = null!; - - [Inject] - protected SharedMemService MStor { get; set; } = null!; + protected SharedMemService SMServ { get; set; } = null!; [Inject] protected TabDataService TabServ { get; set; } = null!; - [Inject] - protected TabDataService TabSrv { get; set; } = null!; #endregion Protected Properties @@ -80,7 +73,7 @@ namespace MP_TAB_SERV.Pages if (IdxEv > 0) { - var rigaEvento = MStor.GetEventRow(IdxEv); + var rigaEvento = SMServ.GetEventRow(IdxEv); if (rigaEvento != null) { var rigaStato = await TabServ.StatoMacchina(IdxMacc); @@ -192,9 +185,12 @@ namespace MP_TAB_SERV.Pages protected override async Task OnInitializedAsync() { + // leggo gli altri dati await ReloadData(); } + + #endregion Protected Methods #region Private Properties @@ -216,13 +212,13 @@ namespace MP_TAB_SERV.Pages { try { - IdxMacc = await MsgServ.IdxMaccGet(); + IdxMacc = await MServ.IdxMaccGet(); // recupero MSE macchina.... if (!string.IsNullOrEmpty(IdxMacc)) { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + CurrMSE = await MServ.GetMachineMse(IdxMacc); } - var eventsAll = await TabSrv.AnagEventiGetByMacch(IdxMacc); + var eventsAll = await TabServ.AnagEventiGetByMacch(IdxMacc); if (eventsAll != null) { events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.Label).ToList(); diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index 82a01a36..5d0b81a8 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.914

+

Versione: 6.16.2310.916


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index b829241e..47824bf1 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.914 +6.16.2310.916 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index b0e6d77f..ff924a19 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.914 + 6.16.2310.916 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 a768eece..90f2de8a 100644 --- a/MP.Data/Services/MessageService.cs +++ b/MP.Data/Services/MessageService.cs @@ -101,19 +101,6 @@ namespace MP.Data.Services } } - public string UserAuthKey - { - get - { - string answ = ""; - if (_rigaOper != null) - { - answ = _rigaOper.authKey; - } - return answ; - } - } - public AnagOperatoriModel? RigaOper { get => _rigaOper; @@ -128,6 +115,19 @@ namespace MP.Data.Services } } + public string UserAuthKey + { + get + { + string answ = ""; + if (_rigaOper != null) + { + answ = _rigaOper.authKey; + } + return answ; + } + } + #endregion Public Properties #region Public Methods @@ -142,6 +142,70 @@ namespace MP.Data.Services await sessionStore.ClearAsync(); } + /// + /// DateTime riferimento evento x commento fermata + /// + /// + /// + public async Task CommentoDtRifGet(bool remAfter) + { + DateTime answ = DateTime.Now; + 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; + } + + /// + /// Macchine attualmente selezionata + /// + public async Task CommentoDtRifSet(DateTime DtRif) + { + await sessionStore.SetItemAsync(KeyCommDtRif, DtRif); + } + + /// + /// Commento fermata x recupero in editing + /// + /// + /// + public async Task CommentoValGet(bool remAfter) + { + string answ = ""; + bool hasKey = await sessionStore.ContainKeyAsync(KeyCommText); + if (hasKey) + { + // recupero + answ = await sessionStore.GetItemAsync(KeyCommText); + // svuoto data registrata se richiesto + if (remAfter) + { + await sessionStore.RemoveItemAsync(KeyCommText); + } + } + return answ; + } + + /// + /// Macchine attualmente selezionata + /// + public async Task CommentoValSet(string Valore) + { + await sessionStore.SetItemAsync(KeyCommText, Valore); + } + /// /// Restituisce il valore Ipv4 del Device da localstorage /// @@ -205,29 +269,81 @@ namespace MP.Data.Services } /// - /// Macchine attualmente selezionata + /// Effettua salvataggio in localstorage dei dati MSE correnti /// - public async Task DtRifCommentoSet(DateTime DtRif) - { - await sessionStore.SetItemAsync("DtRifComm", DtRif); - } - /// - /// DateTime riferimento evento x commento fermata - /// - /// + /// /// - public async Task DtRifCommentoGet(bool remAfter) + /// + public async Task SaveMse(List currListMSE) { - // recupero - var answ = await sessionStore.GetItemAsync("DtRifComm"); - // svuoto data registrata se richiesto - if (remAfter) + foreach (var item in currListMSE) { - await sessionStore.RemoveItemAsync("DtRifComm"); + string serVal = JsonConvert.SerializeObject(item); + await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal); + } + } + + /// + /// Scrive il valore di IPV4 del device nel localstoragee + /// + /// + /// + public async Task setDevIpv4Async(string newVal) + { + bool answ = false; + try + { + await localStorage.SetItemAsync(KeyDevIp4, newVal); + answ = true; + } + catch (Exception ex) + { + Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}"); } return answ; } + /// + /// Scrive il valore di DeviceSecret nel localstoragee + /// + /// + /// + public async Task setDevSecretAsync(string newVal) + { + bool answ = false; + try + { + await localStorage.SetItemAsync(KeyDevSec, newVal); + answ = true; + } + catch (Exception ex) + { + Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}"); + } + return answ; + } + + #endregion Public Methods + + #region Protected Fields + + protected const string KeyDevIp4 = "DevIpv4"; + protected const string KeyDevSec = "DevSec"; + protected const string KeyMacDict = "MachineDict"; + + #endregion Protected Fields + + #region Protected Properties + + protected ILocalStorageService localStorage { get; set; } = null!; + protected ISessionStorageService sessionStore { get; set; } = null!; + + #endregion Protected Properties + + #region Private Fields + + private const string KeyCommDtRif = "DtRifComm"; + private const string KeyCommText = "ValComm"; #if false public bool IsActive { @@ -343,72 +459,6 @@ namespace MP.Data.Services public DateTime targetDate { get; set; } = DateTime.Today; public DateTime targetDateMancTimb { get; set; } #endif - - /// - /// Effettua salvataggio in localstorage dei dati MSE correnti - /// - /// - /// - /// - public async Task SaveMse(List currListMSE) - { - foreach (var item in currListMSE) - { - string serVal = JsonConvert.SerializeObject(item); - await localStorage.SetItemAsync(machineMse(item.IdxMacchina), serVal); - } - } - - /// - /// Scrive il valore di IPV4 del device nel localstoragee - /// - /// - /// - public async Task setDevIpv4Async(string newVal) - { - bool answ = false; - try - { - await localStorage.SetItemAsync(KeyDevIp4, newVal); - answ = true; - } - catch (Exception ex) - { - Log.Error($"Eccezione in setDevIpv4Async{Environment.NewLine}{ex}"); - } - return answ; - } - - /// - /// Scrive il valore di DeviceSecret nel localstoragee - /// - /// - /// - public async Task setDevSecretAsync(string newVal) - { - bool answ = false; - try - { - await localStorage.SetItemAsync(KeyDevSec, newVal); - answ = true; - } - catch (Exception ex) - { - Log.Error($"Eccezione in setDevSecretAsync{Environment.NewLine}{ex}"); - } - return answ; - } - - #endregion Public Methods - - #region Protected Fields - - protected const string KeyDevIp4 = "DevIpv4"; - protected const string KeyDevSec = "DevSec"; - protected const string KeyMacDict = "MachineDict"; - - #endregion Protected Fields - #if false public void ReportDateChange() @@ -476,17 +526,6 @@ namespace MP.Data.Services } } #endif - - #region Protected Properties - - protected ILocalStorageService localStorage { get; set; } = null!; - - protected ISessionStorageService sessionStore { get; set; } = null!; - - #endregion Protected Properties - - #region Private Fields - private AnagOperatoriModel? _rigaOper; private Logger Log = LogManager.GetCurrentClassLogger();