diff --git a/MP-TAB-SERV/Components/CheckControls.razor b/MP-TAB-SERV/Components/CheckControls.razor new file mode 100644 index 00000000..c839d79a --- /dev/null +++ b/MP-TAB-SERV/Components/CheckControls.razor @@ -0,0 +1,8 @@ +@if (ShowInsFermata) +{ + +} +@if (ShowReqControls) +{ + +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/CheckControls.razor.cs b/MP-TAB-SERV/Components/CheckControls.razor.cs new file mode 100644 index 00000000..cf2c1fda --- /dev/null +++ b/MP-TAB-SERV/Components/CheckControls.razor.cs @@ -0,0 +1,123 @@ +using Microsoft.AspNetCore.Components; +using MP.Data.DatabaseModels; +using MP.Data.Services; +using MP_TAB_SERV.Shared; + +namespace MP_TAB_SERV.Components +{ + public partial class CheckControls + { + #region Public Properties + + [Parameter] + public MappaStatoExpl? RecMSE { get; set; } = null; + + #endregion Public Properties + + #region Protected Properties + + [Inject] + protected NavigationManager NavMan { get; set; } = null!; + + /// + /// Determina se dato lo stato dell'impianto si debba mostrare btn fermata perché + /// - fermo > xx min (da web.config, es 20') + /// - impianto fermo (controllando idxStato: priorità > 1) + /// + protected bool ShowInsFermata + { + get + { + bool answ = false; + int idxStato = 0; + double durata = 0; + int durMinWarning = SMServ.GetConfInt("durMinWarning"); + if (RecMSE != null) + { + idxStato = RecMSE.IdxStato ?? 0; + durata = RecMSE.Durata ?? 0; + if (durata >= durMinWarning) + { + try + { + // in questo caso controllo idxStato... e recupero priorità se > 1 --> + // richiesta qualifica + answ = SMServ.GetStateRow(idxStato).Priorita > 1; + } + catch + { } + } + } + return answ; + } + } + + /// + /// Verifica necessità visualizzare il check controlli + /// + protected bool ShowReqControls + { + get + { + bool answ = false; + if (RecMSE != null) + { + // SE abilitata gestione controlli... + bool enableCtrl = SMServ.GetConfBool("enableControlli"); + if (enableCtrl) + { + int intervalloControlli = SMServ.GetConfInt("intervalloControlli"); + // cerco ultimo controllo fatto + DateTime lastControl = DateTime.Now.AddYears(-1); + try + { + var pUpd = Task.Run(async () => + { + await Task.Delay(1); + var tabCtrls = await TabDServ.RegControlliLast(RecMSE.IdxMacchina); + if (tabCtrls != null && tabCtrls.Count > 0) + { + var thisRec = tabCtrls.FirstOrDefault(); + if (thisRec != null) + { + lastControl = thisRec.DataOra; + if (Math.Abs(DateTime.Now.Subtract(lastControl).TotalMinutes) >= intervalloControlli) + { + answ = true; + } + } + } + }); + pUpd.Wait(); + } + catch + { } + } + } + return answ; + } + } + + [Inject] + protected SharedMemService SMServ { get; set; } = null!; + + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected void GoToControls() + { + NavMan.NavigateTo("controls"); + } + + protected void GoToFermate() + { + NavMan.NavigateTo("prod-stop"); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/CheckControls.razor.css b/MP-TAB-SERV/Components/CheckControls.razor.css new file mode 100644 index 00000000..a7a1bb2c --- /dev/null +++ b/MP-TAB-SERV/Components/CheckControls.razor.css @@ -0,0 +1,63 @@ +.flashingPurple { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsBlue; + transform: translateZ(0); +} +@keyframes flsBlue { + from { + color: #ffc107; + background-color: #7623c8; + /*border: 5px solid #dc3545;*/ + } + to { + color: #FFF; + background-color: #00b1ec; + /*border: 5px solid #ffc107;*/ + } +} +.flashingRed { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsRed; + transform: translateZ(0); +} +@keyframes flsRed { + from { + color: #ffc107; + background-color: #c82332; + /*border: 5px solid #dc3545;*/ + } + to { + color: #FFF; + background-color: #ecb100; + /*border: 5px solid #ffc107;*/ + } +} +.flashingBlue { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsBlue; + transform: translateZ(0); +} +@keyframes flsBlue { + from { + color: #ffc107; + background-color: #2323c8; + /*border: 5px solid #dc3545;*/ + } + to { + color: #FFF; + background-color: #00b1ec; + /*border: 5px solid #ffc107;*/ + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/CheckControls.razor.less b/MP-TAB-SERV/Components/CheckControls.razor.less new file mode 100644 index 00000000..92d27830 --- /dev/null +++ b/MP-TAB-SERV/Components/CheckControls.razor.less @@ -0,0 +1,71 @@ + +.flashingPurple { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsBlue; + transform: translateZ(0); +} + +@keyframes flsBlue { + from { + color: #ffc107; + background-color: #7623c8; + /*border: 5px solid #dc3545;*/ + } + + to { + color: #FFF; + background-color: #00b1ec; + /*border: 5px solid #ffc107;*/ + } +} +.flashingRed { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsRed; + transform: translateZ(0); +} + +@keyframes flsRed { + from { + color: #ffc107; + background-color: #c82332; + /*border: 5px solid #dc3545;*/ + } + + to { + color: #FFF; + background-color: #ecb100; + /*border: 5px solid #ffc107;*/ + } +} + +.flashingBlue { + animation-duration: 0.75s; + animation-timing-function: steps(2); + animation-iteration-count: infinite; + animation-direction: alternate; + animation-play-state: running; + animation-name: flsBlue; + transform: translateZ(0); +} + +@keyframes flsBlue { + from { + color: #ffc107; + background-color: #2323c8; + /*border: 5px solid #dc3545;*/ + } + + to { + color: #FFF; + background-color: #00b1ec; + /*border: 5px solid #ffc107;*/ + } +} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/CheckControls.razor.min.css b/MP-TAB-SERV/Components/CheckControls.razor.min.css new file mode 100644 index 00000000..71fb7b6d --- /dev/null +++ b/MP-TAB-SERV/Components/CheckControls.razor.min.css @@ -0,0 +1 @@ +.flashingPurple{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#7623c8;}to{color:#fff;background-color:#00b1ec;}}.flashingRed{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsRed;transform:translateZ(0);}@keyframes flsRed{from{color:#ffc107;background-color:#c82332;}to{color:#fff;background-color:#ecb100;}}.flashingBlue{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#2323c8;}to{color:#fff;background-color:#00b1ec;}} \ No newline at end of file diff --git a/MP-TAB-SERV/Components/ControlsMan.razor.cs b/MP-TAB-SERV/Components/ControlsMan.razor.cs index 83d548d4..07d5e907 100644 --- a/MP-TAB-SERV/Components/ControlsMan.razor.cs +++ b/MP-TAB-SERV/Components/ControlsMan.razor.cs @@ -45,28 +45,28 @@ namespace MP_TAB_SERV.Components get => showInsert ? "Nascondi Controllo" : "Registra Controllo"; } + protected bool enableControlli { get; set; } = true; protected List ListComplete { get; set; } = new List(); protected List ListPaged { get; set; } = new List(); [Inject] protected MessageService MServ { get; set; } = null!; - [Inject] - protected TabDataService TabDServ { get; set; } = null!; [Inject] protected SharedMemService SMServ { get; set; } = null!; + [Inject] + protected TabDataService TabDServ { get; set; } = null!; + #endregion Protected Properties #region Protected Methods - protected bool enableControlli { get; set; } = true; protected override async Task OnInitializedAsync() { await Task.Delay(1); if (RecMSE != null) { - enableControlli = SMServ.GetConfBool("enableControlli"); IdxMaccSel = RecMSE.IdxMacchina; DateTime fine = DateTime.Today.AddDays(1); diff --git a/MP-TAB-SERV/MP-TAB-SERV.csproj b/MP-TAB-SERV/MP-TAB-SERV.csproj index c74167ee..a5d9d7ab 100644 --- a/MP-TAB-SERV/MP-TAB-SERV.csproj +++ b/MP-TAB-SERV/MP-TAB-SERV.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2312.1117 + 6.16.2312.1119 enable MP_TAB_SERV diff --git a/MP-TAB-SERV/Pages/Alarms.razor b/MP-TAB-SERV/Pages/Alarms.razor index ff411c7a..cba45328 100644 --- a/MP-TAB-SERV/Pages/Alarms.razor +++ b/MP-TAB-SERV/Pages/Alarms.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/Controls.razor b/MP-TAB-SERV/Pages/Controls.razor index 21bef545..d6545f1a 100644 --- a/MP-TAB-SERV/Pages/Controls.razor +++ b/MP-TAB-SERV/Pages/Controls.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/Declarations.razor b/MP-TAB-SERV/Pages/Declarations.razor index 7be4b8f6..5a45a974 100644 --- a/MP-TAB-SERV/Pages/Declarations.razor +++ b/MP-TAB-SERV/Pages/Declarations.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/IobInfo.razor b/MP-TAB-SERV/Pages/IobInfo.razor index c8e7575f..35077c37 100644 --- a/MP-TAB-SERV/Pages/IobInfo.razor +++ b/MP-TAB-SERV/Pages/IobInfo.razor @@ -7,8 +7,7 @@ } else { -
- -
+ + } diff --git a/MP-TAB-SERV/Pages/MachineDetail.razor b/MP-TAB-SERV/Pages/MachineDetail.razor index fd965bef..a068cce3 100644 --- a/MP-TAB-SERV/Pages/MachineDetail.razor +++ b/MP-TAB-SERV/Pages/MachineDetail.razor @@ -8,6 +8,7 @@ } else { + diff --git a/MP-TAB-SERV/Pages/Notes.razor b/MP-TAB-SERV/Pages/Notes.razor index 15e2b1a9..de63c2db 100644 --- a/MP-TAB-SERV/Pages/Notes.razor +++ b/MP-TAB-SERV/Pages/Notes.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/ODL.razor b/MP-TAB-SERV/Pages/ODL.razor index 5f2f525d..85cdcb6b 100644 --- a/MP-TAB-SERV/Pages/ODL.razor +++ b/MP-TAB-SERV/Pages/ODL.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/Parameters.razor b/MP-TAB-SERV/Pages/Parameters.razor index 16b8b68e..3ecd6b07 100644 --- a/MP-TAB-SERV/Pages/Parameters.razor +++ b/MP-TAB-SERV/Pages/Parameters.razor @@ -8,6 +8,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/ProdPlan.razor b/MP-TAB-SERV/Pages/ProdPlan.razor index 8c0674dc..4130f6ac 100644 --- a/MP-TAB-SERV/Pages/ProdPlan.razor +++ b/MP-TAB-SERV/Pages/ProdPlan.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/ProdStop.razor b/MP-TAB-SERV/Pages/ProdStop.razor index 0f9b2505..6f32c69f 100644 --- a/MP-TAB-SERV/Pages/ProdStop.razor +++ b/MP-TAB-SERV/Pages/ProdStop.razor @@ -8,9 +8,8 @@ } else { -
- -
+ + diff --git a/MP-TAB-SERV/Pages/Scrap.razor b/MP-TAB-SERV/Pages/Scrap.razor index 64aa41ba..ef0f6528 100644 --- a/MP-TAB-SERV/Pages/Scrap.razor +++ b/MP-TAB-SERV/Pages/Scrap.razor @@ -7,6 +7,7 @@ } else { + } diff --git a/MP-TAB-SERV/Pages/TechSheet.razor b/MP-TAB-SERV/Pages/TechSheet.razor index 612cfe71..5c37ccea 100644 --- a/MP-TAB-SERV/Pages/TechSheet.razor +++ b/MP-TAB-SERV/Pages/TechSheet.razor @@ -8,6 +8,7 @@ } else { + @if (enableSchedaTecnica) { diff --git a/MP-TAB-SERV/Pages/WorkShift.razor b/MP-TAB-SERV/Pages/WorkShift.razor index ae0bd885..f6e8f517 100644 --- a/MP-TAB-SERV/Pages/WorkShift.razor +++ b/MP-TAB-SERV/Pages/WorkShift.razor @@ -7,6 +7,7 @@ } else { +

Gestione Turni

diff --git a/MP-TAB-SERV/Resources/ChangeLog.html b/MP-TAB-SERV/Resources/ChangeLog.html index 416babf1..cc6d4acd 100644 --- a/MP-TAB-SERV/Resources/ChangeLog.html +++ b/MP-TAB-SERV/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

Versione: 6.16.2312.1117

+

Versione: 6.16.2312.1119


Note di rilascio:
  • diff --git a/MP-TAB-SERV/Resources/VersNum.txt b/MP-TAB-SERV/Resources/VersNum.txt index 37708e5b..81fa670d 100644 --- a/MP-TAB-SERV/Resources/VersNum.txt +++ b/MP-TAB-SERV/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2312.1117 +6.16.2312.1119 diff --git a/MP-TAB-SERV/Resources/manifest.xml b/MP-TAB-SERV/Resources/manifest.xml index 333426eb..2203e907 100644 --- a/MP-TAB-SERV/Resources/manifest.xml +++ b/MP-TAB-SERV/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2312.1117 + 6.16.2312.1119 https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html false diff --git a/MP-TAB-SERV/compilerconfig.json b/MP-TAB-SERV/compilerconfig.json index 81657133..0ae6cb7f 100644 --- a/MP-TAB-SERV/compilerconfig.json +++ b/MP-TAB-SERV/compilerconfig.json @@ -34,5 +34,9 @@ { "outputFile": "Components/ProdPlanMan.razor.css", "inputFile": "Components/ProdPlanMan.razor.less" + }, + { + "outputFile": "Components/CheckControls.razor.css", + "inputFile": "Components/CheckControls.razor.less" } ] \ No newline at end of file diff --git a/MP.Data/Controllers/MpTabController.cs b/MP.Data/Controllers/MpTabController.cs index e7311b81..5edb6991 100644 --- a/MP.Data/Controllers/MpTabController.cs +++ b/MP.Data/Controllers/MpTabController.cs @@ -54,51 +54,6 @@ namespace MP.Data.Controllers return dbResult; } - - /// - /// Elenco operatori - /// - /// - public List ElencoOperatori() - { - List dbResult = new List(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbOperatori - .Where(s => s.MatrOpr > 0) - .AsNoTracking() - .OrderBy(x => x.MatrOpr) - .ToList(); - } - return dbResult; - } - - /// - /// login operatori - /// - /// /// - /// /// - /// - public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey) - { - AnagOperatoriModel dbResult = null; - AnagOperatoriModel answ = new AnagOperatoriModel(); - using (var dbCtx = new MoonProContext(_configuration)) - { - dbResult = dbCtx - .DbOperatori - .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey)) - .AsNoTracking() - .FirstOrDefault(); - if (dbResult != null) - { - answ = dbResult; - } - } - return answ; - } - /// /// Registrato ACK allarme /// @@ -560,6 +515,25 @@ namespace MP.Data.Controllers return fatto; } + /// + /// Elenco operatori + /// + /// + public List ElencoOperatori() + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbOperatori + .Where(s => s.MatrOpr > 0) + .AsNoTracking() + .OrderBy(x => x.MatrOpr) + .ToList(); + } + return dbResult; + } + //stp_DDB_getNextByMacchinaFrom /// /// Eliminazione record EventList (SE trovato) @@ -1264,6 +1238,33 @@ namespace MP.Data.Controllers return answ; } + /// + /// login operatori + /// + /// /// + /// + /// /// + /// + /// + public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey) + { + AnagOperatoriModel dbResult = null; + AnagOperatoriModel answ = new AnagOperatoriModel(); + using (var dbCtx = new MoonProContext(_configuration)) + { + dbResult = dbCtx + .DbOperatori + .Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey)) + .AsNoTracking() + .FirstOrDefault(); + if (dbResult != null) + { + answ = dbResult; + } + } + return answ; + } + /// /// Stato prod macchina /// @@ -1444,6 +1445,29 @@ namespace MP.Data.Controllers return fatto; } + /// Restituisce elenco Ultimi RC macchina + /// + /// + /// + /// + /// + /// + public List RegControlliLast(string idxMacchina) + { + List dbResult = new List(); + using (var dbCtx = new MoonProContext(_configuration)) + { + var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina); + + dbResult = dbCtx + .DbSetRegControlli + .FromSqlRaw("EXEC stp_RC_getLast @IdxMacchina", IdxMacc) + .AsNoTracking() + .ToList(); + } + return dbResult; + } + /// /// Aggiunta record RegistroScarti /// diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index baa9cbb9..70427841 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -1942,6 +1942,42 @@ namespace MP.Data.Services return result; } + /// + /// Restituisce elenco ULTIMI RC x macchina + /// + /// + /// + public async Task> RegControlliLast(string idxMacchina) + { + // setup parametri costanti + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List? result = new List(); + // cerco in redis... + string currKey = $"{redisBaseKey}:RecContr:{idxMacchina}:LAST"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = dbTabController.RegControlliLast(idxMacchina); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, FastCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"RegControlliLast | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + /// /// Registra controllo ///