diff --git a/MP.INVE/Pages/Cancellazione.razor b/MP.INVE/Pages/Cancellazione.razor new file mode 100644 index 00000000..082a3803 --- /dev/null +++ b/MP.INVE/Pages/Cancellazione.razor @@ -0,0 +1,89 @@ +@page "/Cancellazione" + +
+
MP.INVE
+
+ Cancellazione +
+
+ +
+
+ +
+
+
Menu
+ +
+
+ + +
+
+ + +@if (currScan != null) +{ +
+
+ + Dati ultima scansione + +
+
+ +
+
+
+ Codice: +
+
+ @currScan.ScanValue +
+
+
+
+ Lotto: +
+
+ @currScan.Lotto +
+
+ +
+
+ Articolo: +
+
+ @currScan.CodArticolo +
+
+
+
+ Quantità: +
+
+ @Math.Round(currScan.Qty, 0) +
+
+ +
+
+ +
+ +
+
+} +else if (first) +{ +
Eseguire scansione
+} +else +{ +
Nessuna scansione trovata
+} diff --git a/MP.INVE/Pages/Cancellazione.razor.cs b/MP.INVE/Pages/Cancellazione.razor.cs new file mode 100644 index 00000000..a0bcae4b --- /dev/null +++ b/MP.INVE/Pages/Cancellazione.razor.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using 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.INVE; +using MP.INVE.Shared; +using MP.INVE.Components; +using MP.Data.DatabaseModels; +using MP.INVE.Data; +using Microsoft.AspNetCore.WebUtilities; + +namespace MP.INVE.Pages +{ + public partial class Cancellazione + { + [Inject] + MiDataService MIService { get; set; } = null!; + [Inject] + IJSRuntime JSRuntime { get; set; } = null!; + [Inject] + private NavigationManager NavManager { get; set; } = null!; + + protected string rawScan { get; set; } = null!; + + ScanDataModel? currScan; + protected bool first { get; set; } = false; + protected override async Task OnInitializedAsync() + { + first = true; + await Task.Delay(1); + var uri = NavManager.ToAbsoluteUri(NavManager.Uri); + if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("sessID", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idOpr", out var _idOpr)) + { + sessID = int.Parse(_inveSessionId); + idOPr = _idOpr; + } + } + + int sessID { get; set; } = 0; + string idOPr { get; set; } = ""; + + protected void saveScan(string newScan) + { + first = false; + if (!string.IsNullOrEmpty(newScan)) + { + rawScan = newScan; + currScan = MIService.ScanByValueSessionOpr(rawScan, sessID, idOPr); + } + } + + protected async Task deleteScan(ScanDataModel scan) + { + await MIService.deleteScansione(scan); + NavManager.NavigateTo(NavManager.Uri, true); + } + protected async Task goBack() + { + await JSRuntime.InvokeVoidAsync("history.go", -1); + } + + private string CodUDC { get; set; } = null!; + } +} \ No newline at end of file