diff --git a/MP-TAB-SERV/Components/CommentEditor.razor b/MP-TAB-SERV/Components/CommentEditor.razor new file mode 100644 index 00000000..32ce0c47 --- /dev/null +++ b/MP-TAB-SERV/Components/CommentEditor.razor @@ -0,0 +1,39 @@ + +

RIFARE X COMMENTI!!!

+ +
+ @if (ShowBtn) + { +
+ +
+ } + else + { +
+
+ Data Ora + +
+
+
+ +
+
+
+ + +
+
+
+ @if (CanSave) + { + + } +
+ } +
\ No newline at end of file diff --git a/MP-TAB-SERV/Components/CommentEditor.razor.cs b/MP-TAB-SERV/Components/CommentEditor.razor.cs new file mode 100644 index 00000000..a98c2ea1 --- /dev/null +++ b/MP-TAB-SERV/Components/CommentEditor.razor.cs @@ -0,0 +1,162 @@ +using global::Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data.Services; + +namespace MP_TAB_SERV.Components +{ + public partial class CommentEditor + { + #region Public Properties + + [Parameter] + public bool CanSave { get; set; } = false; + + [Parameter] + public EventCallback E_CommRec { get; set; } + + [Parameter] + public EventCallback E_DateSel { get; set; } + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + [Parameter] + public string Title { get; set; } = "NA"; + [Parameter] + public EventListModel? CurrComm + { + //get; + set + { + if (value != null) + { + DateSel = value.InizioStato ?? DateTime.Now; + UserComment = value.Value; + } + } + } + + #endregion Public Properties + + #region Protected Properties + + protected DateTime DateSel + { + get => dateSel; + set + { + if (dateSel != value) + { + dateSel = value; + E_DateSel.InvokeAsync(value).ConfigureAwait(false); + } + } + } + + [Inject] + protected MessageService MServ { get; set; } = null!; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TabServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void doCancel() + { + DoReset(); + ToggleCtrl(); + } + + protected async Task doSave() + { + // registro evento + EventListModel newRec = new EventListModel() + { + IdxMacchina = IdxMacc, + InizioStato = DateSel, + IdxTipo = idxTipoCommento, + CodArticolo = CodArt, + Value = UserComment, + MatrOpr = MatrOpr, + pallet = "-" + }; + // elimino vecchio se c'è... + await TabServ.EvListDelete(IdxMacc, DateSel); + // inserisco + await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.barcode); + // reset + DoReset(); + ToggleCtrl(); + } + + protected override void OnInitialized() + { + idxTipoCommento = SMServ.GetConfInt("idxTipoCommento"); + } + + protected void ToggleCtrl() + { + ShowBtn = !ShowBtn; + } + + #endregion Protected Methods + + #region Private Fields + + private int idxTipoCommento = 0; + + #endregion Private Fields + + #region Private Properties + + private string CodArt + { + get => RecMSE != null ? RecMSE.CodArticolo : ""; + } + + private DateTime dateSel { get; set; } = DateTime.Now; + + private string IdxMacc + { + get => RecMSE != null ? RecMSE.IdxMacchina : ""; + } + + private int MatrOpr + { + get => MServ.MatrOpr; + } + + private bool ShowBtn { get; set; } = true; + private string userComment { get; set; } = ""; + + private string UserComment + { + get => userComment.Trim(); + set + { + if (userComment != value) + { + userComment = value; + E_CommRec.InvokeAsync(value).ConfigureAwait(false); + } + } + } + + #endregion Private Properties + + #region Private Methods + + private void DoReset() + { + UserComment = ""; + DateSel = DateTime.Now; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/DeclarMan.razor b/MP-TAB-SERV/Components/DeclarMan.razor index a76c6fd7..d4d18b69 100644 --- a/MP-TAB-SERV/Components/DeclarMan.razor +++ b/MP-TAB-SERV/Components/DeclarMan.razor @@ -1,5 +1,6 @@ 

DeclarList

+ @code { } diff --git a/MP-TAB-SERV/Components/NotesEditor.razor b/MP-TAB-SERV/Components/NotesEditor.razor new file mode 100644 index 00000000..b4603359 --- /dev/null +++ b/MP-TAB-SERV/Components/NotesEditor.razor @@ -0,0 +1,36 @@ +
+ @if (ShowBtn) + { +
+ +
+ } + else + { +
+
+ Data Ora + +
+
+
+ +
+
+
+ + +
+
+
+ @if (CanSave) + { + + } +
+ } +
\ No newline at end of file diff --git a/MP-TAB-SERV/Components/NotesEditor.razor.cs b/MP-TAB-SERV/Components/NotesEditor.razor.cs new file mode 100644 index 00000000..ab4d6f52 --- /dev/null +++ b/MP-TAB-SERV/Components/NotesEditor.razor.cs @@ -0,0 +1,181 @@ +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; + +namespace MP_TAB_SERV.Components +{ + public partial class NotesEditor + { + #region Public Properties + + [Parameter] + public bool CanSave { get; set; } = false; + + [Parameter] + public EventCallback E_CommRec { get; set; } + + [Parameter] + public EventCallback E_DateSel { get; set; } + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + [Parameter] + public string Title { get; set; } = "NA"; + [Parameter] + public EventListModel? CurrComm + { + //get; + set + { + if (value != null) + { + DateSel = value.InizioStato ?? DateTime.Now; + UserComment = value.Value; + } + } + } + + #endregion Public Properties + + #region Protected Properties + + protected DateTime DateSel + { + get => dateSel; + set + { + if (dateSel != value) + { + dateSel = value; + E_DateSel.InvokeAsync(value).ConfigureAwait(false); + } + } + } + + [Inject] + protected MessageService MServ { get; set; } = null!; + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TabServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void doCancel() + { + DoReset(); + ToggleCtrl(); + } + + protected async Task doSave() + { + // registro evento + EventListModel newRec = new EventListModel() + { + IdxMacchina = IdxMacc, + InizioStato = DateSel, + IdxTipo = idxTipoCommento, + CodArticolo = CodArt, + Value = UserComment, + MatrOpr = MatrOpr, + pallet = "-" + }; + // elimino vecchio se c'è... + await TabServ.EvListDelete(IdxMacc, DateSel); + // inserisco + await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.barcode); + // reset + DoReset(); + ToggleCtrl(); + } + + protected override void OnInitialized() + { + idxTipoCommento = SMServ.GetConfInt("idxTipoCommento"); + } + + protected void ToggleCtrl() + { + ShowBtn = !ShowBtn; + } + + #endregion Protected Methods + + #region Private Fields + + private int idxTipoCommento = 0; + + #endregion Private Fields + + #region Private Properties + + private string CodArt + { + get => RecMSE != null ? RecMSE.CodArticolo : ""; + } + + private DateTime dateSel { get; set; } = DateTime.Now; + + private string IdxMacc + { + get => RecMSE != null ? RecMSE.IdxMacchina : ""; + } + + private int MatrOpr + { + get => MServ.MatrOpr; + } + + private bool ShowBtn { get; set; } = true; + private string userComment { get; set; } = ""; + + private string UserComment + { + get => userComment.Trim(); + set + { + if (userComment != value) + { + userComment = value; + E_CommRec.InvokeAsync(value).ConfigureAwait(false); + } + } + } + + #endregion Private Properties + + #region Private Methods + + private void DoReset() + { + UserComment = ""; + DateSel = DateTime.Now; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/NotesMan.razor b/MP-TAB-SERV/Components/NotesMan.razor index d02a6ecd..85a91315 100644 --- a/MP-TAB-SERV/Components/NotesMan.razor +++ b/MP-TAB-SERV/Components/NotesMan.razor @@ -1,5 +1,12 @@ 

NotesMan

- +
+
+ Lista fermate +
+
+ Lista commenti +
+
@code { } diff --git a/MP-TAB-SERV/Components/PrintMag.razor.cs b/MP-TAB-SERV/Components/PrintMag.razor.cs index 2d7321d7..b24f4e2d 100644 --- a/MP-TAB-SERV/Components/PrintMag.razor.cs +++ b/MP-TAB-SERV/Components/PrintMag.razor.cs @@ -85,28 +85,12 @@ namespace MP_TAB_SERV.Components private string IdxMacc { - get - { - string answ = ""; - if (RecMSE != null) - { - answ = RecMSE.IdxMacchina ?? ""; - } - return answ; - } + get => RecMSE != null ? RecMSE.IdxMacchina : ""; } private int IdxOdl { - get - { - int answ = 0; - if (RecMSE != null) - { - answ = RecMSE.IdxOdl ?? 0; - } - return answ; - } + get => RecMSE != null ? RecMSE.IdxOdl ?? 0 : 0; } private int MatrOpr diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index 9bea2e83..475ae361 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.618 + 6.16.2310.712 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/Notes.razor b/MP-TAB-SERV/Pages/Notes.razor index 08082dcc..05ed18b0 100644 --- a/MP-TAB-SERV/Pages/Notes.razor +++ b/MP-TAB-SERV/Pages/Notes.razor @@ -9,6 +9,7 @@ else
+ } diff --git a/MP-TAB-SERV/Pages/ProdStop.razor b/MP-TAB-SERV/Pages/ProdStop.razor index deede436..2aa602ca 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor +++ b/MP-TAB-SERV/Pages/ProdStop.razor @@ -10,13 +10,8 @@ else -
- -
+ +
@if (!string.IsNullOrEmpty(lblOut)) { diff --git a/MP-TAB-SERV/Pages/ProdStop.razor.cs b/MP-TAB-SERV/Pages/ProdStop.razor.cs index eb122f57..fcacbcee 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor.cs +++ b/MP-TAB-SERV/Pages/ProdStop.razor.cs @@ -87,8 +87,18 @@ namespace MP_TAB_SERV.Pages // processo evento... if (insRealtime) { + EventListModel newRec = new EventListModel() + { + IdxMacchina = IdxMacc, + InizioStato = DateTime.Now, + IdxTipo = IdxEv, + CodArticolo = rigaStato.CodArticolo, + Value = "DRT", + MatrOpr = MatrOpr, + pallet = rigaStato.pallet + }; // se realtime - await TabServ.scriviRigaEventoBarcode(IdxMacc, IdxEv, rigaStato.CodArticolo, "DRT", MatrOpr, rigaStato.pallet); + await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.barcode); // resetta il microstato in modo da ricevere successive info HW TabServ.resetMicrostatoMacchina(IdxMacc); } @@ -195,6 +205,8 @@ namespace MP_TAB_SERV.Pages } #endregion Private Properties + [Inject] + protected NavigationManager NavMan { get; set; } = null!; #region Private Methods @@ -202,16 +214,23 @@ namespace MP_TAB_SERV.Pages { if (string.IsNullOrEmpty(IdxMacc)) { - IdxMacc = await MsgServ.IdxMaccGet(); - // recupero MSE macchina.... - if (!string.IsNullOrEmpty(IdxMacc)) + try { - CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + IdxMacc = await MsgServ.IdxMaccGet(); + // recupero MSE macchina.... + if (!string.IsNullOrEmpty(IdxMacc)) + { + CurrMSE = await MsgServ.GetMachineMse(IdxMacc); + } + var eventsAll = await TabSrv.AnagEventiGetByMacch(IdxMacc); + if (eventsAll != null) + { + events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.Label).ToList(); + } } - var eventsAll = await TabSrv.AnagEventiGetByMacch(IdxMacc); - if (eventsAll != null) + catch { - events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.Label).ToList(); + NavMan.NavigateTo("/", true); } } } diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index 7b5f8b42..8a79f7e4 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.618

+

Versione: 6.16.2310.712


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index 0967f47a..da193ec4 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.618 +6.16.2310.712 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index 4a921950..38539ac0 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.618 + 6.16.2310.712 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-TAB-SERV/Shared/NavMenu.razor b/MP-TAB-SERV/Shared/NavMenu.razor index a525553d..da607ea3 100644 --- a/MP-TAB-SERV/Shared/NavMenu.razor +++ b/MP-TAB-SERV/Shared/NavMenu.razor @@ -48,9 +48,8 @@
} } - +@*
- + *@ diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index 53663798..cb36fdba 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -302,6 +302,38 @@ namespace MP.Data.Controllers _configuration = null; } + + /// + /// Eliminazione record EventList (SE trovato) + /// + /// + /// + public async Task EvListDelete(string idxMacchina, DateTime dtEvento) + { + bool fatto = false; + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + var item2del = dbCtx + .DbSetEvList + .Where(x => x.IdxMacchina == idxMacchina && x.InizioStato == dtEvento) + .FirstOrDefault(); + if (item2del != null) + { + dbCtx.DbSetEvList.Remove(item2del); + await dbCtx.SaveChangesAsync(); + } + } + catch (Exception exc) + { + Log.Error($"Eccezione durante EvListDelete{Environment.NewLine}{exc}"); + } + } + await Task.Delay(1); + return fatto; + } + /// /// Aggiunta record EventList /// diff --git a/MP.Data/Objects/Enums.cs b/MP.Data/Objects/Enums.cs index ee7d02aa..c2b61cb2 100644 --- a/MP.Data/Objects/Enums.cs +++ b/MP.Data/Objects/Enums.cs @@ -414,7 +414,8 @@ namespace MP.Data.Objects public enum tipoInputEvento { barcode, - hw + hw, + commento } /// diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 44fb1d96..4fbe2be6 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -424,29 +424,13 @@ namespace MP.Data.Services } /// - /// scrive una riga di evento inviato da Barcode nel db + /// Scrive una riga in EventList inviato nel db + check /// - /// codice macchina - /// idx evento - /// Codice Articolo - /// valore - /// matricola operatore - /// pallet (vuoto se nd) + /// Record da registrare /// - public async Task scriviRigaEventoBarcode(string idxMacchina, int idxTipo, string codArticolo, string value, int matrOpr, string pallet) + public async Task EvListInsert(EventListModel newRec, tipoInputEvento tipoEv) { bool inserito = false; - DateTime adesso = DateTime.Now; - EventListModel newRec = new EventListModel() - { - IdxMacchina = idxMacchina, - InizioStato = adesso, - IdxTipo = idxTipo, - CodArticolo = codArticolo, - Value = value, - MatrOpr = matrOpr, - pallet = pallet - }; try { // inserisco evento @@ -454,18 +438,22 @@ namespace MP.Data.Services } catch (Exception exc) { - string logMsg = $"Eccezione in fase di scrittura evento con i seguenti dati | macchina: {idxMacchina} | IdxTipo: {idxTipo} | CodArticolo: {codArticolo} | Value {value} | MatrOpr {matrOpr} | Pallet {pallet}{Environment.NewLine}{exc}"; + string logMsg = $"Eccezione in fase di scrittura evento con i seguenti dati | macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value {newRec.Value} | MatrOpr {newRec.MatrOpr} | Pallet {newRec.pallet}{Environment.NewLine}{exc}"; Log.Error(logMsg); } - try + // se non è un commento... + if (tipoEv != tipoInputEvento.commento) { - // faccio controllo per eventuale cambio stato da tab transizioni... - dbTabController.CheckCambiaStatoBatch(tipoInputEvento.barcode, idxMacchina, adesso, idxTipo, codArticolo, value, matrOpr, pallet); - } - catch (Exception exc) - { - string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoInputEvento.barcode} | macchina: {idxMacchina} | dataOra: {adesso} | IdxTipo: {idxTipo} | CodArticolo: {codArticolo} | Value {value} | MatrOpr {matrOpr} | Pallet {pallet}{Environment.NewLine}{exc}"; - Log.Error(logMsg); + try + { + // faccio controllo per eventuale cambio stato da tab transizioni... + dbTabController.CheckCambiaStatoBatch(tipoEv, newRec.IdxMacchina, newRec.InizioStato ?? DateTime.Now, newRec.IdxTipo, newRec.CodArticolo, newRec.Value, newRec.MatrOpr, newRec.pallet); + } + catch (Exception exc) + { + string logMsg = $"Eccezione in checkCambiaStatoBatch(6) | tipoInputEvento: {tipoEv} |macchina: {newRec.IdxMacchina} | IdxTipo: {newRec.IdxTipo} | CodArticolo: {newRec.CodArticolo} | Value {newRec.Value} | MatrOpr {newRec.MatrOpr} | Pallet {newRec.pallet}{Environment.NewLine}{exc}"; + Log.Error(logMsg); + } } // formatto output inputComandoMapo answ = new inputComandoMapo(); @@ -474,6 +462,28 @@ namespace MP.Data.Services return answ; } + /// + /// Elimina una riga in EventList se trovata + /// + /// + /// + /// + public async Task EvListDelete(string idxMacchina, DateTime dtEvento) + { + bool fatto = false; + try + { + // inserisco evento + fatto = await dbTabController.EvListDelete(idxMacchina, dtEvento); + } + catch (Exception exc) + { + string logMsg = $"Eccezione in EvListDelete | macchina: {idxMacchina} | DataEv: {dtEvento}{Environment.NewLine}{exc}"; + Log.Error(logMsg); + } + return fatto; + } + /// /// Recupero Righe (Actual) della scheda tecnica da GRUPPO + ODL ///