Fix IO
This commit is contained in:
@@ -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<int, DTOAxisInfoModel> axis)
|
||||
{
|
||||
foreach (KeyValuePair<int, DTOAxisInfoModel> asse in axis)
|
||||
|
||||
@@ -317,10 +317,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -42,7 +42,11 @@ export default class AsseRowItem extends Vue {
|
||||
|
||||
async sendCommand(cmd,ax){
|
||||
this.isSendingCMD = true;
|
||||
await awaiter (underTheHoodService.sendAxisCommand(ax.id,cmd,this.forcedValue.setpointHMI));
|
||||
if(this.forcedValue.setpointHMI)
|
||||
await awaiter (underTheHoodService.sendAxisCommand(ax.id,cmd,this.forcedValue.setpointHMI));
|
||||
else
|
||||
await awaiter (underTheHoodService.sendAxisCommand(ax.id,cmd,0));
|
||||
|
||||
this.isSendingCMD = false;
|
||||
}
|
||||
|
||||
|
||||
+4
-12
@@ -14,18 +14,10 @@
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.page }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.wire }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.profinet }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.label | localize(item.label) }}</span>
|
||||
</td>
|
||||
<td>{{ item.page }}</td>
|
||||
<td>{{ item.wire }}</td>
|
||||
<td>{{ item.profinet }}</td>
|
||||
<td>{{ item.label | localize(item.label) }}</td>
|
||||
<td v-if="group=='di'">
|
||||
<span
|
||||
:class="
|
||||
|
||||
-111
@@ -1,111 +0,0 @@
|
||||
<template>
|
||||
<table class="output-table">
|
||||
<thead>
|
||||
<tr class="bg-header">
|
||||
<th><span></span></th>
|
||||
<th><span class="page-output">Page</span></th>
|
||||
<th><span class="wire-output">Wire</span></th>
|
||||
<th><span class="profinet-output">Profinet</span></th>
|
||||
<th><span class="description-output">Description</span></th>
|
||||
<th><span class="value-output">Value</span></th>
|
||||
<th><span class="edit-output">Force</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<div class="tr-container-output" v-for="i of items" :key="i.nome">
|
||||
<div class="output-label">
|
||||
<tr class="tr-container-output-nome">
|
||||
<th>
|
||||
<span class="group-title">{{ i.nome }}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</div>
|
||||
|
||||
<tr v-for="(item, index) of arrayReduced[i.nome]" :key="index">
|
||||
<td>
|
||||
<span class="controlli-bt-button-secondary-icon-output pointer">
|
||||
<img
|
||||
src="/assets/icons/sotto-cofano/png/ico-bt-selez-auto-pin-grey.png"
|
||||
srcset="
|
||||
/assets/icons/sotto-cofano/png/ico-bt-selez-auto-pin-grey@2x.png 2x,
|
||||
/assets/icons/sotto-cofano/png/ico-bt-selez-auto-pin-grey@3x.png 3x
|
||||
"
|
||||
class="ico-bt-selez-auto-pin-output"
|
||||
/>
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="page-inner-output">{{ item.page }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="wire-inner-output">{{ item.wire }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="profinet-inner-output">{{ item.profinet }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span class="description-inner-output">
|
||||
{{ item.description }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span
|
||||
:class="
|
||||
item.value === 1
|
||||
? 'value-button-output-container-on pointer'
|
||||
: 'value-button-output-container-off pointer'
|
||||
"
|
||||
>
|
||||
<span
|
||||
v-if="item.value === 1"
|
||||
class="value-button-output-container-on-label"
|
||||
>ON</span
|
||||
>
|
||||
<span
|
||||
v-if="item.value === 0"
|
||||
class="value-button-output-container-off-label"
|
||||
>OFF</span
|
||||
>
|
||||
</span>
|
||||
</td>
|
||||
<td v-if="i.nome.includes('DO')">
|
||||
<span class="edit-button-output-container">
|
||||
<span class="edit-button-output-container-oval-left">
|
||||
<span class="edit-button-output-container-oval-left-text"
|
||||
>0</span
|
||||
>
|
||||
</span>
|
||||
<span class="edit-button-output-container-oval-center">
|
||||
<span class="edit-button-output-container-oval-center-text"
|
||||
>1</span
|
||||
>
|
||||
</span>
|
||||
<!-- <span class="edit-button-output-container-oval-right">
|
||||
<span class="edit-button-output-container-oval-right-text"
|
||||
>0</span
|
||||
>
|
||||
</span> -->
|
||||
</span>
|
||||
<span class="x-button-container">
|
||||
<span class="x-button-content">
|
||||
<span class="x-button-content-label">×</span>
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
<td v-if="i.nome.includes('AO')">
|
||||
<span class="controlli-a-field">
|
||||
<span class="controlli-a-label">
|
||||
1024
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<style lang="less">
|
||||
@import "output.less";
|
||||
</style>
|
||||
<script lang="ts" src="./output.ts"></script>
|
||||
+4
-12
@@ -14,18 +14,10 @@
|
||||
/>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.page }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.wire }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.profinet }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ item.label | localize(item.label) }}</span>
|
||||
</td>
|
||||
<td>{{ item.page }}</td>
|
||||
<td>{{ item.wire }}</td>
|
||||
<td>{{ item.profinet }}</td>
|
||||
<td>{{ item.label | localize(item.label) }}</td>
|
||||
<td v-if="group=='do'">
|
||||
<span
|
||||
:class="
|
||||
|
||||
+7
-7
@@ -16,13 +16,13 @@
|
||||
</thead>
|
||||
<tbody class="autocolor">
|
||||
<tr v-for="(item, i) of resistances" :key="i">
|
||||
<td ><span>{{item.idGroup}}</span></td>
|
||||
<td ><span>{{item.idReflector}}</span></td>
|
||||
<td ><span>{{item.idChannel}}</span></td>
|
||||
<td ><span>{{getBoard(item.idChannel)}}</span></td>
|
||||
<td ><span>{{getOutput(item.idChannel)}}</span></td>
|
||||
<td ><span>{{getChannelInfo(item.idChannel).actualCurrent}} A</span></td>
|
||||
<td ><span>{{getChannelInfo(item.idChannel).actualPerc}} %</span></td>
|
||||
<td >{{item.idGroup}}</td>
|
||||
<td >{{item.idReflector}}</td>
|
||||
<td >{{item.idChannel}}</td>
|
||||
<td >{{getBoard(item.idChannel)}}</td>
|
||||
<td >{{getOutput(item.idChannel)}}</td>
|
||||
<td >{{getChannelInfo(item.idChannel).actualCurrent}} A</td>
|
||||
<td >{{getChannelInfo(item.idChannel).actualPerc}} %</td>
|
||||
<td >
|
||||
<span class="status-td">
|
||||
<span class="status-container" v-if="getChannelInfo(item.idChannel).channelStatus == 0">
|
||||
|
||||
@@ -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");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<Date>((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}`, {});
|
||||
|
||||
Reference in New Issue
Block a user