diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs index f39426ae..d7081f32 100644 --- a/MP.Data/Controllers/MpSpecController.cs +++ b/MP.Data/Controllers/MpSpecController.cs @@ -6,6 +6,7 @@ using NLog; using StackExchange.Redis; using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Threading.Tasks; @@ -332,7 +333,7 @@ namespace MP.Data.Controllers /// /// Elenco giacenze /// - /// record dossier da eliminare + /// id odl da cercare /// public List ListGiacenze(int IdxOdl) { @@ -344,7 +345,8 @@ namespace MP.Data.Controllers dbResult = dbCtx .DbGiacenzeData .AsNoTracking() - .Where(x => x.IdxOdl == IdxOdl).ToList(); + .Where(x => x.IdxOdl == IdxOdl) + .ToList(); } catch (Exception exc) { @@ -353,6 +355,29 @@ namespace MP.Data.Controllers } return dbResult; } + /// + /// Elenco TUTTI GLI ODL + /// + /// + public List ListOdlAll() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + try + { + dbResult = dbCtx + .DbSetODL + .AsNoTracking() + .ToList(); + } + catch (Exception exc) + { + Log.Error($"Eccezione durante ListOdlAll{Environment.NewLine}{exc}"); + } + } + return dbResult; + } /// /// Elenco ultimi n record DOssiers (che contengono ad esempio "salvataggi" di FLuxLog) dato diff --git a/MP.Data/DatabaseModels/AnagGiacenzeModel.cs b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs index da8dff3b..3b001a78 100644 --- a/MP.Data/DatabaseModels/AnagGiacenzeModel.cs +++ b/MP.Data/DatabaseModels/AnagGiacenzeModel.cs @@ -26,6 +26,5 @@ namespace MP.Data.DatabaseModels public double QtyTot { get; set; } = 0; public int NumPack { get; set; } = 0; public string Notes { get; set; } = ""; - } } diff --git a/MP.SPEC/Components/ListGiacenze.razor b/MP.SPEC/Components/ListGiacenze.razor new file mode 100644 index 00000000..72f5337f --- /dev/null +++ b/MP.SPEC/Components/ListGiacenze.razor @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + @if (elencoGiacenze != null) + { + @foreach (var item in elencoGiacenze) + { + + + + + + + + + + + + + + + + + } + } + +
Id GiacenzaIdentRGProdottoTipoFornitoreData riferimentoExtDocQuantita totaleNumero pacchettiNote
+ @item.IdxRG + + @item.IdentRG + + @item.Product + + @item.Variety + + @item.Supplier + + @item.DateRif + + @item.ExtDoc + + @item.QtyTot + + @item.NumPack + + @item.Notes +
diff --git a/MP.SPEC/Components/ListGiacenze.razor.cs b/MP.SPEC/Components/ListGiacenze.razor.cs new file mode 100644 index 00000000..408b7210 --- /dev/null +++ b/MP.SPEC/Components/ListGiacenze.razor.cs @@ -0,0 +1,45 @@ +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.SPEC; +using MP.SPEC.Shared; +using MP.SPEC.Components; +using Microsoft.AspNetCore.WebUtilities; +using MP.Data.DatabaseModels; +using MP.SPEC.Data; +using Blazored.SessionStorage; + +namespace MP.SPEC.Components +{ + public partial class ListGiacenze + { + [Inject] + MpDataService MDService { get; set; } = null!; + + [Inject] + NavigationManager NavManager { get; set; } = null!; + + [Inject] + ISessionStorageService sessionStorage { get; set; } = null!; + + protected List? elencoGiacenze; + + [Parameter] + public int IdxOdl { get; set; } = 0; + + protected override async Task OnInitializedAsync() + { + elencoGiacenze = await MDService.ListGiacenze(IdxOdl); + } + } +} \ No newline at end of file diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs index 36b8a481..e694bcb4 100644 --- a/MP.SPEC/Data/MpDataService.cs +++ b/MP.SPEC/Data/MpDataService.cs @@ -734,10 +734,10 @@ namespace MP.SPEC.Data Log.Debug($"ListPODLFilt | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; } + /// - /// Elenco PODL non avviati filtrati x articolo, KeyRich (che contiene stato) /// - /// Solo lanciati (1) o ancora disponibili (0) + /// id odl da cercare /// public async Task> ListGiacenze(int IdxOdl) { @@ -769,46 +769,43 @@ namespace MP.SPEC.Data Log.Debug($"ListGiacenze | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; } - -#if false - /// - /// Elenco PODL avviati filtrati x articolo, KeyRich (che contiene stato) + /// elenco TUTTI gli ODL /// - /// Cod articolo - /// KeyRich (parziale) da cercare (es cod stato x yacht) + /// /// - public async Task> ListPODLFiltNOOdl(string codArt, string keyRichPart) + public List ListOdlAll() { - List? result = new List(); + List? result = new List(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string readType = "DB"; - string currKey = $"{redisPOdlListNOOdl}:{codArt}:{keyRichPart}"; +#if false + string currKey = $"{redisGiacenzaList}:{IdxOdl}"; // cerco in redis dato valore sel macchina... RedisValue rawData = redisDb.StringGet(currKey); if (rawData.HasValue) { - result = JsonConvert.DeserializeObject>($"{rawData}"); + result = JsonConvert.DeserializeObject>($"{rawData}"); readType = "REDIS"; } else { - result = await Task.FromResult(dbController.ListPODLFiltNOOdl(codArt, keyRichPart)); // serializzo e salvo... rawData = JsonConvert.SerializeObject(result); - redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3)); + redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(redisShortTimeCache)); } if (result == null) { - result = new List(); - } + result = new List(); + } +#endif + result = dbController.ListOdlAll(); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; - Log.Debug($"ListPODLFiltNOOdl | Read from {readType}: {ts.TotalMilliseconds}ms"); + Log.Debug($"ListOdlAll | Read from {readType}: {ts.TotalMilliseconds}ms"); return result; - } -#endif + } /// /// Elenco di tutte le macchine gestite diff --git a/MP.SPEC/MP.SPEC.csproj b/MP.SPEC/MP.SPEC.csproj index a4ce8b5e..0be92b1d 100644 --- a/MP.SPEC/MP.SPEC.csproj +++ b/MP.SPEC/MP.SPEC.csproj @@ -5,7 +5,7 @@ enable enable MP.SPEC - 6.16.2211.2912 + 6.16.2211.2916 @@ -28,6 +28,7 @@ + diff --git a/MP.SPEC/Pages/Giacenze.razor b/MP.SPEC/Pages/Giacenze.razor index 99fbb5ec..fc1fdae4 100644 --- a/MP.SPEC/Pages/Giacenze.razor +++ b/MP.SPEC/Pages/Giacenze.razor @@ -3,77 +3,15 @@

Giacenze

+ @if (odlExp != null) + { + @odlExp.CodArticolo + }
- - - - - - - - - - - - - - - - - - @if (elencoGiacenze != null) - { - @foreach (var item in elencoGiacenze) - { - - - - - - - - - - - - - - - - - - - - } - } - -
IdxRGIdxOdlIdentRGProductVarietySupplierExtDocDateRifQtyTotNumPackNotes
- @item.IdxRG - - @item.IdxOdl - - @item.IdentRG - - @item.Product - - @item.Variety - - @item.Supplier - - @item.ExtDoc - - @item.DateRif - - @item.QtyTot - - @item.NumPack - - @item.Notes -
+
diff --git a/MP.SPEC/Pages/Giacenze.razor.cs b/MP.SPEC/Pages/Giacenze.razor.cs index 4d799bc1..a4ec97fb 100644 --- a/MP.SPEC/Pages/Giacenze.razor.cs +++ b/MP.SPEC/Pages/Giacenze.razor.cs @@ -17,6 +17,7 @@ using MP.SPEC.Components; using MP.Data.DatabaseModels; using MP.SPEC.Data; using Microsoft.AspNetCore.WebUtilities; +using Blazored.SessionStorage; namespace MP.SPEC.Pages { @@ -25,22 +26,27 @@ namespace MP.SPEC.Pages [Inject] MpDataService MDService { get; set; } = null!; + [Inject] + ISessionStorageService sessionStorage { get; set; } = null!; + [Inject] NavigationManager NavManager { get; set; } = null!; - protected List? elencoGiacenze; + protected List? elencoOdl; - protected int IdxOdl = 0; + protected ODLModel? odlExp; + protected int IdxOdl { get; set; } = 0; protected override async Task OnInitializedAsync() { + await Task.Delay(1); var uri = NavManager.ToAbsoluteUri(NavManager.Uri); if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl)) { IdxOdl = int.Parse(_idxOdl); } - - elencoGiacenze = await MDService.ListGiacenze(IdxOdl); + elencoOdl = MDService.ListOdlAll(); + odlExp = elencoOdl.Where(o => (o.IdxOdl == IdxOdl)).SingleOrDefault(); } } diff --git a/MP.SPEC/Program.cs b/MP.SPEC/Program.cs index acb4bdc5..13deb26f 100644 --- a/MP.SPEC/Program.cs +++ b/MP.SPEC/Program.cs @@ -1,4 +1,5 @@ using Blazored.LocalStorage; +using Blazored.SessionStorage; using Microsoft.AspNetCore.Authentication.Negotiate; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; @@ -40,6 +41,7 @@ builder.Services.AddSingleton(redisMultiplexer); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); +builder.Services.AddBlazoredSessionStorage(); builder.Services.AddHttpClient(); builder.Services.AddSingleton(); diff --git a/MP.SPEC/Resources/ChangeLog.html b/MP.SPEC/Resources/ChangeLog.html index 63edddad..bcb24292 100644 --- a/MP.SPEC/Resources/ChangeLog.html +++ b/MP.SPEC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2211.2912

+

Versione: 6.16.2211.2916


Note di rilascio:
  • diff --git a/MP.SPEC/Resources/VersNum.txt b/MP.SPEC/Resources/VersNum.txt index d37a13af..20db0176 100644 --- a/MP.SPEC/Resources/VersNum.txt +++ b/MP.SPEC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2211.2912 +6.16.2211.2916 diff --git a/MP.SPEC/Resources/manifest.xml b/MP.SPEC/Resources/manifest.xml index 715bc2cd..a6e07c4b 100644 --- a/MP.SPEC/Resources/manifest.xml +++ b/MP.SPEC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2211.2912 + 6.16.2211.2916 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