Merge branch 'Release/MpStat_01'

This commit is contained in:
Samuele Locatelli
2025-03-11 18:53:25 +01:00
19 changed files with 289 additions and 87 deletions
+48
View File
@@ -119,6 +119,28 @@ namespace MP.Data.Services
redisDb = null;
}
/// <summary>
/// Pulizia cache Redis (tutta)
/// </summary>
/// <returns></returns>
public async Task<bool> FlushCache()
{
RedisValue pattern = new RedisValue($"{redisBaseKey}:*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
/// Pulizia cache Redis per chiave specifica (da redisBaseKey...)
/// </summary>
/// <returns></returns>
public async Task<bool> FlushCache(string KeyReq)
{
RedisValue pattern = new RedisValue($"{redisBaseKey}:{KeyReq}:*");
bool answ = await ExecFlushRedisPattern(pattern);
return answ;
}
/// <summary>
/// Elenco setup dei tag conf correnti
/// </summary>
@@ -375,6 +397,32 @@ namespace MP.Data.Services
#region Private Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConn.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConn.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
answ = true;
}
}
return answ;
}
/// <summary>
/// Prova a caricare da file la conf degli IOB se presente
/// </summary>
+22 -18
View File
@@ -1,4 +1,4 @@
<div class="col machBlock ">
<div class="m-0 pe-1">
@if (CurrRecord == null || !dataLoaded)
{
<LoadingDataSmall></LoadingDataSmall>
@@ -7,24 +7,24 @@
{
<div class="@cssStatus(CurrRecord.Semaforo) p-1 @overlayCss">
<div class="d-flex ui-title justify-content-center align-items-center text-uppercase">
<div class="px-0 @textDescrCss(@CurrRecord.Nome)">
<div class="px-0 @textDescrCss(@CurrRecord.Nome, maxChar4Scroll)">
<span>@CurrRecord.Nome</span>
</div>
</div>
@if (hasRow(1))
{
<div class="d-flex ui-subtitle justify-content-between py-0 pt-1 px-1">
<div class="d-flex ui-subtitle justify-content-between py-0 px-1">
@foreach (var item in rowValues(1))
{
<div class="px-1 @item.TagCss">@item.TagName: <b>@currVal(item.TagLocation)</b></div>
<div class="px-0 @item.TagCss">@item.TagName: <b>@currVal(item.TagLocation)</b></div>
}
</div>
}
else
{
<div class="d-flex ui-subtitle justify-content-between py-0 pt-1 px-1 fontSmall text-uppercase">
<div class="px-1 pe-0">Art</div>
<div class="px-1 ps-0 ui-art">
<div class="d-flex ui-subtitle justify-content-between py-0 px-1 fontSmall text-uppercase">
<div class="px-1">Art</div>
<div class="px-1 ui-art">
@if (showArt == "CodArticolo")
{
<span>@CurrRecord.CodArticolo</span>
@@ -45,7 +45,7 @@
}
@if (hasRow(2))
{
<div class="d-flex ui-subtitle justify-content-between py-0 pb-1 px-1">
<div class="d-flex ui-subtitle justify-content-between py-0 px-1">
@foreach (var item in rowValues(2))
{
<div class="px-1 @item.TagCss">@item.TagName: <b>@currVal(item.TagLocation)</b></div>
@@ -54,9 +54,13 @@
}
else
{
<div class="d-flex ui-subtitle justify-content-between py-0 pb-1 px-1 fontSmall text-uppercase">
<div class="px-1 pe-0">@(CurrRecord.IdxPOdl > 0 ? $"PODL{CurrRecord.IdxPOdl:00000000}" : "-")</div>
<div class="px-1 ps-0">@(CurrRecord.IdxOdl > 0 ? $"ODL{CurrRecord.IdxOdl:00000000}" : "-")</div>
<div class="d-flex ui-subtitle justify-content-between py-0 px-1 fontSmall text-uppercase">
<div class="px-1">PODL</div>
<div class="px-1 ui-art">@(CurrRecord.IdxPOdl > 0 ? $"{CurrRecord.IdxPOdl:00000000}" : "-")</div>
</div>
<div class="d-flex ui-subtitle justify-content-between py-0 px-1 fontSmall text-uppercase">
<div class="px-1">ODL</div>
<div class="px-1 ui-art">@(CurrRecord.IdxOdl > 0 ? $"{CurrRecord.IdxOdl:00000000}" : "-")</div>
</div>
}
@if (hasRow(3))
@@ -70,8 +74,8 @@
}
else
{
<div class="d-flex justify-content-between pt-0 mt-1 pb-2 px-1 fontSmall text-uppercase">
<div class="px-1 text-truncate col-8">@CurrRecord.DescrizioneStato</div>
<div class="d-flex justify-content-between pt-0 mt-1 pb-1 px-1 fontSmall text-uppercase">
<div class="px-1 text-truncate">@CurrRecord.DescrizioneStato</div>
<div class="px-1 ps-0 text-nowrap">@getMinSec(getDecimal(@CurrRecord.Durata))</div>
</div>
}
@@ -86,10 +90,10 @@
}
else
{
<div class="d-flex justify-content-between pt-0 pb-2 px-1 fontSmall text-uppercase">
<div class="px-1 pe-0">TCiclo</div>
<div class="px-1 ps-0">std: @getMinSec(@CurrRecord.TCAssegnato)</div>
<div class="px-1 ps-0">act: @getMinSec(@CurrRecord.TCLavRT)</div>
<div class="d-flex justify-content-between pt-0 pb-1 px-1 fontSmall text-uppercase">
<div class="px-1 pe-0">TC.</div>
<div class="px-1 ps-0">std @getMinSec(@CurrRecord.TCAssegnato)</div>
<div class="px-1 ps-0">act @getMinSec(@CurrRecord.TCLavRT)</div>
</div>
}
@if (hasRow(5))
@@ -103,7 +107,7 @@
}
else
{
<div class="d-flex justify-content-between py-0 px-1 fontSmall1 text-uppercase">
<div class="d-flex justify-content-between py-0 px-1 fontSmall text-uppercase">
<div class="px-1 pe-0">Pezzi<small class="small"><sub>p/o</sub></small></div>
<div class="px-1 ps-0">@CurrRecord.PezziProd / @CurrRecord.NumPezzi</div>
</div>
+2 -2
View File
@@ -115,10 +115,10 @@ namespace MP.Mon.Components
/// <summary>
/// CSS class x testo (se descr lunga scorre...)
/// </summary>
protected string textDescrCss(string currText)
protected string textDescrCss(string currText, int maxChar)
{
string answ = "text-nowrap";
if (currText.Length > maxChar4Scroll)
if (currText.Length > maxChar)
{
answ = " scroll-left";
}
+1 -1
View File
@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>6.16.2411.1209</Version>
<Version>6.16.2503.1118</Version>
</PropertyGroup>
<ItemGroup>
+6
View File
@@ -0,0 +1,6 @@
@page "/ForceReload"
@page "/force-reload"
<h3>ForceReload</h3>
+22
View File
@@ -0,0 +1,22 @@
using Microsoft.AspNetCore.Components;
using MP.Data.Services;
namespace MP.Mon.Pages
{
public partial class ForceReload
{
[Inject]
protected MonDataFeeder MMDataService { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
protected override async Task OnInitializedAsync()
{
await MMDataService.FlushCache();
await Task.Delay(100);
NavMan.NavigateTo("/", true);
}
}
}
+59 -25
View File
@@ -4,41 +4,75 @@
<PageTitle>MP MON</PageTitle>
<div class="row statusMap mx-1 my-1">
@if (listMSE == null)
{
@if (ListMSE == null)
{
<div class="row statusMap mx-1 my-1">
<div class="col-12">
<LoadingData></LoadingData>
</div>
}
else if (listMSE.Count == 0)
{
</div>
}
else if (ListMSE.Count == 0)
{
<div class="row statusMap mx-1 my-1">
<div class="col-12">
<div class="alert alert-warning">
No data found
</div>
</div>
}
else
</div>
}
else
{
int mseIdx = 0;
for (int i = 0; i < mapNRow; i++)
{
int currIdx = 0;
foreach (var recordIob in listMSE)
{
<DetailMSE CurrRecord="@recordIob" currTagConf="@getIobTag(recordIob.IdxMacchina)" currTagVal="@getTagVal(recordIob.IdxMacchina)" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin" showArt="@showArt" doBlink="@doBlink"></DetailMSE>
currIdx++;
if (currIdx >= maxCol)
<div class="row statusMap mx-1 my-1">
@for (int j = 0; j < maxCol; j++)
{
currIdx = 0;
@((MarkupString)"</div><div class=\"row statusMap mx-1 my-1\">");
var currMse = MseById(mseIdx);
mseIdx++;
if (currMse != null)
{
<div class="col p-0">
<DetailMSE CurrRecord="@currMse" currTagConf="@getIobTag(currMse.IdxMacchina)" currTagVal="@getTagVal(currMse.IdxMacchina)" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin" showArt="@showArt" doBlink="@doBlink"></DetailMSE>
</div>
}
else
{
<div class="col machBlock">&nbsp;</div>
}
}
</div>
}
@* <div class="row statusMap mx-1 my-1">
@{
int currIdx = 0;
foreach (var recordIob in ListMSE)
{
<div class="col machBlock ">
<DetailMSE CurrRecord="@recordIob" currTagConf="@getIobTag(recordIob.IdxMacchina)" currTagVal="@getTagVal(recordIob.IdxMacchina)" doAnimate="@doAnimate" keepAliveMin="@keepAliveMin" showArt="@showArt" doBlink="@doBlink"></DetailMSE>
</div>
currIdx++;
if (currIdx >= maxCol)
{
currIdx = 0;
@((MarkupString)"</div><div class=\"row statusMap mx-1 my-1\">")
;
}
}
// controllo se devo "chiudere riga...
int currNum = (currIdx % maxCol);
while (currNum < (maxCol))
{
@((MarkupString)"<div class=\"col machBlock\">&nbsp;</div>")
;
currNum++;
}
}
// controllo se devo "chiudere riga...
int currNum = (currIdx % maxCol);
while (currNum < (maxCol))
{
@((MarkupString)"<div class=\"col machBlock\">&nbsp;</div>");
currNum++;
</div> *@
}
}
</div>
}
+38 -16
View File
@@ -24,7 +24,7 @@ namespace MP.Mon.Pages
public async void ElapsedSlowTimer(object? source, System.Timers.ElapsedEventArgs e)
{
listMSE = null;
ListMSE = null;
await Task.Delay(10);
Log.Info("Elapsed Slow Timer --> full page reload");
// dispongo i vari timers...
@@ -58,9 +58,26 @@ namespace MP.Mon.Pages
#region Protected Properties
/// <summary>
/// Numero righe mappa: calcolato da num elementi e numMax x riga...
/// </summary>
protected int mapNRow
{
get
{
int answ = 1;
int numElems = ListMSE != null ? ListMSE.Count : 1;
answ = (int)Math.Ceiling((double)numElems / maxCol);
return answ;
}
}
[Inject]
protected MonDataFeeder MMDataService { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
@@ -159,7 +176,20 @@ namespace MP.Mon.Pages
return answ;
}
private string CodGruppo = "";
/// <summary>
/// restituisce MSE dato indice
/// </summary>
/// <param name="mseIdx">Indice MSE richiesto</param>
/// <returns></returns>
protected MappaStatoExpl? MseById(int mseIdx)
{
MappaStatoExpl? answ = null;
if (ListMSE != null && ListMSE.Count > mseIdx)
{
answ = ListMSE[mseIdx];
}
return answ;
}
protected override async Task OnInitializedAsync()
{
@@ -179,10 +209,11 @@ namespace MP.Mon.Pages
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private static System.Timers.Timer slowTimer = new System.Timers.Timer(300000);
private string CodGruppo = "";
private List<ConfigModel>? CurrConfig = null;
private bool doBlink = false;
private List<MappaStatoExpl>? listMSE = null;
private List<Macchine> listMacchine = new List<Macchine>();
private List<MappaStatoExpl>? ListMSE = null;
private Random rnd = new Random();
#endregion Private Fields
@@ -247,18 +278,18 @@ namespace MP.Mon.Pages
}
}
dataList = listaFilt;
}
}
#if DEBUG
// hack: legge 3 volte i dati x stressare sistema
var singleData = dataList;
listMSE = new List<MappaStatoExpl>();
ListMSE = new List<MappaStatoExpl>();
for (int i = 0; i < 3; i++)
{
listMSE.AddRange(singleData);
ListMSE.AddRange(singleData);
}
#else
listMSE = dataList;
ListMSE = dataList;
#endif
}
}
@@ -267,11 +298,6 @@ namespace MP.Mon.Pages
}
InvokeAsync(() =>
{
#if false
// attesa random 0-50ms...
Random rnd = new Random();
Task.Delay(rnd.Next(5, 50));
#endif
StateHasChanged();
});
}
@@ -289,7 +315,6 @@ namespace MP.Mon.Pages
if (CurrConfig != null && CurrConfig.Count > 0)
{
// sistemo i parametri opzionali...
getConfValInt("keepAliveMin", ref keepAliveMin);
getConfValInt("MON_maxCol", ref maxCol);
int intDoAnim = 0;
@@ -308,9 +333,6 @@ namespace MP.Mon.Pages
}
}
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MON MAPO</i>
<h4>Versione: 6.16.2411.1209</h4>
<h4>Versione: 6.16.2503.1118</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2411.1209
6.16.2503.1118
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2411.1209</version>
<version>6.16.2503.1118</version>
<url>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+38 -5
View File
@@ -148,14 +148,11 @@ a,
.fontSmaller {
font-size: 0.6em;
}
.statusMap {
/*background: rgba(0,0,0,0.3);*/
}
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-weight: 400;
/*font-weight: 200;*/
text-transform: uppercase;
font-size: 2.5em;
font-size: 1.5em;
line-height: 1.1em;
color: #DEDEDE;
text-shadow: 2px 2px 4px #000;
@@ -176,6 +173,42 @@ a,
.machBlock {
padding: 0 2px 0 2px;
}
@media all and (min-width: 320px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 1.6em;
}
}
@media all and (min-width: 800px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 1.7em;
}
}
@media all and (min-width: 1024px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 1.8em;
}
}
@media all and (min-width: 1440px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 1.9em;
}
}
@media all and (min-width: 1980px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 2em;
}
}
@media all and (min-width: 3960px) {
.statusMap .ui-title,
.statusMap .ui-li-aside {
font-size: 2.1em;
}
}
/* END: gestione layout dinamico mappa... */
/* area semafori*/
.semBlinkVe,
+42 -9
View File
@@ -153,14 +153,10 @@ a, .btn-link {
font-size: 0.6em;
}
.statusMap {
/*background: rgba(0,0,0,0.3);*/
}
.statusMap .ui-title, .statusMap .ui-li-aside {
font-weight: 400;
/*font-weight: 200;*/
text-transform: uppercase;
font-size: 2.5em;
font-size: 1.5em;
line-height: 1.1em;
color: #DEDEDE;
text-shadow: 2px 2px 4px #000;
@@ -168,7 +164,7 @@ a, .btn-link {
background: linear-gradient(270deg, rgba(20,20,20,0.7), rgba(100,100,100,0.7), rgba(20,20,20,0.7));
}
.statusMap .ui-subtitle{
.statusMap .ui-subtitle {
line-height: 1.1em;
color: #DEDEDE;
text-shadow: 2px 2px 4px #000;
@@ -187,6 +183,44 @@ a, .btn-link {
.machBlock {
padding: 0 2px 0 2px;
}
@media all and (min-width: 320px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 1.6em;
}
}
@media all and (min-width: 800px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 1.7em;
}
}
@media all and (min-width: 1024px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 1.8em;
}
}
@media all and (min-width: 1440px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 1.9em;
}
}
@media all and (min-width: 1980px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 2.0em;
}
}
@media all and (min-width: 3960px) {
.statusMap .ui-title, .statusMap .ui-li-aside {
font-size: 2.1em;
}
}
/* END: gestione layout dinamico mappa... */
/* area semafori*/
.semBlinkVe,
@@ -345,7 +379,6 @@ a, .btn-link {
color: Yellow;
}
/* Gestione size caratteri */
.mainHead,
.logoImg {
@@ -426,4 +459,4 @@ a, .btn-link {
body {
font-size: 0.7em;
}
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -386,10 +386,10 @@ namespace MP.Stats.Components
private string CssBtn(PeriodoSel reqMode)
{
string answ = "btn-outline-dark";
string answ = "btn-outline-primary";
if (reqMode == pSel)
{
answ = "btn-dark text-light";
answ = "btn-primary text-light";
}
return answ;
}
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2503.1019</Version>
<Version>6.16.2503.1019</Version>
<Version>6.16.2503.1116</Version>
<Version>6.16.2503.1116</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2503.1019</h4>
<h4>Versione: 6.16.2503.1116</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2503.1019
6.16.2503.1116
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2503.1019</version>
<version>6.16.2503.1116</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>