diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index c64c745b..c5385ccf 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -286,6 +286,29 @@ namespace MP.Data.Controllers
return ListLinkFilt("SpecLink");
}
+ ///
+ /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
+ ///
+ /// * = tutte, altrimenti solo x una data macchina
+ /// *=tutti, altrimenti solo selezionato
+ /// numero massimo record da restituire
+ ///
+ public List FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ dbResult = dbCtx
+ .DbSetFluxLog
+ .AsNoTracking()
+ .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina) && (CodFlux == "*" || x.CodFlux == CodFlux))
+ .OrderByDescending(x => x.dtEvento)
+ .Take(MaxRec)
+ .ToList();
+ }
+ return dbResult;
+ }
+
public List ListLinkFilt(string tipoLink)
{
List dbResult = new List();
@@ -403,6 +426,37 @@ namespace MP.Data.Controllers
return dbResult;
}
+ ///
+ /// Elenco parametri validi x una data macchina
+ ///
+ ///
+ ///
+ public List ParametriGetFilt(string IdxMacchina)
+ {
+ List dbResult = new List();
+ using (var dbCtx = new MoonProContext(_configuration))
+ {
+ //var rawData = dbCtx
+ // .DbSetFluxLog
+ // .AsNoTracking()
+ // .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
+ // .GroupBy(i => i.CodFlux)
+ // .Select(group => group.First())
+ // .ToList();
+ // dbResult = rawData
+ // .Select(x => x.CodFlux)
+ // .ToList();
+ dbResult = dbCtx
+ .DbSetFluxLog
+ .AsNoTracking()
+ .Where(x => (IdxMacchina == "*" || x.IdxMacchina == IdxMacchina))
+ .Select(i => i.CodFlux)
+ .Distinct()
+ .ToList();
+ }
+ return dbResult;
+ }
+
///
/// Eliminazione Record
///
diff --git a/MP.Data/DatabaseModels/FluxLog.cs b/MP.Data/DatabaseModels/FluxLog.cs
new file mode 100644
index 00000000..52ee8133
--- /dev/null
+++ b/MP.Data/DatabaseModels/FluxLog.cs
@@ -0,0 +1,29 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+
+#nullable disable
+
+namespace MP.Data.DatabaseModels
+{
+ [Table("FluxLog")]
+ public partial class FluxLog
+ {
+ #region Public Properties
+
+ [MaxLength(50)]
+ public string IdxMacchina { get; set; }
+
+ public DateTime dtEvento { get; set; }
+
+ [MaxLength(50)]
+ public string CodFlux { get; set; }
+
+ [MaxLength(250)]
+ public string Valore { get; set; }
+
+ public int Cnt { get; set; }
+
+ #endregion Public Properties
+ }
+}
\ No newline at end of file
diff --git a/MP.Data/MoonProContext.cs b/MP.Data/MoonProContext.cs
index 2471364a..d1b3f033 100644
--- a/MP.Data/MoonProContext.cs
+++ b/MP.Data/MoonProContext.cs
@@ -44,6 +44,7 @@ namespace MP.Data
public virtual DbSet DbSetLinkMenu { get; set; }
public virtual DbSet DbSetODL { get; set; }
public virtual DbSet DbSetPODL { get; set; }
+ public virtual DbSet DbSetFluxLog { get; set; }
#endregion Public Properties
@@ -285,7 +286,12 @@ namespace MP.Data
});
modelBuilder.Entity(entity =>
{
- entity.HasKey(e => new { e.TableName, e.FieldName, e.value});
+ entity.HasKey(e => new { e.TableName, e.FieldName, e.value });
+
+ });
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => new { e.IdxMacchina, e.dtEvento, e.CodFlux});
});
diff --git a/MP.SPEC/Data/MpDataService.cs b/MP.SPEC/Data/MpDataService.cs
index 539e8d88..3ee649fd 100644
--- a/MP.SPEC/Data/MpDataService.cs
+++ b/MP.SPEC/Data/MpDataService.cs
@@ -316,6 +316,18 @@ namespace MP.SPEC.Data
return Task.FromResult(dbController.ElencoLink());
}
+ ///
+ /// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
+ ///
+ /// * = tutte, altrimenti solo x una data macchina
+ /// *=tutti, altrimenti solo selezionato
+ /// numero massimo record da restituire
+ ///
+ public Task> FluxLogGetLastFilt(string IdxMacchina, string CodFlux, int MaxRec)
+ {
+ return Task.FromResult(dbController.FluxLogGetLastFilt(IdxMacchina, CodFlux, MaxRec));
+ }
+
///
/// Elenco setup dei tag conf correnti
///
@@ -365,6 +377,10 @@ namespace MP.SPEC.Data
return await Task.FromResult(dbController.ListPODLFilt(codArt, keyRichPart));
}
+ ///
+ /// Elenco di tutte le macchine gestite
+ ///
+ ///
public Task> MacchineGetAll()
{
return Task.FromResult(dbController.MacchineGetAll());
@@ -403,6 +419,16 @@ namespace MP.SPEC.Data
return result;
}
+ ///
+ /// Elenco di tutti i parametri filtrati x macchina
+ ///
+ /// * = tutte, altrimenti solo x una data macchina
+ ///
+ public Task> ParametriGetFilt(string IdxMacchina)
+ {
+ return Task.FromResult(dbController.ParametriGetFilt(IdxMacchina));
+ }
+
///
/// Eliminazione record selezionato
///
diff --git a/MP.SPEC/Pages/PARAMS.razor b/MP.SPEC/Pages/PARAMS.razor
new file mode 100644
index 00000000..bd1ba9a9
--- /dev/null
+++ b/MP.SPEC/Pages/PARAMS.razor
@@ -0,0 +1,31 @@
+@page "/PARAMS"
+
+
+PARAMS
+
+Appunti (eliminabili)
+
+
+ -
+ I parametri sono nella tabella FluxLog (in preparazione modello dati + metodi...) --> FluxLogGetLastFilt
+
+ -
+ scopo della apgina è mostrare in "quasi tempo reale" (near realtime) i parametri che si aggiornano
+
+ -
+ la pagina deve avere un card come PODL nel cui header siano mostrate elenco amchcine ed elenco parametri x mostrare tutti / solo uno (filtro)
+
+ -
+ MpDataService --> metodi per elenchi: MacchineGetAll e ParametriGetAll
+
+ -
+ il metodo principale recupera gli ultimi n record (configurabile? mostrare in alto un selettore x indicare quanti "last values" recuperare?)
+
+ -
+ il refgresh idealmente è ogni 2-5 sec (configurabile come sopra?)
+
+
+
+@code {
+
+}