From d4526ffdb5105f18816eb0bbda09563af9189baf Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 18 Mar 2025 19:29:40 +0100 Subject: [PATCH] MON: - convertita in PURAMENTE Server x evitare alla radice i problemi del server Jetco --- MP-MON.sln | 6 - MP.MON/Components/App.razor | 4 +- MP.MON/Components/Compo/CmpFooter.razor | 14 + MP.MON/Components/Compo/CmpFooter.razor.cs | 109 ++++++ MP.MON/Components/Compo/CmpHeader.razor | 20 ++ MP.MON/Components/Compo/CmpHeader.razor.cs | 44 +++ MP.MON/Components/Compo/DetailMSE.razor | 145 ++++++++ MP.MON/Components/Compo/DetailMSE.razor.cs | 322 ++++++++++++++++++ .../Components/Compo/DetailMapSelector.razor | 44 +++ MP.MON/Components/Compo/DetailViewMSE.razor | 154 +++++++++ .../Components/Compo/DetailViewMSE.razor.cs | 303 ++++++++++++++++ MP.MON/Components/Compo/LoadingData.razor | 10 + .../Components/Compo/LoadingDataSmall.razor | 6 + MP.MON/Components/Pages/Index.razor | 8 +- MP.MON/Components/Routes.razor | 2 +- MP.MON/Components/_Imports.razor | 3 +- MP.MON/MP.MON.csproj | 6 +- MP.MON/Program.cs | 13 +- MP.MON/Resources/ChangeLog.html | 2 +- MP.MON/Resources/VersNum.txt | 2 +- MP.MON/Resources/manifest.xml | 2 +- MP.MON/wwwroot/lib/WindowSize.js | 6 + 22 files changed, 1197 insertions(+), 28 deletions(-) create mode 100644 MP.MON/Components/Compo/CmpFooter.razor create mode 100644 MP.MON/Components/Compo/CmpFooter.razor.cs create mode 100644 MP.MON/Components/Compo/CmpHeader.razor create mode 100644 MP.MON/Components/Compo/CmpHeader.razor.cs create mode 100644 MP.MON/Components/Compo/DetailMSE.razor create mode 100644 MP.MON/Components/Compo/DetailMSE.razor.cs create mode 100644 MP.MON/Components/Compo/DetailMapSelector.razor create mode 100644 MP.MON/Components/Compo/DetailViewMSE.razor create mode 100644 MP.MON/Components/Compo/DetailViewMSE.razor.cs create mode 100644 MP.MON/Components/Compo/LoadingData.razor create mode 100644 MP.MON/Components/Compo/LoadingDataSmall.razor create mode 100644 MP.MON/wwwroot/lib/WindowSize.js diff --git a/MP-MON.sln b/MP-MON.sln index 0035cada..ba4b9224 100644 --- a/MP-MON.sln +++ b/MP-MON.sln @@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.MON", "MP.MON\MP.MON.csproj", "{82FD7CF4-42A2-499C-88FC-46502D166F70}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.MON.Client", "MP.MON.Client\MP.MON.Client.csproj", "{162B91FA-4BFD-4270-966A-C5E8B5DC1346}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.Core", "MP.Core\MP.Core.csproj", "{4F652F76-AC46-444D-B808-40102F2F05C0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.TaskMan", "MP.TaskMan\MP.TaskMan.csproj", "{3447D4AF-13C2-47BB-8C5F-74299A46D063}" @@ -27,10 +25,6 @@ Global {82FD7CF4-42A2-499C-88FC-46502D166F70}.Debug|Any CPU.Build.0 = Debug|Any CPU {82FD7CF4-42A2-499C-88FC-46502D166F70}.Release|Any CPU.ActiveCfg = Release|Any CPU {82FD7CF4-42A2-499C-88FC-46502D166F70}.Release|Any CPU.Build.0 = Release|Any CPU - {162B91FA-4BFD-4270-966A-C5E8B5DC1346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {162B91FA-4BFD-4270-966A-C5E8B5DC1346}.Debug|Any CPU.Build.0 = Debug|Any CPU - {162B91FA-4BFD-4270-966A-C5E8B5DC1346}.Release|Any CPU.ActiveCfg = Release|Any CPU - {162B91FA-4BFD-4270-966A-C5E8B5DC1346}.Release|Any CPU.Build.0 = Release|Any CPU {4F652F76-AC46-444D-B808-40102F2F05C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4F652F76-AC46-444D-B808-40102F2F05C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {4F652F76-AC46-444D-B808-40102F2F05C0}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/MP.MON/Components/App.razor b/MP.MON/Components/App.razor index 95b95d22..f22c8064 100644 --- a/MP.MON/Components/App.razor +++ b/MP.MON/Components/App.razor @@ -18,7 +18,7 @@ - + *@ diff --git a/MP.MON/Components/Compo/CmpFooter.razor b/MP.MON/Components/Compo/CmpFooter.razor new file mode 100644 index 00000000..0307f939 --- /dev/null +++ b/MP.MON/Components/Compo/CmpFooter.razor @@ -0,0 +1,14 @@ +
+
+ Mapo MON @(DateTime.Today.Year) | v.@version +
+
+ @if (Width > 0) + { + + } + @Width x @Height | + @(OperatingSystem.IsBrowser() ? "WASM" : "Server") + | Egalware +
+
\ No newline at end of file diff --git a/MP.MON/Components/Compo/CmpFooter.razor.cs b/MP.MON/Components/Compo/CmpFooter.razor.cs new file mode 100644 index 00000000..e457660f --- /dev/null +++ b/MP.MON/Components/Compo/CmpFooter.razor.cs @@ -0,0 +1,109 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using System; + +namespace MP.MON.Components.Compo +{ + public partial class CmpFooter : ComponentBase, IDisposable + { + #region Public Properties + + [Parameter] + public Version version { get; set; } = null!; + + #endregion Public Properties + + #region Public Methods + + public void Dispose() + { + aTimer.Stop(); + aTimer.Dispose(); + } + + public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + //Console.WriteLine($"{DateTime.Now} | Elapsed Timer Footer"); + await InvokeAsync(() => StateHasChanged()); + }); + pUpd.Wait(); + } + + public void StartTimer() + { + int tOutPeriod = 1000; + aTimer = new System.Timers.Timer(tOutPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + } + + #endregion Public Methods + + #region Public Classes + + public class WindowDimension + { + #region Public Properties + + public int Height { get; set; } + public int Width { get; set; } + + #endregion Public Properties + } + + #endregion Public Classes + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected async Task getWDim() + { + var dimension = await JSRuntime.InvokeAsync("getWindowDimensions"); + Height = dimension.Height; + Width = dimension.Width; + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await getWDim(); + StateHasChanged(); + Console.WriteLine($"Dimensioni schermo: {Width}x{Height}"); + } + //Console.WriteLine($"OnAfterRenderAsync completato"); + } + + protected override void OnInitialized() + { + StartTimer(); + Console.WriteLine($"OnInitialized Footer completato"); + } + + #endregion Protected Methods + + #region Private Fields + + private static System.Timers.Timer aTimer = null!; + + #endregion Private Fields + + #region Private Properties + + private int Height { get; set; } = 0; + + private int Width { get; set; } = 0; + + #endregion Private Properties + } +} \ No newline at end of file diff --git a/MP.MON/Components/Compo/CmpHeader.razor b/MP.MON/Components/Compo/CmpHeader.razor new file mode 100644 index 00000000..28357073 --- /dev/null +++ b/MP.MON/Components/Compo/CmpHeader.razor @@ -0,0 +1,20 @@ +
+ +   +
+
+ + Mapo MONitor + +
+
+ + @($"{DateTime.Now:yyyy.MM.dd}") + + + @($"{DateTime.Now:HH:mm:ss}") + + @* + EgalWare *@ +
+ diff --git a/MP.MON/Components/Compo/CmpHeader.razor.cs b/MP.MON/Components/Compo/CmpHeader.razor.cs new file mode 100644 index 00000000..160f6a32 --- /dev/null +++ b/MP.MON/Components/Compo/CmpHeader.razor.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Components; + +namespace MP.MON.Components.Compo +{ + public partial class CmpHeader: ComponentBase, IDisposable + { + + protected override void OnInitialized() + { + StartTimer(); + Console.WriteLine($"OnInitialized Header completato"); + } + + + public void Dispose() + { + aTimer.Stop(); + aTimer.Dispose(); + } + + private static System.Timers.Timer aTimer; + + public void StartTimer() + { + int tOutPeriod = 1000; + aTimer = new System.Timers.Timer(tOutPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + } + + public void ElapsedTimer(Object source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + //Console.WriteLine($"{DateTime.Now} | Elapsed Timer Footer"); + await InvokeAsync(() => StateHasChanged()); + }); + pUpd.Wait(); + } + + } +} \ No newline at end of file diff --git a/MP.MON/Components/Compo/DetailMSE.razor b/MP.MON/Components/Compo/DetailMSE.razor new file mode 100644 index 00000000..2a30e66f --- /dev/null +++ b/MP.MON/Components/Compo/DetailMSE.razor @@ -0,0 +1,145 @@ +
+ @if (CurrRecord == null || !dataLoaded) + { + + } + else + { +
+
+
+ @CurrRecord.Nome +
+
+ @if (hasRow(1)) + { +
+ @foreach (var item in rowValues(1)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
Art
+
+ @if (showArt == "CodArticolo") + { + @CurrRecord.CodArticolo + } + else + { + if (string.IsNullOrEmpty(CurrRecord.Disegno)) + { + [@CurrRecord.CodArticolo] + } + else + { + @CurrRecord.Disegno + } + } +
+
+ } + @if (hasRow(2)) + { +
+ @foreach (var item in rowValues(2)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
PODL
+
@(CurrRecord.IdxPOdl > 0 ? $"{CurrRecord.IdxPOdl:00000000}" : "-")
+
+
+
ODL
+
@(CurrRecord.IdxOdl > 0 ? $"{CurrRecord.IdxOdl:00000000}" : "-")
+
+ } + @if (hasRow(3)) + { +
+ @foreach (var item in rowValues(3)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
@CurrRecord.DescrizioneStato
+
@getMinSec(getDecimal(@CurrRecord.Durata))
+
+ } + @if (hasRow(4)) + { +
+ @foreach (var item in rowValues(4)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
TC. Act
+ @*
std @getMinSec(@CurrRecord.TCAssegnato)
*@ +
@getMinSec(@CurrRecord.TCLavRT) [@getMinSec(@CurrRecord.TCAssegnato)]
+
+ } + @if (hasRow(5)) + { +
+ @foreach (var item in rowValues(5)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
Pezzip/o
+
@CurrRecord.PezziProd / @CurrRecord.NumPezzi
+
+ } + @if (hasRow(6)) + { +
+ @foreach (var item in rowValues(6)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } +
+
+
+
+ +
+
+
+ } +
\ No newline at end of file diff --git a/MP.MON/Components/Compo/DetailMSE.razor.cs b/MP.MON/Components/Compo/DetailMSE.razor.cs new file mode 100644 index 00000000..aab7900c --- /dev/null +++ b/MP.MON/Components/Compo/DetailMSE.razor.cs @@ -0,0 +1,322 @@ +using Microsoft.AspNetCore.Components; +using MP.Core.Conf; +using MP.Core.DTO; + +namespace MP.MON.Components.Compo +{ + public partial class DetailMSE : ComponentBase + { + #region Public Properties + + [Parameter] + public string cssOverlayOff { get; set; } = ""; + + [Parameter] + public MappaStatoExplDTO? 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 int maxChar4Scroll { get; set; } = 20; + + [Parameter] + public string showArt { get; set; } = ""; + + #endregion Public Properties + + #region Public Methods + + public void Dispose() + { + aTimer.Elapsed -= ElapsedTimer; + aTimer.Stop(); + aTimer.Dispose(); + } + + public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + // verifica variazione x blink... + bool needUpdate = false; + if (CurrRecord == null) + { + needUpdate = true; + } + else + { + if (OldRecord == null) + { + needUpdate = true; + } + else + { + if (!CurrRecord.Semaforo.Equals(OldRecord.Semaforo) || CurrRecord.Semaforo != "sVe") + { + needUpdate = true; + } + } + } + if (needUpdate) + { + await InvokeAsync(() => StateHasChanged()); + } + OldRecord = CurrRecord; + }); + pUpd.Wait(); + } + + public void StartTimer() + { + int tOutPeriod = 1000; + //int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod); + aTimer = new System.Timers.Timer(tOutPeriod); + aTimer.Elapsed += ElapsedTimer; + aTimer.Enabled = true; + aTimer.Start(); + } + + #endregion Public Methods + + #region Protected Fields + + protected string baseCss = "sem"; + + protected int kaFactor = 60 / 2; + + #endregion Protected Fields + + #region Protected Properties + + protected string codIOB + { + get + { + string answ = ""; + if (CurrRecord != null) + { + answ = CurrRecord.IdxMacchina; + } + return answ; + } + } + + protected bool dataLoaded { get; set; } = false; + + /// + /// CSS Class x overlay (effetto spento x macchina spenta/ sGr) + /// + protected string overlayCss + { + get + { + string answ = ""; + if (CurrRecord != null) + { + answ = CurrRecord.Semaforo == "sGr" ? cssOverlayOff : ""; + } + return answ; + } + } + + #endregion Protected Properties + + #region Protected Methods + + /// + /// restituisce il valore data la tagLocation + /// + /// + /// + protected string currVal(string tagLocation) + { + string answ = ""; + if (currTagVal.ContainsKey(tagLocation)) + { + answ = currTagVal[tagLocation]; + } + return answ; + } + + /// + /// Verifica se ci sia un override per la riga indicata + /// + /// + /// + protected bool hasRow(int numRow) + { + bool answ = false; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + var currVals = rowValues(numRow); + answ = currVals.Count > 0; + } + } + return answ; + } + + protected override async Task OnInitializedAsync() + { + //StartTimer(); + Random rnd = new Random(); + await Task.Delay(rnd.Next(5)); + setupConf(); + dataLoaded = true; + } + + /// + /// Restituisce (se presenti) valori di override per la riga indicata + /// + /// + /// + protected List rowValues(int numRow) + { + List? rowVals = null; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + //cerco solo la riga corrente... + rowVals = currTagConf.Where(x => x.RowNum == numRow).ToList(); + } + } + if (rowVals == null) + { + rowVals = new List(); + } + return rowVals; + } + + /// + /// CSS class x testo (se descr lunga scorre...) + /// + protected string textDescrCss(string currText, int maxChar) + { + string answ = "text-nowrap"; + if (currText.Length > maxChar) + { + answ = " scroll-left"; + } + return answ; + } + + #endregion Protected Methods + + #region Private Properties + + private static System.Timers.Timer aTimer { get; set; } = null!; + + /// + /// Valore precedente x calcolo variazione + /// + private MappaStatoExplDTO? OldRecord { get; set; } = null; + + #endregion Private Properties + + #region Private Methods + + 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 = $"{baseCss}Ro"; + // blink se secondo pari... + DateTime adesso = DateTime.Now; + int resto = 0; + Math.DivRem(adesso.Second, 2, out resto); + if (resto == 0) + { + answ += "_b"; + } + } + return answ; + } + + private string cssStatus(string codSemaforo) + { + // se vuoto --> mostra nero! + if (string.IsNullOrEmpty(codSemaforo)) + { + codSemaforo = "sNe"; + } + string codColore = codSemaforo.Substring(1, 2); + string answ = $"{baseCss}{codColore}"; + if (doAnimate && codColore != "Ve") + { + if (doBlink) + { + answ += "_b"; + } + } + return answ; + } + + private decimal getDecimal(object? rawData) + { + decimal answ = 0; + if (rawData != null) + { + decimal.TryParse($"{rawData}", out answ); + } + 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 void setupConf() + { + //baseCss = doAnimate ? "semBlink" : "sem"; + } + + 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/Components/Compo/DetailMapSelector.razor b/MP.MON/Components/Compo/DetailMapSelector.razor new file mode 100644 index 00000000..a6911977 --- /dev/null +++ b/MP.MON/Components/Compo/DetailMapSelector.razor @@ -0,0 +1,44 @@ +@using MP.Core.Conf +@using MP.Core.DTO; + +@if (useNewDisplay) +{ + +} +else +{ + +} + +@code { + + [Parameter] + public MappaStatoExplDTO? 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 int maxChar4Scroll { get; set; } = 20; + + [Parameter] + public string showArt { get; set; } = ""; + [Parameter] + public bool useNewDisplay { get; set; } = true; + + + [Parameter] + public string cssOverlayOff { get; set; } = ""; +} diff --git a/MP.MON/Components/Compo/DetailViewMSE.razor b/MP.MON/Components/Compo/DetailViewMSE.razor new file mode 100644 index 00000000..6ec1ca9c --- /dev/null +++ b/MP.MON/Components/Compo/DetailViewMSE.razor @@ -0,0 +1,154 @@ +@if (CurrRecord == null || !dataLoaded) +{ + +} +else +{ +
+
+
+
+ @CurrRecord.Nome +
+
+ @if (hasRow(1)) + { +
+ @foreach (var item in rowValues(1)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
+ ART: +
+
+ @if (showArt == "CodArticolo") + { + @CurrRecord.CodArticolo + } + else + { + if (string.IsNullOrEmpty(CurrRecord.Disegno)) + { + [@CurrRecord.CodArticolo] + } + else + { + @CurrRecord.Disegno + } + } +
+
+ } + @if (hasRow(2)) + { +
+ @foreach (var item in rowValues(2)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
+ PODL: +
+
+ @(CurrRecord.IdxPOdl > 0 ? $"{CurrRecord.IdxPOdl:000000}" : "-") +
+
+
+
+ ODL: +
+
+ @(CurrRecord.IdxOdl > 0 ? $"{CurrRecord.IdxOdl:000000}" : "-") +
+
+ } + @if (showTC) + { + @if (hasRow(3)) + { +
+ @foreach (var item in rowValues(4)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
TC. Act
+
@getMinSec(@CurrRecord.TCLavRT) [@getMinSec(@CurrRecord.TCAssegnato)]
+
+ } + } +
+
+
+ @if (hasRow(4)) + { +
+ @foreach (var item in rowValues(3)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
+ @CurrRecord.DescrizioneStato +
+
@getMinSec(getDecimal(@CurrRecord.Durata))
+
+ } + @if (hasRow(5)) + { +
+ @foreach (var item in rowValues(5)) + { +
@item.TagName: @currVal(item.TagLocation)
+ } +
+ } + else + { +
+
+ @CurrRecord.PezziProd / @CurrRecord.NumPezzi +
+
+ } +
+
+ +
+} + diff --git a/MP.MON/Components/Compo/DetailViewMSE.razor.cs b/MP.MON/Components/Compo/DetailViewMSE.razor.cs new file mode 100644 index 00000000..692da79e --- /dev/null +++ b/MP.MON/Components/Compo/DetailViewMSE.razor.cs @@ -0,0 +1,303 @@ +using Microsoft.AspNetCore.Components; +using MP.Core.DTO; +using MP.Core.Conf; + +namespace MP.MON.Components.Compo +{ + public partial class DetailViewMSE : ComponentBase + { + #region Public Properties + + [Parameter] + public MappaStatoExplDTO? 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 int maxChar4Scroll { get; set; } = 20; + + [Parameter] + public string showArt { get; set; } = ""; + + [Parameter] + public bool scrollText { get; set; } = false; + + [Parameter] + public string brightCss { get; set; } = ""; + + [Parameter] + public string titleMult { get; set; } = ""; + + [Parameter] + public bool showTC { get; set; } = false; + +#if false + protected override void OnParametersSet() + { + base.OnParametersSet(); + Console.WriteLine($"{DateTime.Now} | {CurrRecord.IdxMacchina} params received!"); + } +#endif + + #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 Protected Methods + + /// + /// restituisce il valore data la tagLocation + /// + /// + /// + protected string currVal(string tagLocation) + { + string answ = ""; + if (currTagVal.ContainsKey(tagLocation)) + { + answ = currTagVal[tagLocation]; + } + return answ; + } + + /// + /// Verifica se ci sia un override per la riga indicata + /// + /// + /// + protected bool hasRow(int numRow) + { + bool answ = false; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + var currVals = rowValues(numRow); + answ = currVals.Count > 0; + } + } + return answ; + } + + /// + /// Restituisce (se presenti) valori di override per la riga indicata + /// + /// + /// + protected List rowValues(int numRow) + { + List? rowVals = null; + if (currTagConf != null) + { + if (currTagConf.Count > 0) + { + //cerco solo la riga corrente... + rowVals = currTagConf.Where(x => x.RowNum == numRow).ToList(); + } + } + if (rowVals == null) + { + rowVals = new List(); + } + return rowVals; + } + + /// + /// CSS class x testo (se descr lunga scorre...) + /// + protected string textCss(string currText) + { + string answ = "text-truncate"; + if (currText.Length > maxChar4Scroll) + { + answ = scrollText ? "scroll-left" : "text-reduced"; + // calcolo delta... a-b-c con 5-10-oltre + int delta = currText.Length - maxChar4Scroll; + if (delta < 5) + { + answ += "-a"; + } + else if (delta < 10) + { + answ += "-b"; + } + else + { + answ += "-c"; + } + } + return answ; + } + + #endregion Protected Methods + + #region Private Methods + + private string cssComStatus(string semaforo, DateTime? lastUpdateN) + { + DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1); + string answ = "bg-dark opacity-75"; cssStatus(semaforo, false); + if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor)) + { + answ = $"bg-danger"; + // blink se secondo pari... +#if false + DateTime adesso = DateTime.Now; + int resto = 0; + Math.DivRem(adesso.Second, 2, out resto); + if (resto == 0) + { + answ += " opacity-100"; + } +#endif + } + return answ; + } + + private string cssStatus(string codSemaforo, bool animate) + { + 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"; + animate = false; + break; + + case "sGi": + answ = "bg-warning"; + break; + + case "sGr": + answ = "bg-dark opacity-50"; + animate = false; + break; + + case "sRo": + answ = "bg-danger"; + break; + + case "sBl": + answ = "bg-primary"; + break; + + case "sNe": + answ = "bg-dark"; + break; + + default: + break; + } + if (animate) + { + if (doBlink) + { + answ += " opacity-50"; + } + else + { + //answ += " bright100"; + textBlinkBright = brightCss; + } + } + return answ; + } + + /// + /// Valore brightness solo x elementi testuali durante lampeggio + /// + protected string textBlinkBright = "bright100"; + + private decimal getDecimal(object? rawData) + { + decimal answ = 0; + if (rawData != null) + { + decimal.TryParse($"{rawData}", out answ); + } + 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:00}:{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; + } + + private string textC101(DateTime? lastUpdateN) + { + DateTime lastUpdate = lastUpdateN.HasValue ? (DateTime)lastUpdateN : DateTime.Now.AddHours(-1); + string answ = "text-light"; + if (DateTime.Now.Subtract(lastUpdate).TotalSeconds > (keepAliveMin * kaFactor)) + { + // blink se secondo pari... + DateTime adesso = DateTime.Now; + int resto = 0; + Math.DivRem(adesso.Second, 2, out resto); + if (resto == 1) + { + answ = $"text-danger"; + } + } + return answ; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.MON/Components/Compo/LoadingData.razor b/MP.MON/Components/Compo/LoadingData.razor new file mode 100644 index 00000000..e0b7f563 --- /dev/null +++ b/MP.MON/Components/Compo/LoadingData.razor @@ -0,0 +1,10 @@ +
+
+

MAPO MON

+ EgalWare MES suite +
+
+

loading data | @(OperatingSystem.IsBrowser() ? "WASM" : "Server") mode

+ +
+
\ No newline at end of file diff --git a/MP.MON/Components/Compo/LoadingDataSmall.razor b/MP.MON/Components/Compo/LoadingDataSmall.razor new file mode 100644 index 00000000..196dafc7 --- /dev/null +++ b/MP.MON/Components/Compo/LoadingDataSmall.razor @@ -0,0 +1,6 @@ +
+
+ loading data + +
+
\ No newline at end of file diff --git a/MP.MON/Components/Pages/Index.razor b/MP.MON/Components/Pages/Index.razor index 6896740c..91144663 100644 --- a/MP.MON/Components/Pages/Index.razor +++ b/MP.MON/Components/Pages/Index.razor @@ -12,7 +12,7 @@ {
- +
} @@ -40,14 +40,14 @@ else if (currMse != null) {
- @* *@ + @* *@ @if (newDisplay) { - + } else { - + }
} diff --git a/MP.MON/Components/Routes.razor b/MP.MON/Components/Routes.razor index d39c7e89..f756e19d 100644 --- a/MP.MON/Components/Routes.razor +++ b/MP.MON/Components/Routes.razor @@ -1,4 +1,4 @@ - + diff --git a/MP.MON/Components/_Imports.razor b/MP.MON/Components/_Imports.razor index bc90b348..35eb0aae 100644 --- a/MP.MON/Components/_Imports.razor +++ b/MP.MON/Components/_Imports.razor @@ -16,7 +16,6 @@ @using MP.Data.DTO @using MP.Data.Services @using MP.MON -@using MP.MON.Client -@using MP.MON.Client.Components @using MP.MON.Components +@using MP.MON.Components.Compo @using MP.MON.Components.Pages diff --git a/MP.MON/MP.MON.csproj b/MP.MON/MP.MON.csproj index bff41ec5..8e59c128 100644 --- a/MP.MON/MP.MON.csproj +++ b/MP.MON/MP.MON.csproj @@ -6,7 +6,7 @@ enable MP.MON $(AssemblyName.Replace(' ', '_')) - 6.16.2503.1809 + 6.16.2503.1819 @@ -34,8 +34,10 @@ - + + + diff --git a/MP.MON/Program.cs b/MP.MON/Program.cs index 960ac3aa..863bf6f1 100644 --- a/MP.MON/Program.cs +++ b/MP.MON/Program.cs @@ -1,8 +1,5 @@ -using MP.MON.Client.Components; using MP.Data.Services; using MP.MON.Components; -using MP.MON.Components.Layout; -using MP.MON.Components.Pages; using NLog; using NLog.Web; using StackExchange.Redis; @@ -11,8 +8,8 @@ var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorComponents() - .AddInteractiveServerComponents() - .AddInteractiveWebAssemblyComponents(); + .AddInteractiveServerComponents(); + //.AddInteractiveWebAssemblyComponents(); var logger = LogManager.Setup() @@ -60,9 +57,9 @@ app.UseStaticFiles(); app.UseAntiforgery(); app.MapRazorComponents() - .AddInteractiveServerRenderMode() - .AddInteractiveWebAssemblyRenderMode() - .AddAdditionalAssemblies(typeof(MP.MON.Client._Imports).Assembly); + .AddInteractiveServerRenderMode(); + //.AddInteractiveWebAssemblyRenderMode() + //.AddAdditionalAssemblies(typeof(MP.MON.Client._Imports).Assembly); logger.Info("App: Run stage"); app.Run(); diff --git a/MP.MON/Resources/ChangeLog.html b/MP.MON/Resources/ChangeLog.html index 8497063c..55db6c79 100644 --- a/MP.MON/Resources/ChangeLog.html +++ b/MP.MON/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2503.1809

+

Versione: 6.16.2503.1819


Note di rilascio:
  • diff --git a/MP.MON/Resources/VersNum.txt b/MP.MON/Resources/VersNum.txt index a5e51214..20769eb4 100644 --- a/MP.MON/Resources/VersNum.txt +++ b/MP.MON/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2503.1809 +6.16.2503.1819 diff --git a/MP.MON/Resources/manifest.xml b/MP.MON/Resources/manifest.xml index 10243484..5aea81d3 100644 --- a/MP.MON/Resources/manifest.xml +++ b/MP.MON/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2503.1809 + 6.16.2503.1819 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 diff --git a/MP.MON/wwwroot/lib/WindowSize.js b/MP.MON/wwwroot/lib/WindowSize.js new file mode 100644 index 00000000..a8d2d770 --- /dev/null +++ b/MP.MON/wwwroot/lib/WindowSize.js @@ -0,0 +1,6 @@ +window.getWindowDimensions = function () { + return { + width: window.innerWidth, + height: window.innerHeight + }; +}; \ No newline at end of file