From ed2c694abd7a1811a1edb2bcd7c160ce6edee4b2 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 7 Nov 2022 09:34:30 +0100 Subject: [PATCH] Fix duplicazione x valori edit --- MP.SPEC/Components/ListDossiers.razor.cs | 5 ++-- MP.SPEC/Components/ListPARAMS.razor.cs | 25 ------------------- MP.SPEC/Components/ParamsFilter.razor.cs | 31 ++++++++++++++++-------- MP.SPEC/Data/SelectFluxParams.cs | 28 +++++++++++++++++---- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 8 files changed, 51 insertions(+), 46 deletions(-) diff --git a/MP.SPEC/Components/ListDossiers.razor.cs b/MP.SPEC/Components/ListDossiers.razor.cs index fbe1818b..2da19533 100644 --- a/MP.SPEC/Components/ListDossiers.razor.cs +++ b/MP.SPEC/Components/ListDossiers.razor.cs @@ -128,7 +128,7 @@ namespace MP.SPEC.Components IdxMacchina = selRec.IdxMacchina, CodArticolo = selRec.CodArticolo, IdxODL = 0, - Valore = selRec.Valore, + Valore = selRec.Valore }; currRecordClone = newRec; await Task.Delay(1); @@ -160,7 +160,7 @@ namespace MP.SPEC.Components protected async Task newDossier(DossierModel selRec) { - var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezioanto?"); + var alert = await JSRuntime.InvokeAsync("confirm", "Confermi di voler creare un nuovo Dossier per l'impianto/articolo selezionato?"); if (alert) { @@ -184,6 +184,7 @@ namespace MP.SPEC.Components { item.IdxMacchina = selRec.IdxMacchina; item.Valore = "0"; + item.ValoreEdit = "0"; item.dtEvento = DateTime.Now; } } diff --git a/MP.SPEC/Components/ListPARAMS.razor.cs b/MP.SPEC/Components/ListPARAMS.razor.cs index 60e514d1..59cbdda6 100644 --- a/MP.SPEC/Components/ListPARAMS.razor.cs +++ b/MP.SPEC/Components/ListPARAMS.razor.cs @@ -163,7 +163,6 @@ namespace MP.SPEC.Components protected async Task resetSel() { currRecord = null; - setDtMax(); await RecordSel.InvokeAsync(null); } @@ -246,31 +245,7 @@ namespace MP.SPEC.Components get => SelFilter.dtMax; set => SelFilter.dtMax = value; } - protected void setDtMax() - { - // copio il filtro - var currFilt = SelFilter; - // fermo update - //currFilt.LiveUpdate = true; - currFilt.CurrPage = 0; - currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; - currFilt.dtMax = RoundDatetime(5); - currFilt.dtMin = RoundDatetime(5).AddHours(-25); - SelFilter = currFilt; - } - /// - /// Inizializzazione con periodo e arrotondamento - /// - /// - /// - public static DateTime RoundDatetime(int minRound) - { - TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); - int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; - DateTime endRounded = DateTime.Today.AddMinutes(minDay); - return endRounded; - } private int totalCount { get => _totalCount; diff --git a/MP.SPEC/Components/ParamsFilter.razor.cs b/MP.SPEC/Components/ParamsFilter.razor.cs index c29423a6..a3bdab92 100644 --- a/MP.SPEC/Components/ParamsFilter.razor.cs +++ b/MP.SPEC/Components/ParamsFilter.razor.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Components; +using MP.Data; using MP.SPEC.Data; namespace MP.SPEC.Components @@ -24,10 +25,7 @@ namespace MP.SPEC.Components /// public static DateTime RoundDatetime(int minRound) { - TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today); - int minDay = (int)Math.Ceiling((double)(DayElapsed.TotalMinutes / minRound)) * minRound; - DateTime endRounded = DateTime.Today.AddMinutes(minDay); - return endRounded; + return Utils.InitDatetime(DateTime.Now, minRound); } public void Dispose() @@ -172,9 +170,9 @@ namespace MP.SPEC.Components protected override async Task OnInitializedAsync() { SelFilter = new SelectFluxParams(); - setDtMax(); - DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddDays(-7); - DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Now; + setDtSnap(); + DateTime dtStart = SelFilter.dtMin != null ? (DateTime)SelFilter.dtMin : DateTime.Now.AddMonths(-1); + DateTime dtEnd = SelFilter.dtMax != null ? (DateTime)SelFilter.dtMax : DateTime.Today.AddDays(1); ListMacchine = await MDService.MacchineWithFlux(dtStart, dtEnd); ListFlux = await MDService.ParametriGetFilt(selMacchina); @@ -190,7 +188,7 @@ namespace MP.SPEC.Components await FilterChanged.InvokeAsync(SelFilter); } - protected void setDtMax() + protected void setDtSnap() { // copio il filtro var currFilt = SelFilter; @@ -199,7 +197,7 @@ namespace MP.SPEC.Components currFilt.CurrPage = 0; currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}"; currFilt.dtMax = RoundDatetime(5); - currFilt.dtMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot); + currFilt.dtSnapMin = RoundDatetime(5).AddHours(-numOreAnticipoSnapshot); SelFilter = currFilt; } @@ -226,7 +224,7 @@ namespace MP.SPEC.Components liveUpdate = false; // se non ho data rif uso adesso... DateTime dtMax = selDtMax == null ? RoundDatetime(5) : (DateTime)selDtMax; - DateTime dtMin = selDtMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtMin; + DateTime dtMin = selDtSnapMin == null ? RoundDatetime(5).AddHours(-numOreAnticipoSnapshot) : (DateTime)selDtSnapMin; // aggiungo 15 sec dtMax = dtMax.AddSeconds(15); await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax); @@ -314,6 +312,19 @@ namespace MP.SPEC.Components } } + private DateTime? selDtSnapMin + { + get => SelFilter.dtSnapMin; + set + { + if (SelFilter.dtSnapMin != value) + { + SelFilter.dtSnapMin = value; + reportChange(); + } + } + } + private bool showEditPar { get; set; } = false; private string snapMode diff --git a/MP.SPEC/Data/SelectFluxParams.cs b/MP.SPEC/Data/SelectFluxParams.cs index c78c85c1..f6aab1b8 100644 --- a/MP.SPEC/Data/SelectFluxParams.cs +++ b/MP.SPEC/Data/SelectFluxParams.cs @@ -5,7 +5,11 @@ #region Public Constructors public SelectFluxParams() - { } + { + dtMin = DateTime.Today.AddMonths(-1); + dtMax = DateTime.Today.AddDays(1); + dtSnapMin = DateTime.Today.AddDays(-2); + } #endregion Public Constructors @@ -16,6 +20,7 @@ public DateTime? dtRif { get; set; } = null; public DateTime? dtMax { get; set; } = null; public DateTime? dtMin { get; set; } = null; + public DateTime? dtSnapMin { get; set; } = null; public string IdxMacchina { get; set; } = "*"; public string lastUpdate { get; set; } = "-"; public bool LiveUpdate { get; set; } = true; @@ -36,6 +41,7 @@ dtRif = this.dtRif, dtMax = this.dtMax, dtMin = this.dtMin, + dtSnapMin = this.dtSnapMin, IdxMacchina = this.IdxMacchina, lastUpdate = this.lastUpdate, LiveUpdate = this.LiveUpdate, @@ -54,6 +60,18 @@ if (IdxMacchina != item.IdxMacchina) return false; + if (dtMax != item.dtMax) + return false; + + if (dtMin != item.dtMin) + return false; + + if (dtRif != item.dtRif) + return false; + + if (dtSnapMin != item.dtSnapMin) + return false; + if (CodFlux != item.CodFlux) return false; @@ -65,11 +83,11 @@ if (TempoAgg != item.TempoAgg) return false; - - if (NumRec!= item.NumRec) + + if (NumRec != item.NumRec) return false; - - if (TotCount!= item.TotCount) + + if (TotCount != item.TotCount) return false; if (CurrPage != item.CurrPage) diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index b8eb71f1..223c84e8 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.417 + 6.16.2211.709 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index ef610937..bf5ac8e9 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.417

+

Versione: 6.16.2211.709


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index 4816adb5..400b37d7 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.417 +6.16.2211.709 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index a78df675..f185a31b 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.417 + 6.16.2211.709 https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html false