diff --git a/MP-TAB-SERV/Components/IobInfoMan.razor.cs b/MP-TAB-SERV/Components/IobInfoMan.razor.cs index 663f2789..baef2d6e 100644 --- a/MP-TAB-SERV/Components/IobInfoMan.razor.cs +++ b/MP-TAB-SERV/Components/IobInfoMan.razor.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Components; using MP.Data.DTO; +using MP.Data.Objects; using MP.Data.Services; namespace MP_TAB_SERV.Components @@ -12,12 +13,14 @@ namespace MP_TAB_SERV.Components [Inject] protected TabDataService TabSrv { get; set; } = null!; - protected IobInfoDTO infosIob { get; set; } = new IobInfoDTO(); + protected IOB_data infosIob { get; set; } = new IOB_data(); protected override async Task OnInitializedAsync() { infosIob = await TabSrv.IobInfo(idxMacch); } + + } } \ No newline at end of file diff --git a/MP-TAB-SERV/Components/ProdStopMan.razor b/MP-TAB-SERV/Components/ProdStopMan.razor index 5ab071fd..a81d28df 100644 --- a/MP-TAB-SERV/Components/ProdStopMan.razor +++ b/MP-TAB-SERV/Components/ProdStopMan.razor @@ -1,5 +1,5 @@ 
-
+
diff --git a/MP-TAB-SERV/Components/ProdStopMan.razor.cs b/MP-TAB-SERV/Components/ProdStopMan.razor.cs index c4a43b13..b0415cda 100644 --- a/MP-TAB-SERV/Components/ProdStopMan.razor.cs +++ b/MP-TAB-SERV/Components/ProdStopMan.razor.cs @@ -4,11 +4,32 @@ namespace MP_TAB_SERV.Components { public partial class ProdStopMan { + #region Public Properties + + [Parameter] + public EventCallback E_EventSelected { get; set; } + + [Parameter] + public int IdxEvento { get; set; } = 0; + [Parameter] public string objCss { get; set; } = ""; + [Parameter] public string objIcon { get; set; } = ""; + [Parameter] public string objTxt { get; set; } = ""; + + #endregion Public Properties + + #region Protected Methods + + protected async Task ReportSelected() + { + await E_EventSelected.InvokeAsync(IdxEvento); + } + + #endregion Protected Methods } } \ No newline at end of file diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index c829ab60..b7b22d09 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.519 + 6.16.2310.615 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/ProdStop.razor b/MP-TAB-SERV/Pages/ProdStop.razor index c91e88af..0970245c 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor +++ b/MP-TAB-SERV/Pages/ProdStop.razor @@ -18,10 +18,15 @@ else
- @foreach(var item in events2show) - { - - } + @if (!string.IsNullOrEmpty(lblOut)) + { +
+ @lblOut +
+ } + @foreach (var item in events2show) + { + + }
} - \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs index c8695340..3b2dca5b 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor.cs +++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs @@ -1,11 +1,155 @@ using global::Microsoft.AspNetCore.Components; using MP.Data.DatabaseModels; using MP.Data.Services; +using NLog.Layouts; namespace MP_TAB_SERV.Pages { public partial class ProdStop { + [Inject] + protected SharedMemService MStor { get; set; } = null!; + [Inject] + protected TabDataService TabServ { get; set; } = null!; + + protected string lblOut { 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) + /// + public bool insRealtime + { + get + { + bool answ = true; +#if false + try + { + if (Math.Abs(dataOraEv.Subtract(DateTime.Now).TotalMinutes) > memLayer.ML.CRI("dltMinRealtime")) + { + answ = false; + } + } + catch + { } +#endif + return answ; + } + } + + /// + /// Processo registrazione eventi + /// + /// + /// + protected async Task EventRecord(int IdxEv) + { + await Task.Delay(1); + // salvo evento e processo... + + if (IdxEv > 0) + { + var rigaEvento = MStor.GetEventRow(IdxEv); + if (rigaEvento != null) + { + var rigaStato = await TabServ.StatoMacchina(IdxMacc); + // processo evento... + if (insRealtime) + { + // se realtime + TabServ.scriviRigaEventoBarcode(IdxMacc, IdxEv, rigaStato.CodArticolo, "DRT", MatrOpr, rigaStato.pallet); + // resetta il microstato in modo da ricevere successive info HW + TabServ.resetMicrostatoMacchina(IdxMacc); + } + else + { +#if false + // in primis disabilito insert... + DataLayerObj.taStatoMacchine.setInsEnabled(idxMacchina, false); + // calcolo evento + string evento = IdxEv.ToString(); + string commento = ""; + try + { + evento = DataLayerObj.taAnagEventi.GetByIdx(IdxEv)[0].Nome.Replace("Barcode - ", ""); + } + catch + { } + // genero stringa pseudo-univoca + string codRich = string.Format("{0:yyMMddHHmmss}-{1}", DateTime.Now, IdxEv); + // x prima cosa scrivo un evento tipo "1" x chiudere la durata appena prima dell'evento successivo + try + { + // cerco da 1 sec DOPO evento... + DS_applicazione.DiarioDiBordoDataTable tabNext = controllerMapo.nextEventoImpiantoFrom(idxMacchina, dataOraEv.AddSeconds(1)); + + DateTime nextEvDT = DateTime.Now; + if (tabNext.Rows.Count > 0) + { + nextEvDT = tabNext[0].InizioStato; + } + // se non trovo chiusura evento inserisco a 1 minuto prima di adesso la chiusura... + else + { + nextEvDT = DateTime.Now.AddMinutes(-1); + } + // fix salvo la dichiarazione di chiusura + commento = string.Format("999 - M.Lav EndEvt: {0} [{1}]", evento, codRich); + DataLayerObj.scriviRigaEventoBarcode(idxMacchina, 1, rigaStato.CodArticolo, commento, DataLayerObj.MatrOpr, rigaStato.pallet, nextEvDT.AddSeconds(-1), DateTime.Now); // 1 hard-coded x resettare + } + catch + { } + // update commento! + commento = string.Format("999 - Dich StartEvt: {0} [{1}]", evento, codRich); + // recupero data/ora evento da inserire (quella selezionata) ed AGGIUNGO 1 sec!!! così rimane traccia + DataLayerObj.scriviRigaEventoBarcode(idxMacchina, IdxEv, rigaStato.CodArticolo, commento, DataLayerObj.MatrOpr, rigaStato.pallet, dataOraEv.AddSeconds(1), DateTime.Now); + // eseguo ricalcolo! + DateTime startRicalcolo = dataOraEv.AddMinutes(memLayer.ML.CRI("minAnticipoRicalcolo")); + + // leggo parametri x esecuzione... + int rdm_nEvStep = memLayer.ML.CRI("rdm_nEvStep"); + int rdm_nEvCheck = memLayer.ML.CRI("rdm_nEvCheck"); + bool rdm_ChkOnly = memLayer.ML.CRB("rdm_ChkOnly"); + DataLayerObj.taComm.stp_ricalcolaDatiMacchinaFromDate(idxMacchina, startRicalcolo, 1, rdm_nEvStep, rdm_nEvCheck, rdm_ChkOnly); // nella stored imposto macchina OFFline e poi ONline, parto da "minAnticipoRicalcolo" minuti prima... + // aggiorno data evento x insert eventuale commento (5 sec...) + dataOraEv = dataOraEv.AddSeconds(5); + // riabilito insert... anche se non dovrebbe servire x stored ricalcolo precedente... + DataLayerObj.taStatoMacchine.setInsEnabled(idxMacchina, true); +#endif + } + // mostro esito + alertCss = "alert-succes"; + lblOut = "Registrata dichiarazione fermata"; + } + else + { + alertCss = "alert-danger"; + lblOut = $"Codice evento non valido! {IdxEv}"; + } + } +#if false + // refresh fermate + repLI.DataBind(); + // faccio refresh x singola macchina 2019.03.26 + DataLayerObj.taMSE.forceRecalc(0, idxMacchina); + // sollevo evento! + if (eh_newVal != null) + { + eh_newVal(this, new EventArgs()); + } +#endif + } + private int MatrOpr + { + get => MServ.MatrOpr; + } + + [Inject] + protected MessageService MServ { get; set; } = null!; + + protected string alertCss { get; set; } = "alert-danger"; + #region Protected Properties protected MappaStatoExpl? CurrMSE { get; set; } = null; @@ -43,9 +187,9 @@ namespace MP_TAB_SERV.Pages } var eventsAll = await TabSrv.AnagEventiGetAll(); - if(eventsAll != null) + if (eventsAll != null) { - events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x=>x.Nome).ToList(); + events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.Nome).ToList(); } } diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index d8c36b01..3d18e7ef 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.519

+

Versione: 6.16.2310.615


Note di rilascio: