refresh fermate

This commit is contained in:
Samuele Locatelli
2026-02-24 16:37:30 +01:00
parent 39e7a38001
commit 4f6edcae47
13 changed files with 181 additions and 18 deletions
+2
View File
@@ -26,6 +26,8 @@ namespace MP.Core
public const string redisDossByMac = redisBaseAddr + "Cache:DossByMac";
public const string redisEventList = redisBaseAddr + "Cache:EventList";
public const string redisFluxByMac = redisBaseAddr + "Cache:FluxByMac";
public const string redisFluxLogFilt = redisBaseAddr + "Cache:FluxLogFilt";
+49 -4
View File
@@ -1,20 +1,21 @@
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using MP.Core.DTO;
using MP.Core.Objects;
using MP.Data.DbModels;
using MP.Data.DTO;
using MP.Core.Objects;
using MP.Data.Translate;
using NLog;
using Org.BouncyCastle.Crypto;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using static EgwCoreLib.Utils.DtUtils;
using MP.Core.DTO;
using MP.Data.Translate;
using ZXing;
using static EgwCoreLib.Utils.DtUtils;
namespace MP.Data.Controllers
{
@@ -115,6 +116,50 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// Restituisce l'anagrafica EVENTI per macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGetByMacc(string IdxMac)
{
List<vSelEventiBCodeModel> dbResult = new List<vSelEventiBCodeModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacch = new SqlParameter("@idxMacchina", IdxMac);
dbResult = dbCtx
.DbSetVSEB
.FromSqlRaw("exec dbo.stp_vseb_getByIdxMacchinaFull @idxMacchina", IdxMacch)
.AsNoTracking()
.AsEnumerable()
.ToList();
}
return dbResult;
}
/// <summary>
/// Restituisce l'anagrafica EVENTI generalmente disponibile per OGNI macchina
/// </summary>
/// <param name="TableName">Nome Table x filtro (std: EvList)</param>
/// <param name="FieldName">Nome Field x filtro (std: Common)</param>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGeneral(string TableName = "EvList", string FieldName = "Common")
{
List<vSelEventiBCodeModel> dbResult = new List<vSelEventiBCodeModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var pTableName = new SqlParameter("@TableName", TableName);
var pFieldName = new SqlParameter("@FieldName", FieldName);
dbResult = dbCtx
.DbSetVSEB
.FromSqlRaw("exec dbo.stp_vseb_getGenerallyAvailable @TableName, @FieldName", pTableName, pFieldName)
.AsNoTracking()
.AsEnumerable()
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco Gruppi tipo Azienda
/// </summary>
+1 -1
View File
@@ -118,7 +118,7 @@ namespace MP.Data.Controllers
}
/// <summary>
/// Restituisce l'anagrafica EVENTI per intero
/// Restituisce l'anagrafica EVENTI per macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGetByMacc(string IdxMac)
@@ -1,4 +1,4 @@
<div class=" col-4 col-sm-4 col-md-4 col-lg-2 flex-fill2">
<div class="col-4 col-sm-4 col-md-4 col-lg-2 flex-fill2">
<div class="p-2 h-100 w-100">
<div class="@objCss text-center card w-100 h-100" @onclick="() => ReportSelected()">
<div class="card-body text-light">
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Components;
namespace MP.SPEC.Components
namespace MP.SPEC.Components.Fermate
{
public partial class ProdStopMan
{
+6 -4
View File
@@ -6,10 +6,12 @@
}
else
{
foreach (var item in ListaFermate)
{
<ProdStopMan objCss="@item.CssClass" objIcon="@item.Icon" objTxt="@(item.label)" IdxEvento="@item.value" E_EventSelected="EventRecord"></ProdStopMan>
}
<div class="row">
@foreach (var item in ListaFermate)
{
<MP.SPEC.Components.Fermate.ProdStopMan objCss="@item.CssClass" objIcon="@item.Icon" objTxt="@(item.label)" IdxEvento="@item.value" E_EventSelected="EventRecord"></MP.SPEC.Components.Fermate.ProdStopMan>
}
</div>
}
</div>
</div>
+74
View File
@@ -161,6 +161,80 @@ namespace MP.SPEC.Data
return result;
}
/// <summary>
/// Elenco EVENTI validi x macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGetByMacch(string IdxMacch)
{
using var activity = ActivitySource.StartActivity("AnagEventiGetByMacch");
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
// cerco in redisConn...
string currKey = $"{Utils.redisEventList}:VSEB:{IdxMacch}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.AnagEventiGetByMacc(IdxMacch);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<vSelEventiBCodeModel>();
}
sw.Stop();
Log.Debug($"AnagEventiGetByMacch | {source} | {sw.Elapsed.TotalMilliseconds}ms");
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
return result;
}
/// <summary>
/// Elenco EVENTI validi x ogni macchina secondo conf standard macchina
/// </summary>
/// <returns></returns>
public List<vSelEventiBCodeModel> AnagEventiGeneral()
{
using var activity = ActivitySource.StartActivity("AnagEventiGeneral");
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<vSelEventiBCodeModel>? result = new List<vSelEventiBCodeModel>();
// cerco in redisConn...
string currKey = $"{Utils.redisEventList}:VSEB:GENERAL";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbController.AnagEventiGeneral();
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
redisDb.StringSet(currKey, rawData, getRandTOut(redisLongTimeCache));
}
if (result == null)
{
result = new List<vSelEventiBCodeModel>();
}
sw.Stop();
Log.Debug($"AnagEventiGeneral | {source} | {sw.Elapsed.TotalMilliseconds}ms");
activity?.SetTag("data.source", source);
activity?.SetTag("result.count", result.Count);
return result;
}
/// <summary>
/// Delete record AnagraficaGruppi
/// </summary>
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2602.2415</Version>
<Version>6.16.2602.2416</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+9 -2
View File
@@ -24,10 +24,17 @@
{
<div class="row">
<div class="col-6">
<ListMacc ListMSE="@SearchRecords" ></ListMacc>
<ListMacc ListMSE="@SearchMacchine" EC_Selected="CheckSelection"></ListMacc>
</div>
<div class="col-6">
<ListFerm></ListFerm>
@if (showFermate)
{
<ListFerm ListaFermate="SearchFermate"></ListFerm>
}
else
{
<div class="alert alert-info fs-5">Selezionare impianti per proseguire.</div>
}
</div>
</div>
}
+10 -2
View File
@@ -23,7 +23,8 @@ namespace MP.SPEC.Pages
{
var rawList = MDService.MacchineGetFilt("*");
// prendo solo macchine VALIDE
SearchRecords = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList();
SearchMacchine = rawList.Where(x => !string.IsNullOrEmpty(x.locazione)).ToList();
SearchFermate = MDService.AnagEventiGeneral();
}
#endregion Protected Methods
@@ -31,9 +32,16 @@ namespace MP.SPEC.Pages
#region Private Fields
private bool isLoading = false;
private bool showFermate = false;
private List<MacchineModel> SearchRecords = new();
private List<MacchineModel> SearchMacchine = new();
List<vSelEventiBCodeModel> SearchFermate = new();
#endregion Private Fields
private void CheckSelection(List<string> listSelezione)
{
// se c'è selezione mostro elenco fermate...
showFermate = listSelezione.Count > 0;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2602.2416</h4>
<br /> Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.6.15.* &rarr;</b>
<ul>
<li>Prima release dotnet6</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/IOT" target="_blank">&copy; Steamware 2006-2023</a>
</div>
</div>
</body>
+1 -1
View File
@@ -1 +1 @@
6.16.2602.2415
6.16.2602.2416
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2602.2415</version>
<version>6.16.2602.2416</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>