diff --git a/REMAN/REMAN/Components/RemnantEdit.razor b/REMAN/REMAN/Components/RemnantEdit.razor index 9b17609..56a96d3 100644 --- a/REMAN/REMAN/Components/RemnantEdit.razor +++ b/REMAN/REMAN/Components/RemnantEdit.razor @@ -40,31 +40,23 @@
-
+
- L mm + L mm
-
-
-
-
- W mm + W mm
-
-
-
-
- T mm + T mm
diff --git a/REMAN/REMAN/Data/RDataService.cs b/REMAN/REMAN/Data/RDataService.cs index e0e2e06..d1a4727 100644 --- a/REMAN/REMAN/Data/RDataService.cs +++ b/REMAN/REMAN/Data/RDataService.cs @@ -14,6 +14,8 @@ namespace REMAN.Data private static IConfiguration _configuration; private static ILogger _logger; + + private List cachedDataList = new List(); private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); //private readonly IEmailSender _emailSender; @@ -37,8 +39,8 @@ namespace REMAN.Data #region Protected Fields - protected const string rKeyMaterials = "REMAN:Materials"; - protected const string rKeyRemnants = "REMAN:Remnants"; + protected const string rKeyMaterials = "Cache:Materials"; + protected const string rKeyRemnants = "Cache:Remnants"; protected static string connStringBBM = ""; #endregion Protected Fields @@ -120,7 +122,13 @@ namespace REMAN.Data { List dbResult = new List(); string rawData; - var redisDataList = await distributedCache.GetAsync(rKeyRemnants); + string cacheKey = $"{rKeyRemnants}:{matId}:{minQty}"; + if (!cachedDataList.Contains(cacheKey)) + { + cachedDataList.Add(cacheKey); + } + + var redisDataList = await distributedCache.GetAsync(cacheKey); if (redisDataList != null) { rawData = Encoding.UTF8.GetString(redisDataList); @@ -134,7 +142,7 @@ namespace REMAN.Data dbResult = rawList.OrderBy(o => o.Area).ToList(); rawData = JsonConvert.SerializeObject(dbResult); redisDataList = Encoding.UTF8.GetBytes(rawData); - await distributedCache.SetAsync(rKeyRemnants, redisDataList, cacheOpt(false)); + await distributedCache.SetAsync(cacheKey, redisDataList, cacheOpt(false)); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Log.Trace($"Effettuata lettura da DB + caching per RemnantsGetAll: {ts.TotalMilliseconds} ms"); @@ -195,6 +203,11 @@ namespace REMAN.Data { await distributedCache.RemoveAsync(rKeyMaterials); await distributedCache.RemoveAsync(rKeyRemnants); + foreach (var item in cachedDataList) + { + await distributedCache.RemoveAsync(item); + } + cachedDataList = new List(); } diff --git a/REMAN/REMAN/Pages/Index.razor b/REMAN/REMAN/Pages/Index.razor index 586f38a..029864a 100644 --- a/REMAN/REMAN/Pages/Index.razor +++ b/REMAN/REMAN/Pages/Index.razor @@ -5,3 +5,38 @@

ReMan

Remnants Management App + +
+
+ + +
+ Remnant Deposit +
+
+
+
+ + +
+ Remnant Pickup +
+
+
+
+ + +
+ Materials list +
+
+
+
+ + +
+ Remnants list +
+
+
+
\ No newline at end of file diff --git a/REMAN/REMAN/Pages/Remnants.razor b/REMAN/REMAN/Pages/Remnants.razor index 5e081ba..9d5e356 100644 --- a/REMAN/REMAN/Pages/Remnants.razor +++ b/REMAN/REMAN/Pages/Remnants.razor @@ -10,6 +10,12 @@

Remnants

+
+ @if (processing) + { + ...working... + } +
@@ -58,7 +64,6 @@ {
- @*
*@ @@ -85,6 +90,9 @@ +
@record.MaterialNav.MatExtCode diff --git a/REMAN/REMAN/Pages/Remnants.razor.cs b/REMAN/REMAN/Pages/Remnants.razor.cs index 263e882..e882621 100644 --- a/REMAN/REMAN/Pages/Remnants.razor.cs +++ b/REMAN/REMAN/Pages/Remnants.razor.cs @@ -19,7 +19,8 @@ namespace REMAN.Pages #region Protected Fields - protected int SelMatID = 0; + protected int _SelMatID = 0; + protected bool processing = false; #endregion Protected Fields @@ -82,6 +83,20 @@ namespace REMAN.Pages [Inject] protected IJSRuntime JSRuntime { get; set; } + protected int SelMatID + { + get + { + return _SelMatID; + } + set + { + _SelMatID = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + protected int totalCount { get @@ -182,6 +197,14 @@ namespace REMAN.Pages await ReloadData(); } + protected async Task Print(RemnantsModel selRecord) + { + processing = true; + await Task.Delay(1000); + // chiamata esterna x registrare richiesta + processing = false; + } + protected async Task remQty(RemnantsModel selRecord) { //if (!await JSRuntime.InvokeAsync("confirm", "Confirm qtantity decrease?")) diff --git a/REMAN/REMAN/Program.cs b/REMAN/REMAN/Program.cs index 3c50677..ca60ac4 100644 --- a/REMAN/REMAN/Program.cs +++ b/REMAN/REMAN/Program.cs @@ -15,6 +15,12 @@ builder.Services.AddAuthorization(options => options.FallbackPolicy = options.DefaultPolicy; }); +builder.Services.AddStackExchangeRedisCache(options => +{ + options.ConfigurationOptions = new StackExchange.Redis.ConfigurationOptions() { KeepAlive = 180, DefaultDatabase = 13, EndPoints = { { "localhost", 6379 } } }; + options.InstanceName = "ReMan:"; +}); + builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); builder.Services.AddSingleton(); diff --git a/REMAN/REMAN/REMAN.csproj b/REMAN/REMAN/REMAN.csproj index aab875f..8988ec5 100644 --- a/REMAN/REMAN/REMAN.csproj +++ b/REMAN/REMAN/REMAN.csproj @@ -8,6 +8,7 @@ + diff --git a/REMAN/REMAN/Shared/NavMenu.razor b/REMAN/REMAN/Shared/NavMenu.razor index abc009d..41ca711 100644 --- a/REMAN/REMAN/Shared/NavMenu.razor +++ b/REMAN/REMAN/Shared/NavMenu.razor @@ -14,6 +14,16 @@ Home + +