diff --git a/Thermo.Active.Database/Controllers/RedisController.cs b/Thermo.Active.Database/Controllers/RedisController.cs index 9bd42ef6..74ec5ec5 100644 --- a/Thermo.Active.Database/Controllers/RedisController.cs +++ b/Thermo.Active.Database/Controllers/RedisController.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Thermo.Active.Database.Redis; using Thermo.Active.Model.DTOModels; using Thermo.Active.Model.DTOModels.ThAxes; @@ -205,12 +206,22 @@ namespace Thermo.Active.Database.Controllers } set { - // TTL: se true 5 min, altrimenti 1 sec - int ttlSec = value ? 60 * 5 : 1; + // TTL: se true 20 min, altrimenti 1 sec + int ttlSec = value ? 60 * 20 : 1; WriteValue("FastIoSample", "Active", ttlSec); } } + public static DateTime SetFastIoSample(bool value) + { + // TTL: se true 20 min, altrimenti 1 sec + int ttlSec = value ? 60 * 20 : 1; + WriteValue("FastIoSample", "Active", ttlSec); + return DateTime.Now.AddSeconds(ttlSec); + } + + + public static bool WriteCurrentAxisStatus(Dictionary axis) { foreach (KeyValuePair asse in axis) diff --git a/Thermo.Active/Controllers/WebApi/UnderTheHoodController.cs b/Thermo.Active/Controllers/WebApi/UnderTheHoodController.cs index db121a6d..e9a676a9 100644 --- a/Thermo.Active/Controllers/WebApi/UnderTheHoodController.cs +++ b/Thermo.Active/Controllers/WebApi/UnderTheHoodController.cs @@ -314,10 +314,10 @@ namespace Thermo.Active.Controllers.WebApi public IHttpActionResult SetFastSample(bool value) { // imposta (su redis) campionamento RAPIDO/lento x IO... - RedisController.FastIoSample = value; + var expires = RedisController.SetFastIoSample(value); // ritorno solo fatto! - return Ok(); + return Ok(expires); } } } \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-header.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-header.vue index d2b89c90..16d6487a 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-header.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/processo/components/gantt/gantt-header.vue @@ -1,5 +1,5 @@ - - diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/InputOutput/components/tables/outputTab/output-row-item.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/InputOutput/components/tables/outputTab/output-row-item.vue index c928fc12..6da1ac9e 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/InputOutput/components/tables/outputTab/output-row-item.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/InputOutput/components/tables/outputTab/output-row-item.vue @@ -14,18 +14,10 @@ /> - - {{ item.page }} - - - {{ item.wire }} - - - {{ item.profinet }} - - - {{ item.label | localize(item.label) }} - + {{ item.page }} + {{ item.wire }} + {{ item.profinet }} + {{ item.label | localize(item.label) }} - {{item.idGroup}} - {{item.idReflector}} - {{item.idChannel}} - {{getBoard(item.idChannel)}} - {{getOutput(item.idChannel)}} - {{getChannelInfo(item.idChannel).actualCurrent}} A - {{getChannelInfo(item.idChannel).actualPerc}} % + {{item.idGroup}} + {{item.idReflector}} + {{item.idChannel}} + {{getBoard(item.idChannel)}} + {{getOutput(item.idChannel)}} + {{getChannelInfo(item.idChannel).actualCurrent}} A + {{getChannelInfo(item.idChannel).actualPerc}} % diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/sotto-cofano.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/sotto-cofano.ts index f35ba842..020e771a 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/sotto-cofano.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/sotto-cofano/sotto-cofano.ts @@ -9,6 +9,8 @@ import riscaldi from "./Riscaldi/components/riscaldi/riscaldi.vue"; import { store } from "@/store"; import { Watch } from "vue-property-decorator"; import { underTheHoodService } from "@/services/underTheHoodService"; +import moment from "moment"; +import { Modal as modal, ModalHelper } from "@/components/modals"; @Component({ components: { menuSx, io, logCicloAutomatico, logMisurazioni, assi, riscaldi } @@ -17,12 +19,53 @@ export default class Sottocofano extends Vue { panel: string = 'io'; + ioTimeout :Date = new Date(); + interval = undefined; + + mounted(){ + + } + get isLifted(): boolean { return store.state.isMainViewLiftedUp; } @Watch("isLifted") + @Watch("panel") async liftedChanged() { - await underTheHoodService.setFastSample(this.isLifted) + this.ioTimeout = await underTheHoodService.setFastSample(this.isLifted) + + if(this.isLifted && this.panel== "io" ){ + clearInterval(this.interval); + this.interval = setInterval(() => { + this.checkFastSample(); + }, 5000); + } + else{ + clearInterval(this.interval); + } + } + + beforeDestroy(){ + clearInterval(this.interval); + } + + checkFastSample(){ + var ioTime = moment(this.ioTimeout); + var ioNow = moment(); + if(ioNow > (ioTime.subtract(2, 'm'))) + { + ModalHelper.AskConfirm( this.$options.filters.localize("modal_confirm_title", "Richiesta di conferma"), + this.$options.filters.localize("modal_continue_untherhood_io", "La priorità di lettura degli I/O sta per scadere. Vuoi continuare a leggerli?"), + async() => { + await this.liftedChanged(); + } + , + () => { + clearInterval(this.interval); + } + , "modal"); + + } } } \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/services/underTheHoodService.ts b/Thermo.Active/wwwroot/src/services/underTheHoodService.ts index 59effd8c..08c8f696 100644 --- a/Thermo.Active/wwwroot/src/services/underTheHoodService.ts +++ b/Thermo.Active/wwwroot/src/services/underTheHoodService.ts @@ -26,9 +26,9 @@ export class UnderTheHoodService extends baseRestService { } async setFastSample(value: boolean) { - await this.Put((await this.BASE_URL()) + `/api/underthehood/io_sample_fast?value=${value}`, {}); + let result = await this.Put((await this.BASE_URL()) + `/api/underthehood/io_sample_fast?value=${value}`, {}); + return result; } - async sendAxisCommand(axisId: number,currCommand: string ,axPos: number) { await this.Put((await this.BASE_URL()) + `/api/underthehood/SendAxisCommand?AxisId=${axisId}&currCommand=${currCommand}&TargetPos=${axPos}`, {});