From f56a7e516414c7b1dd875d14d7e5ac8f167db29e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 18 Oct 2022 11:28:59 +0200 Subject: [PATCH] Aggiunto btn x forzare syncDb --- MP.SPEC/Components/ListODL.razor | 1 + MP.SPEC/Components/ListODL.razor.cs | 160 ++++++++++++++++++---------- MP.SPEC/MP.SPEC.csproj | 2 +- MP.SPEC/Resources/ChangeLog.html | 2 +- MP.SPEC/Resources/VersNum.txt | 2 +- MP.SPEC/Resources/manifest.xml | 2 +- 6 files changed, 109 insertions(+), 60 deletions(-) diff --git a/MP.SPEC/Components/ListODL.razor b/MP.SPEC/Components/ListODL.razor index a1368074..0f4c5086 100644 --- a/MP.SPEC/Components/ListODL.razor +++ b/MP.SPEC/Components/ListODL.razor @@ -15,6 +15,7 @@ else @if (currRecord != null && !showStats && isCurrOdl) {
+
@*
diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 473b369f..2a062862 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -1,10 +1,8 @@ using Microsoft.AspNetCore.Components; using Microsoft.JSInterop; -using MP.Data; using MP.Data.DatabaseModels; using MP.SPEC.Data; -using MP.SPEC.Pages; -using System.Xml.Linq; +using MP.SPEC.Services; namespace MP.SPEC.Components { @@ -45,34 +43,10 @@ namespace MP.SPEC.Components return MP.Data.Utils.FormDurata(durataMin); } - //oggetto contenente le funzioni del code behind che sono jsInvokable - private DotNetObjectReference? objRef; - -#if false //FUNZIONA SE IL METODO TriggerDotNetInstanceMethod() E' IN ONCLICK BOTTONE - - [JSInvokable] - public void setHelper() - { - objRef = DotNetObjectReference.Create(this); - } - [JSInvokable] - public void svuotaRecord() - { - currRecord = null; - - } - public async Task TriggerDotNetInstanceMethod() - { - await JSRuntime.InvokeVoidAsync("recordDeselect", objRef); - } -#endif - #endregion Public Methods #region Protected Properties - - [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -82,6 +56,9 @@ namespace MP.SPEC.Components [Inject] protected MessageService MessageService { get; set; } = null!; + [Inject] + protected IOApiService MpIoApiCall { get; set; } = null!; + #endregion Protected Properties #region Protected Methods @@ -105,6 +82,34 @@ namespace MP.SPEC.Components await reloadData(); } + protected string colorChanger(string colorCSS) + { + string answ = ""; + if (colorCSS == "yellow") + { + answ = "text-dark"; + } + return answ; + } + + /// + /// Richiesta invio sync all'IOB-WIN + /// + /// + protected async Task forceSyncDb() + { + if (!await JSRuntime.InvokeAsync("confirm", "Sei sicuro di voler reinviare i dati (Articoli, PODL) all'impianto?")) + return; + + if (currRecord != null) + { + await callSyncDb(currRecord.IdxMacchina); + // ricarica... + await selectRecord(null); + } + await reloadData(); + } + protected override async Task OnInitializedAsync() { ListStati = await MDService.AnagStatiComm(); @@ -117,24 +122,6 @@ namespace MP.SPEC.Components await reloadData(); } - protected string colorChanger(string colorCSS) - { - string answ = ""; - if (colorCSS == "yellow") - { - answ = "text-dark"; - } - return answ; - } - - //protected double durataMin(DateTime? DataInizio, DateTime? DataFine) - //{ - // DateTime end = DataInizio != null ? (DateTime)DataFine : DateTime.Now; - // var tsDurata = (end).Subtract((DateTime)DataInizio); - - // return tsDurata.TotalMinutes; - //} - protected async void OnSeachUpdated() { await InvokeAsync(() => @@ -145,12 +132,18 @@ namespace MP.SPEC.Components }); } + // return tsDurata.TotalMinutes; + //} protected async Task resetSel() { await selectRecord(null); await reloadData(); } + //protected double durataMin(DateTime? DataInizio, DateTime? DataFine) + //{ + // DateTime end = DataInizio != null ? (DateTime)DataFine : DateTime.Now; + // var tsDurata = (end).Subtract((DateTime)DataInizio); protected async Task selectRecord(ODLModel? currRec) { showStats = true; @@ -167,6 +160,7 @@ namespace MP.SPEC.Components ListOdlStats = null; } } + protected async Task selectStatRecord(ODLModel? currRec) { showStats = true; @@ -205,16 +199,36 @@ namespace MP.SPEC.Components private ODLModel? currRecord = null; - private ODLModel? statRecord = null; - private List? ListOdlStats; private List? ListRecords; private List? ListStati; + //oggetto contenente le funzioni del code behind che sono jsInvokable + private DotNetObjectReference? objRef; + +#if false //FUNZIONA SE IL METODO TriggerDotNetInstanceMethod() E' IN ONCLICK BOTTONE + + [JSInvokable] + public void setHelper() + { + objRef = DotNetObjectReference.Create(this); + } + [JSInvokable] + public void svuotaRecord() + { + currRecord = null; + } + public async Task TriggerDotNetInstanceMethod() + { + await JSRuntime.InvokeVoidAsync("recordDeselect", objRef); + } +#endif private List? SearchRecords; + private ODLModel? statRecord = null; + #endregion Private Fields #region Private Properties @@ -242,17 +256,33 @@ namespace MP.SPEC.Components } private DateTime selDtFine { get; set; } = DateTime.Now; + private bool showStats { get; set; } = false; -#if false - private List? ListOdlStatsData = new List(); - private List? ListOdlStatsLabels = new List(); -#endif + private int totalCount { get; set; } = 0; #endregion Private Properties #region Private Methods + /// + /// Chiama metodo x chiedere sync DB + /// + /// + /// + private async Task addTask2Exe(string idxMacc, string taskName, string taskVal) + { + // compongo URL e chiamo + string restUrl = $"IOB/addTask2Exe/{idxMacc}?taskName={taskName}&taskVal={taskVal}"; + try + { + var response = await MpIoApiCall.callMpIoUrlGet(restUrl); + } + catch (Exception exc) + { + } + } + private double calcolaPerc(double durata) { double answ = 0; @@ -277,6 +307,28 @@ namespace MP.SPEC.Components } return answ; } + + /// + /// Chiama metodo x chiedere sync DB + /// + /// + /// + private async Task callSyncDb(string IdxMacc) + { + // chiamo aggiunta task SyncDb... + await addTask2Exe(IdxMacc, "syncDbData", ""); + } + +#if false + private List? ListOdlStatsData = new List(); + private List? ListOdlStatsLabels = new List(); +#endif + + private async void MessageService_EA_PageUpdated() + { + await reloadData(); + } + private string pbStyle(string css) { string answ = ""; @@ -284,7 +336,7 @@ namespace MP.SPEC.Components { if (css == "yellow") { - answ ="orange"; + answ = "orange"; } else if (css == "blue") { @@ -297,10 +349,6 @@ namespace MP.SPEC.Components } return answ; } - private async void MessageService_EA_PageUpdated() - { - await reloadData(); - } private async Task reloadData() { diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index fa062dff..ff760eab 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2210.1810 + 6.16.2210.1811 diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index af7eb687..1781293c 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2210.1810

+

Versione: 6.16.2210.1811


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index d2be8c80..214992df 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2210.1810 +6.16.2210.1811 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index d4046f3a..b444da8d 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2210.1810 + 6.16.2210.1811 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