diff --git a/MP-TAB3/Components/InsManual.razor b/MP-TAB3/Components/InsManual.razor index de512dd0..54aaad6b 100644 --- a/MP-TAB3/Components/InsManual.razor +++ b/MP-TAB3/Components/InsManual.razor @@ -1,5 +1,5 @@ 
-
+
@if (showDetail) @@ -8,13 +8,13 @@ { if (SeqStatus != null && SeqStatus.Count() > 0) { -
+
-
OEE: @($"{DayOee:P0}")
-
@($"{DayMinLav:N1}") min
+
Prod: @($"{DayMinLav:N1}") min (@($"{DayOee:P0}"))
+
Caricati: @($"{DayMinTot:N0}")
-
+
@foreach (var item in SeqStatus) { @@ -29,7 +29,7 @@ } else { -
+
@@ -71,19 +71,20 @@
} -
+
+ - - - - + + + + @@ -93,24 +94,31 @@ + - - - + + + }
Macc Comm.Stato Art. OraPezzi #T.CicloMinutiPezzi #T.CicloMinuti
@item.IdxMacchina @item.KeyRichiesta@item.IdxTipoEv @item.CodArticolo {item.FineStato:yyyy.MM.dd HH:mm:ss}")">@($"{item.InizioStato:HH:mm}")@item.PzBuoni@($"{item.TCiclo:f3}")@($"{item.MinProd:f2}")@item.PzBuoni@($"{item.TCiclo:f2}")@($"{item.MinProd:f2}")
-
+ @*
+
*@ +
+ @if (DayMinTot < 1440) + { + + }
- +
}
diff --git a/MP-TAB3/Components/InsManual.razor.cs b/MP-TAB3/Components/InsManual.razor.cs index 38556ddb..6554b2c8 100644 --- a/MP-TAB3/Components/InsManual.razor.cs +++ b/MP-TAB3/Components/InsManual.razor.cs @@ -76,9 +76,27 @@ namespace MP_TAB3.Components } } + protected async Task FixMissing() + { + + if (!await JSRuntime.InvokeAsync("confirm", $"Sicuro di voler riempire i periodi mancanti?")) + return; + + // filtra dati odierni x tab editabile... + if (ListPeriod != null && ListPeriod.Count > 0) + { + // chiamo insert con eventi spenta (12) HardCoded... + int numAdd = await TabDServ.InsManFillMissing(ListDay, 12); + // rileggo i dati... + ReloadData(); + RecalcDayData(dtCurr); + } + //// chiudo! + //showDetail = false; + } + protected override async Task OnParametersSetAsync() { - //return base.OnParametersSetAsync(); ReloadData(); await Task.Delay(1); } @@ -141,11 +159,13 @@ namespace MP_TAB3.Components // calcolo eventi giorno ListDay = ListPeriod .Where(x => x.InizioStato.Date == dtSel) - .OrderBy(x => x.IdxInsMan) + .OrderBy(x => x.InizioStato) + .ThenBy(x => x.IdxInsMan) + //.OrderBy(x => x.IdxInsMan) .ToList(); // ora calcolo il sequencer x mostrare dettaglio orario... - SeqStatus = TabDServ.SeqDayStatus(ListDay); + SeqStatus = TabDServ.InsManSeqDayStatus(ListDay); // calcolo min lavorati odierni DayMinLav = 0; @@ -155,14 +175,21 @@ namespace MP_TAB3.Components DayMinLav = recLav.Value; DayOee = recLav.ValuePerc; } + // minuti totali come record day... + DayMinTot = (double)ListDay.Sum(x => x.MinProd); } } /// - /// Minuti lavorfati (da sequencer) + /// Minuti lavorati (da sequencer) /// private double DayMinLav = 0; + /// + /// Minuti caricati (da sequencer) + /// + private double DayMinTot = 0; + /// /// OEE giornaliero (ore lav / 24h) /// diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 496aa2ae..e0140140 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2504.207 + 6.16.2504.212 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index d07a4862..31831d7f 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2504.207

+

Versione: 6.16.2504.212


Note di rilascio:
  • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index d90fae9f..29e490ea 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2504.207 +6.16.2504.212 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 6be7f533..f4d26699 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2504.207 + 6.16.2504.212 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/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index acac2910..333c5c7f 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -850,7 +850,7 @@ namespace MP.Data.Services public async Task FlushCache() { RedisValue pattern = new RedisValue($"{redisBaseKey}:*"); - bool answ = await ExecFlushRedisPattern(pattern); + bool answ = await ExecFlushRedisPatternAsync(pattern); return answ; } @@ -861,7 +861,7 @@ namespace MP.Data.Services public async Task FlushCache(string KeyReq) { RedisValue pattern = new RedisValue($"{redisBaseKey}:{KeyReq}:*"); - bool answ = await ExecFlushRedisPattern(pattern); + bool answ = await ExecFlushRedisPatternAsync(pattern); return answ; } @@ -921,11 +921,15 @@ namespace MP.Data.Services /// /// Elenco DTO x plotting seq stati giornaliero /// - /// Dettagli + /// Record dettaglio giornata /// - public List SeqDayStatus(List listDetail) + public List InsManSeqDayStatus(List listDetail) { List? result = new List(); + // per sicurezza RIORDINO! + listDetail = listDetail + .OrderBy(x => x.InizioStato) + .ToList(); if (listDetail.Count > 0) { DateTime periodStart = listDetail.FirstOrDefault().InizioStato; @@ -1009,6 +1013,75 @@ namespace MP.Data.Services return result; } + /// + /// Riempie eventuali buchi con evento indicato + /// + /// Record dettaglio giornata + /// IdxTipo da riempire + /// + public async Task InsManFillMissing(List listDetail, int idxTipoEv) + { + List rec2add = new List(); + InsManualiModel newRec = new InsManualiModel(); + if (listDetail.Count > 0) + { + // punto come record attuale il primo + InsManualiModel currRec = listDetail.FirstOrDefault(); + + string idxMacc = currRec.IdxMacchina; + DateTime periodStart = currRec.InizioStato; + DateTime periodEnd = currRec.FineStato.Value; + + // se NON parte da mezzanotte metto un "pad iniziale"... + if (periodStart.TimeOfDay > new TimeSpan(0)) + { + // creo record x la durata necessaria + newRec = new InsManualiModel() + { + CodArticolo = "ND", + KeyRichiesta = "", + IdxMacchina = idxMacc, + InizioStato = periodStart.Date, + FineStato = periodStart, + IdxTipoEv = idxTipoEv, + MatrOpr = 0, + PzBuoni = 0, + TCiclo = 0, + MinProd = (decimal)periodStart.TimeOfDay.TotalMinutes + }; + rec2add.Add(newRec); + } + + // cerco ultimo record... + currRec = listDetail.LastOrDefault(); + periodStart = currRec.InizioStato; + periodEnd = currRec.FineStato.Value; + // se non arrivo a mezzanotte aggiungo "pad finale" + var lastPeriod = TimeSpan.FromHours(24).Subtract(periodEnd.TimeOfDay).TotalMinutes; + if (lastPeriod > 1) + { + // creo record x la durata necessaria + newRec = new InsManualiModel() + { + CodArticolo = "ND", + KeyRichiesta = "", + IdxMacchina = idxMacc, + InizioStato = periodEnd, + FineStato = periodEnd.Date.AddDays(1).AddSeconds(-1), + IdxTipoEv = idxTipoEv, + MatrOpr = 0, + PzBuoni = 0, + TCiclo = 0, + MinProd = (decimal)lastPeriod + }; + rec2add.Add(newRec); + } + // eseguo upsert massivo + await InsManUpsert(rec2add); + } + return rec2add.Count; + } + /// /// Elenco insManuali macchina /// @@ -1056,8 +1129,8 @@ namespace MP.Data.Services // salvo fatto = dbTabController.InsManUpsert(currRecord); // svuoto cache - RedisValue pattern = $"{redisBaseKey}:InsMan"; - await ExecFlushRedisPattern(pattern); + RedisValue pattern = $"{redisBaseKey}:InsMan:*"; + await ExecFlushRedisPatternAsync(pattern); return fatto; } /// @@ -1070,8 +1143,8 @@ namespace MP.Data.Services // salvo fatto = dbTabController.InsManUpsert(listRecord); // svuoto cache - RedisValue pattern = $"{redisBaseKey}:InsMan"; - await ExecFlushRedisPattern(pattern); + RedisValue pattern = $"{redisBaseKey}:InsMan:*"; + await ExecFlushRedisPatternAsync(pattern); return fatto; } @@ -1996,7 +2069,7 @@ namespace MP.Data.Services RedisValue rawData = await redisDb.StringGetAsync(currKey); if (rawData.HasValue) { - var done = await ExecFlushRedisPattern(currKey); + var done = await ExecFlushRedisPatternAsync(currKey); if (done) { answ = true; @@ -2830,7 +2903,7 @@ namespace MP.Data.Services { pattern = new RedisValue($"{MpIoNS}:{baseMem}:*"); } - bool answ = await ExecFlushRedisPattern(pattern); + bool answ = await ExecFlushRedisPatternAsync(pattern); return answ; } @@ -3721,11 +3794,11 @@ namespace MP.Data.Services #region Private Methods /// - /// Esegue flush memoria redis dato pattern + /// Esegue flush memoria redis dato pattern in async /// /// /// - private async Task ExecFlushRedisPattern(RedisValue pattern) + private async Task ExecFlushRedisPatternAsync(RedisValue pattern) { bool answ = false; var listEndpoints = redisConn.GetEndPoints(); @@ -3748,6 +3821,34 @@ namespace MP.Data.Services return answ; } + /// + /// Esegue flush memoria redis dato pattern, metodo sincrono + /// + /// + /// + private 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) + { + redisDb.KeyDelete(item); + } + answ = true; + } + } + // notifico update ai client in ascolto x reset cache + NotifyReloadRequest($"FlushRedisCache | {pattern}"); + return answ; + } + /// /// Hash dati EXE TASK x la macchina specificata ///