diff --git a/MP-TAB/MP-TAB/Components/Layout/NavMenu.razor b/MP-TAB/MP-TAB/Components/Layout/NavMenu.razor
index b4a14c28..ad904f29 100644
--- a/MP-TAB/MP-TAB/Components/Layout/NavMenu.razor
+++ b/MP-TAB/MP-TAB/Components/Layout/NavMenu.razor
@@ -1,4 +1,4 @@
-@inject OprFiltData MDataService
+@inject ListSelectDataSrv MDataService
@*
*@
@*
diff --git a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor
index 58c4144b..057c85d3 100644
--- a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor
+++ b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor
@@ -1,4 +1,4 @@
@page "/tc-history"
-
+
diff --git a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs
deleted file mode 100644
index a0ea8578..00000000
--- a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using global::System;
-using global::System.Collections.Generic;
-using global::System.Linq;
-using global::System.Threading.Tasks;
-using global::Microsoft.AspNetCore.Components;
-using System.Net.Http;
-using System.Net.Http.Json;
-using Microsoft.AspNetCore.Components.Forms;
-using Microsoft.AspNetCore.Components.Routing;
-using Microsoft.AspNetCore.Components.Sections;
-using Microsoft.AspNetCore.Components.Web;
-using Microsoft.AspNetCore.Components.Web.Virtualization;
-using Microsoft.JSInterop;
-using MP.Data;
-using MP.Data.DatabaseModels;
-using MP.Data.DTO;
-using MP.Data.Services;
-using MP_TAB;
-using MP_TAB.Components;
-using static System.Runtime.InteropServices.JavaScript.JSType;
-
-namespace MP_TAB.Components.Pages
-{
- public partial class TCHistory
- {
- #region Protected Properties
-
- protected string azienda { get; set; } = "*";
-
- protected List
? ListMacchine { get; set; } = null;
-
- ///
- /// Matricola operatore corrente (da rendere parametrico con gest operatore)
- ///
- protected int MatrOpr { get; set; } = 102;
-
- [Inject]
- protected OprFiltData MDataService { get; set; } = null!;
-
- protected int NumRec { get; set; } = 100000;
- protected List SearchArticoli { get; set; } = new List();
- protected string SearchVal { get; set; } = "";
- protected int SrcMinChar { get; set; } = 3;
- protected int TotalCount { get; set; } = 0;
-
- #endregion Protected Properties
-
- #region Protected Methods
-
- protected async Task DoSearchUpd(string newSearch)
- {
- SearchVal = newSearch;
- await ReloadFiltData();
- }
-
- protected override async Task OnInitializedAsync()
- {
- //await ReloadAllData();
- }
-
- protected override async Task OnParametersSetAsync()
- {
- await ReloadAllData();
- // return base.OnParametersSetAsync();
- }
-
- protected async Task ReloadAllData()
- {
- await ReloadFiltData();
- TotalCount = SearchArticoli != null ? SearchArticoli.Count : 0;
- }
-
- protected async Task ReloadFiltData()
- {
- // ricarica SOLO SE ho almeno un filtro valido...
- if (!string.IsNullOrEmpty(SearchVal))
- {
- SearchArticoli = await MDataService.ArticoliGetSearch(NumRec, azienda, SearchVal);
- }
- else
- {
- SearchArticoli = new List();
- }
- ListMacchine = await MDataService.MacchineByMatrOper(MatrOpr);
- }
-
-
- #endregion Protected Methods
- }
-}
\ No newline at end of file
diff --git a/MP-TAB/MP-TAB/Controllers/ListSelectController.cs b/MP-TAB/MP-TAB/Controllers/ListSelectController.cs
index 05d88b71..564092f4 100644
--- a/MP-TAB/MP-TAB/Controllers/ListSelectController.cs
+++ b/MP-TAB/MP-TAB/Controllers/ListSelectController.cs
@@ -15,7 +15,7 @@ namespace MP_TAB.Controllers
{
#region Public Constructors
- public ListSelectController(IConfiguration configuration, OprFiltData DataService)
+ public ListSelectController(IConfiguration configuration, ListSelectDataSrv DataService)
{
Log.Info("Starting ListSelectController");
_configuration = configuration;
@@ -50,7 +50,6 @@ namespace MP_TAB.Controllers
return answ;
}
-
[HttpGet("GetDictArticoli")]
public async Task> GetDictArticoli(string SearchArt, string Azienda = "*", int NumRec = 100000)
{
@@ -67,7 +66,28 @@ namespace MP_TAB.Controllers
}
catch (Exception exc)
{
- Log.Error($"Eccezione in GetArticoli | SearchArt: {SearchArt} | Azienda: {Azienda} | NumRec: {NumRec}{Environment.NewLine}{exc}");
+ Log.Error($"Eccezione in GetDictArticoli | SearchArt: {SearchArt} | Azienda: {Azienda} | NumRec: {NumRec}{Environment.NewLine}{exc}");
+ }
+ return answ;
+ }
+
+ [HttpGet("GetDictMacc")]
+ public async Task> GetDictMacc(int MatrOpr)
+ {
+ Dictionary answ = new Dictionary();
+ await Task.Delay(1);
+ try
+ {
+ var rawData = await FiltDataServ.MacchineByMatrOper(MatrOpr);
+ // trasformo!
+ if (rawData != null)
+ {
+ answ = rawData.ToDictionary(x => x.IdxMacchina, x => $"{x.IdxMacchina} | {x.Nome}");
+ }
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Eccezione in GetDictMacc | MatrOpr: {MatrOpr}{Environment.NewLine}{exc}");
}
return answ;
}
@@ -84,7 +104,7 @@ namespace MP_TAB.Controllers
#region Private Properties
- private OprFiltData FiltDataServ { get; set; } = null!;
+ private ListSelectDataSrv FiltDataServ { get; set; } = null!;
#endregion Private Properties
}
diff --git a/MP-TAB/MP-TAB/Program.cs b/MP-TAB/MP-TAB/Program.cs
index e453684f..b1fd9e4c 100644
--- a/MP-TAB/MP-TAB/Program.cs
+++ b/MP-TAB/MP-TAB/Program.cs
@@ -15,7 +15,7 @@ var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
// Add services x accesso dati
builder.Services.AddSingleton(redisMultiplexer);
builder.Services.AddSingleton();
-builder.Services.AddSingleton();
+builder.Services.AddSingleton();
// nuova versione contenuti...
builder.Services.AddRazorComponents()
diff --git a/MP.Data/Services/OprFiltData.cs b/MP.Data/Services/ListSelectDataSrv.cs
similarity index 98%
rename from MP.Data/Services/OprFiltData.cs
rename to MP.Data/Services/ListSelectDataSrv.cs
index 5a06dd15..456b7548 100644
--- a/MP.Data/Services/OprFiltData.cs
+++ b/MP.Data/Services/ListSelectDataSrv.cs
@@ -18,11 +18,11 @@ namespace MP.Data.Services
///
/// Classe accesso dati filtrati per operatore
///
- public class OprFiltData : BaseServ, IDisposable
+ public class ListSelectDataSrv : BaseServ, IDisposable
{
#region Public Constructors
- public OprFiltData(IConfiguration configuration)
+ public ListSelectDataSrv(IConfiguration configuration)
{
_configuration = configuration;
@@ -55,6 +55,43 @@ namespace MP.Data.Services
#region Public Methods
+ ///
+ /// Elenco tabella Articoli da filtro
+ ///
+ /// Numero record max da recuperare
+ /// cod azienda, * = tutte
+ /// Ricerca testuale
+ ///
+ public async Task> ArticoliGetSearch(int numRecord, string azienda, string searchVal)
+ {
+ string source = "DB";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ List? result = new List();
+ // cerco in redis...
+ string currKey = $"{redisBaseKey}:Art:{azienda}:{searchVal}:{numRecord}";
+ RedisValue rawData = await redisDb.StringGetAsync(currKey);
+ if (!string.IsNullOrEmpty($"{rawData}"))
+ {
+ result = JsonConvert.DeserializeObject>($"{rawData}");
+ source = "REDIS";
+ }
+ else
+ {
+ result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
+ // serializzp e salvo...
+ rawData = JsonConvert.SerializeObject(result);
+ await redisDb.StringSetAsync(currKey, rawData, LongCache);
+ }
+ if (result == null)
+ {
+ result = new List();
+ }
+ sw.Stop();
+ Log.Debug($"ArticoliGetSearch | azienda: {azienda} | searchVal: {searchVal} | numRecord: {numRecord} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
+ return result;
+ }
+
public Task> ConfigGetAll()
{
return Task.FromResult(dbController.ConfigGetAll().ToList());
@@ -101,7 +138,6 @@ namespace MP.Data.Services
return result;
}
-
///
/// Elenco Macchine dato operatore secondo gruppi (macchine/operatore)
///
@@ -137,45 +173,6 @@ namespace MP.Data.Services
return result;
}
-
-
- ///
- /// Elenco tabella Articoli da filtro
- ///
- /// Numero record max da recuperare
- /// cod azienda, * = tutte
- /// Ricerca testuale
- ///
- public async Task> ArticoliGetSearch(int numRecord, string azienda, string searchVal)
- {
- string source = "DB";
- Stopwatch sw = new Stopwatch();
- sw.Start();
- List? result = new List();
- // cerco in redis...
- string currKey = $"{redisBaseKey}:Art:{azienda}:{searchVal}:{numRecord}";
- RedisValue rawData = await redisDb.StringGetAsync(currKey);
- if (!string.IsNullOrEmpty($"{rawData}"))
- {
- result = JsonConvert.DeserializeObject>($"{rawData}");
- source = "REDIS";
- }
- else
- {
- result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
- // serializzp e salvo...
- rawData = JsonConvert.SerializeObject(result);
- await redisDb.StringSetAsync(currKey, rawData, LongCache);
- }
- if (result == null)
- {
- result = new List();
- }
- sw.Stop();
- Log.Debug($"ArticoliGetSearch | azienda: {azienda} | searchVal: {searchVal} | numRecord: {numRecord} | {source} | {sw.Elapsed.TotalMilliseconds}ms");
- return result;
- }
-
#endregion Public Methods
#region Protected Fields