From b1a0bc78f39812b05fe49d83ae0186922440fc9a Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Mon, 20 Nov 2023 11:39:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=89=E5=BE=85=E9=A3=8E=E6=9C=BA=E9=98=80?= =?UTF-8?q?=E9=97=A8=E5=88=B0=E4=BD=8D=E5=90=8E=E5=BC=80=E5=90=AF=E7=A9=BA?= =?UTF-8?q?=E5=8E=8B=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SealTest.vue | 18 ++++++++++++++++++ src/mock/command.js | 5 +++++ src/store/modules/seal.js | 4 ++++ src/store/modules/websocket.js | 16 ++++++++++++++++ 4 files changed, 43 insertions(+) diff --git a/src/components/SealTest.vue b/src/components/SealTest.vue index 9005fdd..467fd82 100644 --- a/src/components/SealTest.vue +++ b/src/components/SealTest.vue @@ -96,6 +96,7 @@ import { airCompressorChannelSelectJSON, AirOutletProportionalValve_getStateJSON, airInletProportionalValve_getStateJSON, + airProportionalValveIsBusyJSON, } from '@/mock/command' import { useSealStore, useTestStore, useWebSocketStore } from '@/store' import { storeToRefs } from 'pinia' @@ -239,6 +240,20 @@ const wait = async ms => { await new Promise(resolve => setTimeout(resolve, ms)) } +const waitAirFinish = async () => { + await new Promise(async resolve => { + let flag = true + while (flag) { + await wait(500) + websocketStore.sendCommandMsg(airProportionalValveIsBusyJSON) + if (sealStore.AirProportionalValveIsBusy == 0) { + flag = false + } + } + resolve() + }) +} + const sleepVal1 = ref(1) const sleepVal2 = ref(15) @@ -256,6 +271,9 @@ const newStartTest = async flag => { // 风机入口比例阀闭合 风机出口比例阀闭合 websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0])) websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0])) + // 等待风机入口比例阀闭合 风机出口比例阀闭合完毕后再打开空压机 + websocketStore.sendCommandMsg(airProportionalValveIsBusyJSON) + await waitAirFinish() // 空压机打开 websocketStore.sendCommandMsg(airCompressor_setStateJSON([1])) // 等待1s diff --git a/src/mock/command.js b/src/mock/command.js index 304f831..d3cf905 100644 --- a/src/mock/command.js +++ b/src/mock/command.js @@ -414,3 +414,8 @@ export const airCompressorGetPressureDirectIntervalJSON = { command: 'DeviceIOControlService.airCompressor_getPressureDirect', messageId: 'airCompressor_getPressureDirect_interval', } + +export const airProportionalValveIsBusyJSON = { + command: 'DeviceIOControlService.AirProportionalValve_isBusy', + messageId: 'AirProportionalValve_isBusy', +} diff --git a/src/store/modules/seal.js b/src/store/modules/seal.js index 9797513..0df685b 100644 --- a/src/store/modules/seal.js +++ b/src/store/modules/seal.js @@ -17,10 +17,14 @@ export const useSealStore = defineStore({ airCompressorValve1: 0, airCompressorValve2: 0, airCompressorChannelSelectVal: 1, + AirProportionalValveIsBusy: 1, } }, // actions actions: { + updateAirProportionalValveIsBusy(AirProportionalValveIsBusy) { + this.AirProportionalValveIsBusy = AirProportionalValveIsBusy + }, updateAirCompressorChannelSelectVal(airCompressorChannelSelectVal) { this.airCompressorChannelSelectVal = airCompressorChannelSelectVal }, diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index 39fc654..0c2905b 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -202,6 +202,22 @@ export const useWebSocketStore = defineStore({ ) } break + case 'AirProportionalValve_isBusy': + const { + ackcode: airProportionalValveCode, + ack: airProportionalValveAck, + } = JSON.parse(ev.data) + if (airProportionalValveCode == 0) { + console.log( + 'airProportionalValveAck[0]', + airProportionalValveAck[0], + ) + // 比例阀当前是否到位 + sealStore.updateAirProportionalValveIsBusy( + airProportionalValveAck[0], + ) + } + break case 'chpasswd': const { ackcode: chpasswdCode } = JSON.parse(ev.data) if (chpasswdCode != 0) {