From 5dd304157f5c397e026154fb135d2ee85cc33653 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 12 Mar 2025 08:44:34 +0100 Subject: [PATCH] update MON + update stats in prod --- MP.Mon/Components/DetailViewMSE.razor | 83 ++++++++++++ MP.Mon/Components/DetailViewMSE.razor.cs | 156 +++++++++++++++++++++++ MP.Mon/MP.Mon.csproj | 2 +- MP.Mon/Pages/Index.razor | 4 + MP.Mon/Resources/ChangeLog.html | 2 +- MP.Mon/Resources/VersNum.txt | 2 +- MP.Mon/Resources/manifest.xml | 2 +- 7 files changed, 247 insertions(+), 4 deletions(-) create mode 100644 MP.Mon/Components/DetailViewMSE.razor create mode 100644 MP.Mon/Components/DetailViewMSE.razor.cs diff --git a/MP.Mon/Components/DetailViewMSE.razor b/MP.Mon/Components/DetailViewMSE.razor new file mode 100644 index 00000000..b14216e3 --- /dev/null +++ b/MP.Mon/Components/DetailViewMSE.razor @@ -0,0 +1,83 @@ +@if (CurrRecord == null || !dataLoaded) +{ + +} +else +{ +
+
+
@CurrRecord.Nome
+
+
+
+ ART: +
+
+ @if (showArt == "CodArticolo") + { + @CurrRecord.CodArticolo + } + else + { + if (string.IsNullOrEmpty(CurrRecord.Disegno)) + { + [@CurrRecord.CodArticolo] + } + else + { + @CurrRecord.Disegno + } + } +
+
+
+
+ PODL: +
+
+ @(CurrRecord.IdxPOdl > 0 ? $"{CurrRecord.IdxPOdl:00000000}" : "-") +
+
+
+
+ ODL: +
+
+ @(CurrRecord.IdxOdl > 0 ? $"{CurrRecord.IdxOdl:00000000}" : "-") +
+
+
+
+
+
@CurrRecord.DescrizioneStato
+
@getMinSec(getDecimal(@CurrRecord.Durata))
+
+
+
+ @CurrRecord.PezziProd / @CurrRecord.NumPezzi +
+
+
+ @*
+
+
+
+
+
*@ +
+ +
+} + diff --git a/MP.Mon/Components/DetailViewMSE.razor.cs b/MP.Mon/Components/DetailViewMSE.razor.cs new file mode 100644 index 00000000..b0988978 --- /dev/null +++ b/MP.Mon/Components/DetailViewMSE.razor.cs @@ -0,0 +1,156 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.Conf; +using MP.Data.DbModels; +using Org.BouncyCastle.Asn1; + +namespace MP.Mon.Components +{ + public partial class DetailViewMSE + { + #region Public Properties + + [Parameter] + public MappaStatoExpl? CurrRecord { get; set; } = null; + + [Parameter] + public List? currTagConf { get; set; } = null; + + [Parameter] + public Dictionary currTagVal { get; set; } = new Dictionary(); + + [Parameter] + public bool doAnimate { get; set; } = true; + + [Parameter] + public bool doBlink { get; set; } = false; + + [Parameter] + public int keepAliveMin { get; set; } = 5; + + [Parameter] + public string showArt { get; set; } = ""; + + #endregion Public Properties + + #region Protected Fields + + protected int kaFactor = 60 / 2; + + #endregion Protected Fields + + #region Protected Properties + + protected bool dataLoaded { get; set; } = true; + + #endregion Protected Properties + + #region Private Methods + + private decimal getDecimal(object? rawData) + { + decimal answ = 0; + if (rawData != null) + { + decimal.TryParse($"{rawData}", out answ); + } + return answ; + } + + private string cssStatus(string codSemaforo) + { + string answ = ""; + // se vuoto --> mostra nero! + if (string.IsNullOrEmpty(codSemaforo)) + { + codSemaforo = "sNe"; + } + string codColore = codSemaforo.Substring(1, 2); + switch (codSemaforo) + { + case "sVe": + answ = "bg-success"; + doAnimate = false; + break; + case "sGi": + answ = "bg-warning"; + break; + case "sGr": + answ = "bg-dark opacity-75"; + doAnimate = false; + break; + case "sRo": + answ = "bg-danger"; + break; + case "sBl": + answ = "bg-primary"; + break; + case "sNe": + answ = "bg-dark"; + break; + default: + break; + } + if (doAnimate) + { + if (doBlink) + { + answ += " opacity-75"; + } + } + return answ; + } + private string cssComStatus(string semaforo, DateTime? lastUpdateN) + { + DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1); + string answ = cssStatus(semaforo); + if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor)) + { + answ = $"bg-danger"; + // blink se secondo pari... + DateTime adesso = DateTime.Now; + int resto = 0; + Math.DivRem(adesso.Second, 2, out resto); + if (resto == 0) + { + answ += " opacity-75"; + } + } + return answ; + } + + private string getMinSec(decimal? currTimeMin) + { + string answ = "nd"; + TimeSpan tSpan = new TimeSpan(0); + try + { + double cTimeMin = currTimeMin != null ? (double)currTimeMin : 0; + tSpan = TimeSpan.FromMinutes(cTimeMin); + if (tSpan.TotalHours < 1) + { + answ = $"{tSpan:mm}:{tSpan:ss}"; + } + else + { + answ = $"{tSpan.TotalHours:N0}h {tSpan:mm}:{tSpan:ss}"; + } + } + catch + { } + return answ; + } + + private bool showComErr(DateTime? lastUpdateN) + { + DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1); + bool answ = false; + if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor)) + { + answ = true; + } + return answ; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.Mon/MP.Mon.csproj b/MP.Mon/MP.Mon.csproj index e7137af1..bec92edd 100644 --- a/MP.Mon/MP.Mon.csproj +++ b/MP.Mon/MP.Mon.csproj @@ -4,7 +4,7 @@ net6.0 enable enable - 6.16.2503.1118 + 6.16.2503.1207 diff --git a/MP.Mon/Pages/Index.razor b/MP.Mon/Pages/Index.razor index e71c77c6..d11cc08d 100644 --- a/MP.Mon/Pages/Index.razor +++ b/MP.Mon/Pages/Index.razor @@ -38,6 +38,10 @@ else
+ + @*
+ +
*@ } else { diff --git a/MP.Mon/Resources/ChangeLog.html b/MP.Mon/Resources/ChangeLog.html index a82ee8ed..95a313a2 100644 --- a/MP.Mon/Resources/ChangeLog.html +++ b/MP.Mon/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MON MAPO -

Versione: 6.16.2503.1118

+

Versione: 6.16.2503.1207


Note di rilascio:
  • diff --git a/MP.Mon/Resources/VersNum.txt b/MP.Mon/Resources/VersNum.txt index a198130d..4caf3356 100644 --- a/MP.Mon/Resources/VersNum.txt +++ b/MP.Mon/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2503.1118 +6.16.2503.1207 diff --git a/MP.Mon/Resources/manifest.xml b/MP.Mon/Resources/manifest.xml index d410b3d0..e8691b20 100644 --- a/MP.Mon/Resources/manifest.xml +++ b/MP.Mon/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2503.1118 + 6.16.2503.1207 https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/MP.Mon.zip https://nexus.steamware.net/repository/SWS/MP-MON/stable/LAST/ChangeLog.html false