From bd23c6a49375d81ea1f575e94f83be050e7da085 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Wed, 14 Dec 2022 18:38:25 +0100 Subject: [PATCH] fix pagina invio sessione --- MP.Data/Controllers/MpInveController.cs | 44 +++++++++++++++++++ MP.INVE/Components/ListTotLotto.razor | 14 +----- MP.INVE/Data/MiDataService.cs | 25 +++++++++++ MP.INVE/MP.INVE.csproj | 2 +- MP.INVE/Pages/Invio.razor | 58 ++++++++++++++++--------- MP.INVE/Pages/Invio.razor.cs | 44 +++++++++++++++++-- MP.INVE/Resources/ChangeLog.html | 2 +- MP.INVE/Resources/VersNum.txt | 2 +- MP.INVE/Resources/manifest.xml | 2 +- 9 files changed, 152 insertions(+), 41 deletions(-) diff --git a/MP.Data/Controllers/MpInveController.cs b/MP.Data/Controllers/MpInveController.cs index 13424d25..d78c2f94 100644 --- a/MP.Data/Controllers/MpInveController.cs +++ b/MP.Data/Controllers/MpInveController.cs @@ -5,6 +5,7 @@ using MP.Data.DatabaseModels; using NLog; using System; using System.Collections.Generic; +using System.Formats.Asn1; using System.Linq; using System.Threading.Tasks; @@ -573,6 +574,7 @@ namespace MP.Data.Controllers } return dbResult; } + /// /// Elenco Inventari tipo Azienda (TUTTI, chiusi e paerti) filtrati x data /// @@ -615,6 +617,48 @@ namespace MP.Data.Controllers return dbResult; } + /// + /// Chiusura/apertura sessione + /// + /// + /// + /// + public async Task CloseOpenSessione(int sessID, bool flgClose) + { + bool answ = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var SessID = new SqlParameter("@InveSessID", sessID); + var FlgClose = new SqlParameter("@FlgClose", flgClose); + + var callResulr = await dbCtx + .Database + .ExecuteSqlRawAsync("exec dbo.stp_INV_CloseOpen @InveSessID, @FlgClose", SessID, FlgClose); + + answ = true; + } + return answ; + } + /// + /// Trasferimento + /// + /// + /// + public async Task TransferSessione(int sessID) + { + bool answ = false; + using (var dbCtx = new MoonPro_InveContext(_configuration)) + { + var SessID = new SqlParameter("@InveSessID", sessID); + + var callResulr = await dbCtx + .Database + .ExecuteSqlRawAsync("exec dbo.stp_INV_InveSess_Transfer @InveSessID", SessID); + + answ = true; + } + return answ; + } #endregion gestione sessione #region gestione totale lotti diff --git a/MP.INVE/Components/ListTotLotto.razor b/MP.INVE/Components/ListTotLotto.razor index 8c12f29d..2de2f74a 100644 --- a/MP.INVE/Components/ListTotLotto.razor +++ b/MP.INVE/Components/ListTotLotto.razor @@ -3,9 +3,6 @@ - - - @@ -19,15 +16,6 @@ @foreach (var item in elencoTotLotto) { - - - @@ -41,7 +29,7 @@ @item.NumColli } diff --git a/MP.INVE/Data/MiDataService.cs b/MP.INVE/Data/MiDataService.cs index 44d1edfd..d173b517 100644 --- a/MP.INVE/Data/MiDataService.cs +++ b/MP.INVE/Data/MiDataService.cs @@ -641,6 +641,31 @@ namespace MP.INVE.Data Log.Debug($"InventSessByID Read from {source}: {ts.TotalMilliseconds}ms"); return result; } + + public async Task CloseOpenSessione(int sessID, bool flgClose) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + bool result = false; + string source = "DB"; + result = await dbController.CloseOpenSessione(sessID, flgClose); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"CloseOpenSessione Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } + public async Task TransferSessione(int sessID) + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + bool result = false; + string source = "DB"; + result = await dbController.TransferSessione(sessID); + stopWatch.Stop(); + TimeSpan ts = stopWatch.Elapsed; + Log.Debug($"TransferSessione Read from {source}: {ts.TotalMilliseconds}ms"); + return result; + } #endregion Public Methods #region Protected Fields diff --git a/MP.INVE/MP.INVE.csproj b/MP.INVE/MP.INVE.csproj index 765c7353..8a39520b 100644 --- a/MP.INVE/MP.INVE.csproj +++ b/MP.INVE/MP.INVE.csproj @@ -5,7 +5,7 @@ enable enable MP.INVE - 6.16.2212.1416 + 6.16.2212.1418 diff --git a/MP.INVE/Pages/Invio.razor b/MP.INVE/Pages/Invio.razor index a030f179..f6351dac 100644 --- a/MP.INVE/Pages/Invio.razor +++ b/MP.INVE/Pages/Invio.razor @@ -13,17 +13,6 @@ else

Invio

-
- @if (sessione.DtEnd == null) - { - - } - else if ((sessione.DtEnd != null) && (!sessione.Transferred)) - { - - - } -
@@ -35,6 +24,7 @@ else
+ @@ -73,19 +63,47 @@ else } - +
ID sessioneMagazzinoDescrizione Mag Lotto Articolo Descrizione Art
- @item.InveSessID - - @item.CodMag - - @item.DescMag - @item.Lotto - @item.TotLotto + @($"{item.TotLotto:N2}")
Magazzino Descrizione Mag Durata
+
+ + @if (sessione.DtEnd == null) + { + + } + else + { + + } + @if ((sessione.DtEnd != null) && (!sessione.Transferred)) + { + + + } + else{ + + + } +
+
- -
-
-
-
-
- @if (sessID != 0) + @if ((sessione.DtEnd == null) && (!sessione.Transferred)) { - +
+
+
+
+
+ } + @if (mostra) + { + @if (sessID != 0) + { + + } } diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index 50eb7063..c2c0e8fe 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -84,7 +84,37 @@ namespace MP.INVE.Pages { currPage = newNum; } + protected bool mostra = false; + protected void mostraDati() + { + mostra = true; + } + protected async void chiudiSessione(int sessID) + { + var closed = await MIService.CloseOpenSessione(sessID, true); + if (closed) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } + + protected async void apriSessione(int sessID) + { + var open = await MIService.CloseOpenSessione(sessID, false); + if (open) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } + protected async void trasfSessione(int sessID) + { + var trasf = await MIService.TransferSessione(sessID); + if (trasf) + { + NavManager.NavigateTo(NavManager.Uri, true); + } + } protected override async Task OnInitializedAsync() { @@ -94,7 +124,7 @@ namespace MP.INVE.Pages sessID = int.Parse(_inveSessionId); codMag = int.Parse(_idMag); } - + await reloadData(); } @@ -102,8 +132,14 @@ namespace MP.INVE.Pages { if (firstRender) { - await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); - await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + if (sessione != null) + { + if ((sessione.DtEnd == null) && (!sessione.Transferred)) + { + await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{101}"); + await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{101}", rawCode); + } + } } } @@ -131,7 +167,7 @@ namespace MP.INVE.Pages private async Task reloadData() { - + sessione = null; isLoading = true; sessione = MIService.InventSessByID(sessID); diff --git a/MP.INVE/Resources/ChangeLog.html b/MP.INVE/Resources/ChangeLog.html index 46c400db..3a876955 100644 --- a/MP.INVE/Resources/ChangeLog.html +++ b/MP.INVE/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOINVE -

Versione: 6.16.2212.1416

+

Versione: 6.16.2212.1418


Note di rilascio:
  • diff --git a/MP.INVE/Resources/VersNum.txt b/MP.INVE/Resources/VersNum.txt index d60391cb..a2962d92 100644 --- a/MP.INVE/Resources/VersNum.txt +++ b/MP.INVE/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2212.1416 +6.16.2212.1418 diff --git a/MP.INVE/Resources/manifest.xml b/MP.INVE/Resources/manifest.xml index 55e249a9..7d52793f 100644 --- a/MP.INVE/Resources/manifest.xml +++ b/MP.INVE/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2212.1416 + 6.16.2212.1418 https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/MP.INVE.zip https://nexus.steamware.net/repository/SWS/MP-INVE/stable/LAST/ChangeLog.html false