Browse Source

等待风机阀门到位后开启空压机

master
maochaoying 2 years ago
parent
commit
b1a0bc78f3
  1. 18
      src/components/SealTest.vue
  2. 5
      src/mock/command.js
  3. 4
      src/store/modules/seal.js
  4. 16
      src/store/modules/websocket.js

18
src/components/SealTest.vue

@ -96,6 +96,7 @@ import {
airCompressorChannelSelectJSON, airCompressorChannelSelectJSON,
AirOutletProportionalValve_getStateJSON, AirOutletProportionalValve_getStateJSON,
airInletProportionalValve_getStateJSON, airInletProportionalValve_getStateJSON,
airProportionalValveIsBusyJSON,
} from '@/mock/command' } from '@/mock/command'
import { useSealStore, useTestStore, useWebSocketStore } from '@/store' import { useSealStore, useTestStore, useWebSocketStore } from '@/store'
import { storeToRefs } from 'pinia' import { storeToRefs } from 'pinia'
@ -239,6 +240,20 @@ const wait = async ms => {
await new Promise(resolve => setTimeout(resolve, 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 sleepVal1 = ref(1)
const sleepVal2 = ref(15) const sleepVal2 = ref(15)
@ -256,6 +271,9 @@ const newStartTest = async flag => {
// //
websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0])) websocketStore.sendCommandMsg(AirInletProportionalValve_setStateJSON([0]))
websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0])) websocketStore.sendCommandMsg(AirOutletProportionalValve_setStateJSON([0]))
//
websocketStore.sendCommandMsg(airProportionalValveIsBusyJSON)
await waitAirFinish()
// //
websocketStore.sendCommandMsg(airCompressor_setStateJSON([1])) websocketStore.sendCommandMsg(airCompressor_setStateJSON([1]))
// 1s // 1s

5
src/mock/command.js

@ -414,3 +414,8 @@ export const airCompressorGetPressureDirectIntervalJSON = {
command: 'DeviceIOControlService.airCompressor_getPressureDirect', command: 'DeviceIOControlService.airCompressor_getPressureDirect',
messageId: 'airCompressor_getPressureDirect_interval', messageId: 'airCompressor_getPressureDirect_interval',
} }
export const airProportionalValveIsBusyJSON = {
command: 'DeviceIOControlService.AirProportionalValve_isBusy',
messageId: 'AirProportionalValve_isBusy',
}

4
src/store/modules/seal.js

@ -17,10 +17,14 @@ export const useSealStore = defineStore({
airCompressorValve1: 0, airCompressorValve1: 0,
airCompressorValve2: 0, airCompressorValve2: 0,
airCompressorChannelSelectVal: 1, airCompressorChannelSelectVal: 1,
AirProportionalValveIsBusy: 1,
} }
}, },
// actions // actions
actions: { actions: {
updateAirProportionalValveIsBusy(AirProportionalValveIsBusy) {
this.AirProportionalValveIsBusy = AirProportionalValveIsBusy
},
updateAirCompressorChannelSelectVal(airCompressorChannelSelectVal) { updateAirCompressorChannelSelectVal(airCompressorChannelSelectVal) {
this.airCompressorChannelSelectVal = airCompressorChannelSelectVal this.airCompressorChannelSelectVal = airCompressorChannelSelectVal
}, },

16
src/store/modules/websocket.js

@ -202,6 +202,22 @@ export const useWebSocketStore = defineStore({
) )
} }
break 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': case 'chpasswd':
const { ackcode: chpasswdCode } = JSON.parse(ev.data) const { ackcode: chpasswdCode } = JSON.parse(ev.data)
if (chpasswdCode != 0) { if (chpasswdCode != 0) {

Loading…
Cancel
Save