From 283cb70251d113dfba5026ec88a61fe48a17a035 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 16 Oct 2023 15:03:47 +0200 Subject: [PATCH] modifica gest licenza LAND --- MP-TAB-SERV/Components/ControlsMan.razor.cs | 8 + MP-TAB-SERV/Components/MachineSelOdl.razor.cs | 59 ++--- MP-TAB-SERV/Components/ScrapEditor.razor | 41 +++ MP-TAB-SERV/Components/ScrapEditor.razor.cs | 242 ++++++++++++++++++ MP-TAB-SERV/Components/ScrapMan.razor | 124 ++++++++- MP-TAB-SERV/Components/ScrapMan.razor.cs | 196 ++++++++++++-- MP-TAB-SERV/Pages/Notes.razor | 4 +- MP.Land/Components/HomeLink.razor | 16 +- MP.Land/Components/HomeLink.razor.cs | 7 +- MP.Land/MP.Land.csproj | 2 +- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- 13 files changed, 642 insertions(+), 63 deletions(-) create mode 100644 MP-TAB-SERV/Components/ScrapEditor.razor create mode 100644 MP-TAB-SERV/Components/ScrapEditor.razor.cs diff --git a/MP-TAB-SERV/Components/ControlsMan.razor.cs b/MP-TAB-SERV/Components/ControlsMan.razor.cs index 56f5208f..26c38499 100644 --- a/MP-TAB-SERV/Components/ControlsMan.razor.cs +++ b/MP-TAB-SERV/Components/ControlsMan.razor.cs @@ -167,15 +167,23 @@ namespace MP_TAB_SERV.Components private bool showInsert = false; private bool showNote = false; private int TotalCount = 0; + private bool useOdl = false; #endregion Private Fields #region Private Properties private Periodo CurrPeriodo { get; set; } = new Periodo(); + private string IdxMaccSel { get; set; } = ""; + private int IdxOdl { get; set; } = 0; + private string selMessage + { + get => useOdl ? "Periodo da ODL" : "Periodo Libero"; + } + #endregion Private Properties } } \ No newline at end of file diff --git a/MP-TAB-SERV/Components/MachineSelOdl.razor.cs b/MP-TAB-SERV/Components/MachineSelOdl.razor.cs index 9dde62b7..f15a0895 100644 --- a/MP-TAB-SERV/Components/MachineSelOdl.razor.cs +++ b/MP-TAB-SERV/Components/MachineSelOdl.razor.cs @@ -36,9 +36,26 @@ namespace MP_TAB_SERV.Components } } } - private int idxOdlSel { get; set; } = 0; + protected List ListODL { get; set; } = new(); + protected int NumRec + { + get => numRec; + set + { + if (numRec != value) + { + numRec = value; + var pUpd = Task.Run(async () => + { + await ReloadData(); + }); + pUpd.Wait(); + } + } + } + [Inject] protected TabDataService TabDServ { get; set; } = null!; @@ -51,36 +68,7 @@ namespace MP_TAB_SERV.Components await ReloadData(); } - #endregion Protected Methods - - #region Private Properties - - private int numRec { get; set; } = 10; - - private int NumRec - { - get => numRec; - set - { - if (numRec != value) - { - numRec = value; - var pUpd = Task.Run(async () => - { - await ReloadData(); - await Task.Delay(1); - //await InvokeAsync(() => StateHasChanged()); - }); - pUpd.Wait(); - } - } - } - - #endregion Private Properties - - #region Private Methods - - private async Task ReloadData() + protected async Task ReloadData() { isProcessing = true; await Task.Delay(1); @@ -92,6 +80,13 @@ namespace MP_TAB_SERV.Components await Task.Delay(1); } - #endregion Private Methods + #endregion Protected Methods + + #region Private Properties + + private int idxOdlSel { get; set; } = 0; + private int numRec { get; set; } = 10; + + #endregion Private Properties } } \ No newline at end of file diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor b/MP-TAB-SERV/Components/ScrapEditor.razor new file mode 100644 index 00000000..b064ca35 --- /dev/null +++ b/MP-TAB-SERV/Components/ScrapEditor.razor @@ -0,0 +1,41 @@ +
+
+
+
+ +
+
+
+ @if (ShowDetail) + { +
+
+
+
+ Data Ora + +
+
+
+ +
+
+
+ + +
+
+
+ @if (CanSave) + { + + } +
+
+
+ } +
\ No newline at end of file diff --git a/MP-TAB-SERV/Components/ScrapEditor.razor.cs b/MP-TAB-SERV/Components/ScrapEditor.razor.cs new file mode 100644 index 00000000..bf5f0bb8 --- /dev/null +++ b/MP-TAB-SERV/Components/ScrapEditor.razor.cs @@ -0,0 +1,242 @@ +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 ScrapEditor + { + #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 EventCallback E_Updated { get; set; } + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + protected string Title + { + get => ShowDetail? "Nascondi Registrazione Scarti": "Mostra Registrazione Scarti"; + } + [Parameter] + public EventListModel? CurrRecord + { + set + { + if (value != null) + { + DateSel = value.InizioStato ?? DateTime.Now; + UserComment = value.Value; + ShowDetail = false; + } + } + } + + #endregion Public Properties + + #region Protected Properties + + protected DateTime DateSel + { + get => dateSel.Round(TimeSpan.FromSeconds(1)); + 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(); + } + + /// + /// Forza salvataggio impostando data-ora + /// + /// + /// + public async Task ForceSave(DateTime dtRif) + { + DateSel = dtRif; + // ora salvo + await doSave(); + } + + 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, idxTipoCommento); + // inserisco + await TabServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.commento); + // reset + DoReset(); + //ToggleCtrl(); + await E_Updated.InvokeAsync(true); + } + + protected override void OnInitialized() + { + idxTipoCommento = SMServ.GetConfInt("idxTipoCommento"); + dltMinRealtime = SMServ.GetConfInt("dltMinRealtime"); + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + // verifico SE ci sia una data da usare... + bool hasDtRif = await MServ.SessHasVal(MessageService.KeyCommDtRif); + if (hasDtRif) + { + await Task.Delay(1); + ShowDetail = false; + UserComment = await MServ.CommentoValGet(true); + DateSel = await MServ.CommentoDtRifGet(true); + 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) + /// + protected bool insRealtime + { + get + { + bool answ = true; + try + { + if (Math.Abs(DateSel.Subtract(DateTime.Now).TotalMinutes) > dltMinRealtime) + { + answ = false; + } + } + catch + { } + return answ; + } + } + + protected void ToggleCtrl() + { + ShowDetail = !ShowDetail; + if (ShowDetail) + { + DateSel = DateTime.Now; + } + } + + #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 ShowDetail { 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; + ShowDetail = true; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/ScrapMan.razor b/MP-TAB-SERV/Components/ScrapMan.razor index dadcb885..08297ecd 100644 --- a/MP-TAB-SERV/Components/ScrapMan.razor +++ b/MP-TAB-SERV/Components/ScrapMan.razor @@ -1,3 +1,125 @@ -

ScrapMan

+ + + +
+
+

Tipo Selezione

+
+
+
+ + +
+
+
+@if (useOdl) +{ + +} +else +{ + +} + +
+
+ + @if (showInsert) + { + @if (showNote) + { +
+
+
+ @*
+
*@ + + +
+
+
+ +
+
+ } + else + { +
+
+ +
+
+ +
+
+ } + } +
+
+
+
+ + + + + + + + + @foreach (var item in ListPaged) + { + + + + } + +
+ Elenco Controlli +
+
+
+
+ Art: @item.CodArticolo +
+
+ ODL: @($"ODL{item.IdxOdl:000000000}") +
+
+
+ @if (item.EsitoOk) + { + + } + else + { + + } +
+
+
+ @($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}") +
+
+ @item.Operatore + +
+
+
+ @if (!string.IsNullOrEmpty(item.Note)) + { +
@item.Note
+ } +
+
+
+
+
+
+ +
\ No newline at end of file diff --git a/MP-TAB-SERV/Components/ScrapMan.razor.cs b/MP-TAB-SERV/Components/ScrapMan.razor.cs index 8f938f4e..84c0e14c 100644 --- a/MP-TAB-SERV/Components/ScrapMan.razor.cs +++ b/MP-TAB-SERV/Components/ScrapMan.razor.cs @@ -1,29 +1,189 @@ -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 static EgwCoreLib.Utils.DtUtils; namespace MP_TAB_SERV.Components { public partial class ScrapMan { + #region Public Properties + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + #endregion Public Properties + + #region Public Methods + + /// + /// Aggiorno valori produzione alla data richiesta... + /// + /// + public async Task doUpdate() + { + isProcessing = true; + await Task.Delay(1); + if (!string.IsNullOrEmpty(IdxMaccSel)) + { + ListComplete = await TabDServ.RegControlliFilt(IdxMaccSel, IdxOdl, CurrPeriodo.Inizio, CurrPeriodo.Fine, false); + TotalCount = ListComplete.Count; + // esegue paginazione + UpdateTable(); + } + isProcessing = false; + await Task.Delay(1); + } + + #endregion Public Methods + + #region Protected Properties + + protected string ConfTitle + { + get => showInsert ? "Nascondi Controllo" : "Registra Controllo"; + } + + protected List ListComplete { get; set; } = new List(); + protected List ListPaged { get; set; } = new List(); + + [Inject] + protected MessageService MServ { get; set; } = null!; + + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected override async Task OnInitializedAsync() + { + await Task.Delay(1); + if (RecMSE != null) + { + IdxMaccSel = RecMSE.IdxMacchina; + CurrPeriodo = new Periodo(PeriodSet.ThisWeek); + await doUpdate(); + } + } + + protected async Task SaveKo() + { + isProcessing = true; + await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, false, noteKo, DateTime.Now); + showInsert = false; + showNote = false; + await doUpdate(); + isProcessing = false; + } + + protected void SaveNumRec(int newNum) + { + NumRecPage = newNum; + UpdateTable(); + } + + protected async Task SaveOk() + { + isProcessing = true; + await TabDServ.RegControlliInsert(IdxMaccSel, MServ.MatrOpr, true, noteKo, DateTime.Now); + showInsert = false; + showNote = false; + await doUpdate(); + isProcessing = false; + } + + protected void SavePage(int newNum) + { + PageNum = newNum; + UpdateTable(); + } + + protected async Task SetMacc(string selIdxMacc) + { + isProcessing = true; + await Task.Delay(1); + IdxMaccSel = selIdxMacc; + await doUpdate(); + isProcessing = false; + await Task.Delay(1); + } + + protected async Task SetOdl(int selIdxOdl) + { + isProcessing = true; + await Task.Delay(1); + IdxOdl = selIdxOdl; + await doUpdate(); + isProcessing = false; + await Task.Delay(1); + } + + protected async Task SetPeriodo(Periodo newPeriodo) + { + CurrPeriodo = newPeriodo; + await doUpdate(); + } + + protected void ShowKo() + { + showNote = true; + } + + protected void ToggleBtn() + { + showInsert = !showInsert; + if (showInsert) + { + noteKo = ""; + showNote = false; + } + } + + protected void UpdateTable() + { + // esegue paginazione + if (TotalCount > NumRecPage) + { + ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList(); + } + else + { + ListPaged = ListComplete; + } + } + + #endregion Protected Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + private bool isProcessing = false; + private string noteKo = ""; + private int NumRecPage = 10; + private int PageNum = 1; + private bool showInsert = false; + private bool showNote = false; + private int TotalCount = 0; + private bool useOdl = false; + + #endregion Private Fields + + #region Private Properties + + private Periodo CurrPeriodo { get; set; } = new Periodo(); + + private string IdxMaccSel { get; set; } = ""; + + private int IdxOdl { get; set; } = 0; + + private string selMessage + { + get => useOdl ? "Periodo da ODL" : "Periodo Libero"; + } + + #endregion Private Properties } } \ No newline at end of file diff --git a/MP-TAB-SERV/Pages/Notes.razor b/MP-TAB-SERV/Pages/Notes.razor index 75af4a70..1362e15e 100644 --- a/MP-TAB-SERV/Pages/Notes.razor +++ b/MP-TAB-SERV/Pages/Notes.razor @@ -6,9 +6,7 @@ } else { -
- -
+ } diff --git a/MP.Land/Components/HomeLink.razor b/MP.Land/Components/HomeLink.razor index 5729ad03..eef11e60 100644 --- a/MP.Land/Components/HomeLink.razor +++ b/MP.Land/Components/HomeLink.razor @@ -34,10 +34,20 @@ else // disegno box cliccabile e licenza ASSISTENZA mancante {
- - + @if (hasLic()) + { + +

@CurrItem.AppName 

-
+ + } + else + { + + }
diff --git a/MP.Land/Components/HomeLink.razor.cs b/MP.Land/Components/HomeLink.razor.cs index 4b5e800f..4e0882a2 100644 --- a/MP.Land/Components/HomeLink.razor.cs +++ b/MP.Land/Components/HomeLink.razor.cs @@ -46,7 +46,6 @@ namespace MP.Land.Components protected bool authOk() { - //return false; bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); if (allOk) { @@ -56,7 +55,11 @@ namespace MP.Land.Components MService.YearAuth = true; } } - + return allOk; + } + protected bool hasLic() + { + bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey); return allOk; } diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index b553890b..33bbb0e9 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2310.1610 + 6.16.2310.1615 diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index e7642e5e..5fb28cd2 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

Versione: 6.16.2310.1610

+

Versione: 6.16.2310.1615


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index 3663ae78..1dd72699 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2310.1610 +6.16.2310.1615 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 4e42c9aa..fd7a9843 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2310.1610 + 6.16.2310.1615 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false