diff --git a/MP-TAB3/Components/MachineBlock.razor b/MP-TAB3/Components/MachineBlock.razor index e9114edf..637062ba 100644 --- a/MP-TAB3/Components/MachineBlock.razor +++ b/MP-TAB3/Components/MachineBlock.razor @@ -45,9 +45,14 @@ else
-
-
- @RecMSE.DescrizioneStato:   @(FormatDurata(RecMSE.Durata)) +
+
+
+ @RecMSE.DescrizioneStato +
+
+ @(FormatDurata(RecMSE.Durata)) +
@@ -309,7 +314,7 @@ else } } -@if (showDraw && RecMSE != null) +@if (enableDisegno && showDraw && RecMSE != null) { string docUrl = string.IsNullOrEmpty(RecMSE.Disegno) ? $"disegni/{RecMSE.CodArticolo}.pdf" : $"disegni/{RecMSE.Disegno}.pdf"; diff --git a/MP-TAB3/Components/MachineBlock.razor.cs b/MP-TAB3/Components/MachineBlock.razor.cs index 8f81ae30..85db393c 100644 --- a/MP-TAB3/Components/MachineBlock.razor.cs +++ b/MP-TAB3/Components/MachineBlock.razor.cs @@ -81,21 +81,23 @@ namespace MP_TAB3.Components #endregion Public Methods - /// - /// CSS Class x overlay (effetto spento x macchina spenta/ sGr) - /// - protected string overlayCss - { - get - { - string answ = ""; - if (RecMSE != null) - { - answ = RecMSE.Semaforo == "sGr" ? "bg-dark opacity-50" : ""; - } - return answ; - } - } + #region Protected Fields + + protected string baseCss = "sem"; + + protected int currMaxVal = 1000; + + protected List innerCircleVals = new List(); + + protected int kaFactor = 60 / 2; + + protected int maxVal = 1000; + + protected List outerCircleVals = new List(); + + #endregion Protected Fields + + #region Protected Properties /// /// CSS Class bordo da stato macchina @@ -117,7 +119,6 @@ namespace MP_TAB3.Components answ += " border-danger"; break; - case "sGr": answ += " border-dark"; break; @@ -139,35 +140,6 @@ namespace MP_TAB3.Components } } - /// - /// CSS class x testo (se descr lunga scorre...) - /// - protected string textDescrCss - { - get - { - string answ = "text-nowrap"; - if (RecMSE != null && RecMSE.DescrizioneStato.Length > 18) - { - answ = " scroll-left"; - } - return answ; - } - } - - #region Protected Fields - - protected string baseCss = "sem"; - protected int currMaxVal = 1000; - protected List innerCircleVals = new List(); - protected int kaFactor = 60 / 2; - protected int maxVal = 1000; - protected List outerCircleVals = new List(); - - #endregion Protected Fields - - #region Protected Properties - [Inject] protected IConfiguration config { get; set; } = null!; @@ -203,12 +175,44 @@ namespace MP_TAB3.Components [Inject] protected NavigationManager NavMan { get; set; } = null!; + /// + /// CSS Class x overlay (effetto spento x macchina spenta/ sGr) + /// + protected string overlayCss + { + get + { + string answ = ""; + if (RecMSE != null) + { + answ = RecMSE.Semaforo == "sGr" ? "bg-dark opacity-50" : ""; + } + return answ; + } + } + [Inject] protected StatusData SDService { get; set; } = null!; [Inject] protected TabDataService TabDServ { get; set; } = null!; + /// + /// CSS class x testo (se descr lunga scorre...) + /// + protected string textDescrCss + { + get + { + string answ = "text-nowrap"; + if (RecMSE != null && RecMSE.DescrizioneStato.Length >= 20) + { + answ = " scroll-left"; + } + return answ; + } + } + #endregion Protected Properties #region Protected Methods @@ -229,6 +233,8 @@ namespace MP_TAB3.Components protected override async Task OnInitializedAsync() { isLoading = true; + // abilitazione disegni... + TabDServ.ConfigGetVal("enableDisegno", ref enableDisegno); // se configurata uso cartella virtuale... altrimenti cartella processo var sImgBasePath = config.GetValue("OptConf:ImgBasePath"); if (!string.IsNullOrEmpty(sImgBasePath)) @@ -318,6 +324,7 @@ namespace MP_TAB3.Components #region Private Fields private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private bool enableDisegno = false; private string imgBasePath = ""; private bool isLoading = false; diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 8a818395..c5a55a16 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2402.2614 + 6.16.2402.2615 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index b6ea39d5..dd5774a8 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2402.2614

+

Versione: 6.16.2402.2615


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index 1fdc36b2..5d451f5d 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2402.2614 +6.16.2402.2615 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 88efb02a..59d248ce 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2402.2614 + 6.16.2402.2615 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP.Data/Constants.cs b/MP.Data/Constants.cs index 6f31223c..4737e915 100644 --- a/MP.Data/Constants.cs +++ b/MP.Data/Constants.cs @@ -4,9 +4,11 @@ { #region Public Fields - public static readonly string ACT_BLINK_KEY = $"{BASE_HASH}:Current:Blink"; + public static readonly string MON_ACT_BLINK_KEY = $"{BASE_HASH}:MON:Current:Blink"; + public static readonly string MON_ACT_MSE_DATA_KEY = $"{BASE_HASH}:MON:Current:MSE"; - public static readonly string ACT_MSE_DATA_KEY = $"{BASE_HASH}:Current:MSE"; + public static readonly string TAB_ACT_BLINK_KEY = $"{BASE_HASH}:TAB:Current:Blink"; + public static readonly string TAB_ACT_MSE_DATA_KEY = $"{BASE_HASH}:TAB:Current:MSE"; public static readonly string BROADCAST_M_PIPE = $"BroadCastMsg"; public static readonly string BROADCAST_CURR_KEY = $"{BASE_HASH}:Current:BroadCast"; diff --git a/MP.Data/Services/MonDataFeeder.cs b/MP.Data/Services/MonDataFeeder.cs index 3299cb87..aefec545 100644 --- a/MP.Data/Services/MonDataFeeder.cs +++ b/MP.Data/Services/MonDataFeeder.cs @@ -15,8 +15,8 @@ namespace MP.Data.Services { // setup canali pub/sub - dataPipe = new MessagePipe(redisConn, Constants.ACT_MSE_DATA_KEY); - blinkPipe = new MessagePipe(redisConn, Constants.ACT_BLINK_KEY); + dataPipe = new MessagePipe(redisConn, Constants.MON_ACT_MSE_DATA_KEY); + blinkPipe = new MessagePipe(redisConn, Constants.MON_ACT_BLINK_KEY); // avvio timers... startTimers(); @@ -40,13 +40,15 @@ namespace MP.Data.Services stopTimers(); } +#if false /// /// Richiesta attivazione --> sposto avanti 1 minuto il periodo limite x fast running /// public void doActivate() { fastLimit = DateTime.Now.AddMinutes(1); - } + } +#endif /// /// Impostazione forzata timer refresh @@ -85,11 +87,13 @@ namespace MP.Data.Services private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); +#if false /// /// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min /// ad ogni chiamata client) /// - private DateTime fastLimit = DateTime.Now; + private DateTime fastLimit = DateTime.Now; +#endif private int fastRefreshMs = 1000; diff --git a/MP.Data/Services/TabDataFeeder.cs b/MP.Data/Services/TabDataFeeder.cs new file mode 100644 index 00000000..e8e26806 --- /dev/null +++ b/MP.Data/Services/TabDataFeeder.cs @@ -0,0 +1,135 @@ +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using NLog; +using StackExchange.Redis; +using System; +using System.Threading.Tasks; + +namespace MP.Data.Services +{ + public class TabDataFeeder : StatusData, IDisposable + { + #region Public Constructors + + public TabDataFeeder(IConfiguration configuration) : base(configuration) + { + + // setup canali pub/sub + dataPipe = new MessagePipe(redisConn, Constants.TAB_ACT_MSE_DATA_KEY); + blinkPipe = new MessagePipe(redisConn, Constants.TAB_ACT_BLINK_KEY); + + // avvio timers... + startTimers(); + } + + #endregion Public Constructors + + #region Public Properties + + public MessagePipe blinkPipe { get; set; } = null!; + + public MessagePipe dataPipe { get; set; } = null!; + + #endregion Public Properties + + #region Public Methods + + public new void Dispose() + { + base.Dispose(); + stopTimers(); + } + +#if false + /// + /// Richiesta attivazione --> sposto avanti 1 minuto il periodo limite x fast running + /// + public void doActivate() + { + fastLimit = DateTime.Now.AddMinutes(1); + } +#endif + + /// + /// Impostazione forzata timer refresh + /// + /// + public void setTimers(int FastTimerMs) + { + stopTimers(); + fastRefreshMs = FastTimerMs; + // avvio timers... + startTimers(); + } + + public void startTimers() + { + fastTimer = new System.Timers.Timer(fastRefreshMs); + fastTimer.Elapsed += ElapsedFastTimer; + fastTimer.Enabled = true; + fastTimer.Start(); + } + + public void stopTimers() + { + // stop timers + fastTimer.Elapsed -= ElapsedFastTimer; + fastTimer.Enabled = false; + fastTimer.Stop(); + fastTimer.Dispose(); + } + + #endregion Public Methods + + #region Private Fields + + private static System.Timers.Timer fastTimer = new System.Timers.Timer(4000); + + private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + +#if false + /// + /// Limite in formato data-ora per inviare dati rapidamente (incrementato come now + 1 min + /// ad ogni chiamata client) + /// + private DateTime fastLimit = DateTime.Now; +#endif + + private int fastRefreshMs = 1000; + + + #endregion Private Fields + + #region Private Methods + + private void ElapsedFastTimer(object? source, System.Timers.ElapsedEventArgs e) + { + var pUpd = Task.Run(async () => + { + // secondi pari --> blink, secondi dispari --> ricarica + DateTime adesso = DateTime.Now; + int resto = 0; + Math.DivRem(adesso.Second, 2, out resto); + if (resto == 0) + { + // invio in channel blink il segnale + blinkPipe.sendMessage("true"); + Log.Debug("Elapsed Fast Timer Blink"); + } + else + { + // invio in channel blink segnale false + blinkPipe.sendMessage("false"); + // rileggo dati... + var newData = await MseGetAll(); + // invio tramite la pipe... + dataPipe.sendMessage(JsonConvert.SerializeObject(newData)); + Log.Debug("Elapsed Fast Timer reload"); + } + }); + pUpd.Wait(); + } + + #endregion Private Methods + } +} \ No newline at end of file