Commit 520c3973 authored by 张伯涛's avatar 张伯涛

一键启停

parent 06a81aae
...@@ -8,3 +8,8 @@ export const selectOneStartStop = params => { ...@@ -8,3 +8,8 @@ export const selectOneStartStop = params => {
export const selectIsScheduleByUserId = params => { export const selectIsScheduleByUserId = params => {
return httpTwo.get(`/busVoiceCommands/selectIsScheduleByUserId?userId=` + params.userId ) return httpTwo.get(`/busVoiceCommands/selectIsScheduleByUserId?userId=` + params.userId )
} }
// 手动执行到哪一步了
export const setOneStartStop = (item) => {
return httpTwo.post(`/busVoiceCommands/setOneStartStop`,item)
}
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
</div> </div>
<div class="demo-button"> <div class="demo-button">
<el-button type="primary" :loading="isLoading" @click="TransferOpen" >一键启动</el-button> <el-button type="primary" :loading="isLoading" @click="TransferOpen" >一键启动</el-button>
<el-button type="primary" :loading="isLoading" @click="TransferClose" >一键停止</el-button> <el-button type="primary" :loading="isLoading" @click="OnekeyStopEnd" >一键停止</el-button>
<!-- <el-button type="primary" :loading="isLoading" @click="TransferClose" >一键停止</el-button>-->
</div> </div>
</div> </div>
</el-card> </el-card>
...@@ -102,7 +103,7 @@ import { ElMessage,ElMessageBox } from "element-plus"; ...@@ -102,7 +103,7 @@ import { ElMessage,ElMessageBox } from "element-plus";
import { vFloatNumber } from "../../utils/directives.js"; import { vFloatNumber } from "../../utils/directives.js";
import { fa } from 'element-plus/es/locale'; import { fa } from 'element-plus/es/locale';
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
import {selectOneStartStop, selectIsScheduleByUserId} from '../../api/oneKeyStartStop/index.js' import {selectOneStartStop, selectIsScheduleByUserId, setOneStartStop} from '../../api/oneKeyStartStop/index.js'
const enterpriseId = ref(null); const enterpriseId = ref(null);
const cascaderRef = ref(null); const cascaderRef = ref(null);
const isLoading= ref(false); const isLoading= ref(false);
...@@ -113,6 +114,7 @@ const activeCloseStep = ref(-1); ...@@ -113,6 +114,7 @@ const activeCloseStep = ref(-1);
const clientHeight = ref("500px"); const clientHeight = ref("500px");
const options = reactive([]); const options = reactive([]);
const transferId = ref(null); const transferId = ref(null);
const stationId = ref(null);
const limit = ref(0); const limit = ref(0);
const dialogFormVisible = ref(false); const dialogFormVisible = ref(false);
const isSingle = ref(false); const isSingle = ref(false);
...@@ -565,6 +567,7 @@ const onValueChange = (newValue) => { ...@@ -565,6 +567,7 @@ const onValueChange = (newValue) => {
}; };
async function TransferOpen() { async function TransferOpen() {
stationId.value = options[0].children[0].children.find(item => item.value === transferId.value).stationId
// 清理定时任务 // 清理定时任务
clearInterval(timerQuery); clearInterval(timerQuery);
timerQuery = null; // 清空定时器 ID timerQuery = null; // 清空定时器 ID
...@@ -576,14 +579,17 @@ async function TransferOpen() { ...@@ -576,14 +579,17 @@ async function TransferOpen() {
}); });
if (!transferId || transferId === null) { if (!transferId || transferId === null) {
ElMessage.error("请选择要一键启动的换热站机组!"); ElMessage.error("请选择要一键启动的换热站机组!");
scheduledTasks() // 定时查询
return; return;
} }
if (!limit) { if (!limit) {
ElMessage.error("请输入水箱液位量程后才能对换热站机组进行一键启动操作!"); ElMessage.error("请输入水箱液位量程后才能对换热站机组进行一键启动操作!");
scheduledTasks() // 定时查询
return; return;
} }
if (limit.value <= 0) { if (limit.value <= 0) {
ElMessage.error("请输入正确的水箱液位量程!"); ElMessage.error("请输入正确的水箱液位量程!");
scheduledTasks() // 定时查询
return; return;
} }
...@@ -594,16 +600,19 @@ async function TransferOpen() { ...@@ -594,16 +600,19 @@ async function TransferOpen() {
if (result) { if (result) {
if (!result.success) { if (!result.success) {
ElMessage.error(result.message); ElMessage.error(result.message);
scheduledTasks() // 定时查询
return; return;
} }
var data = result.data[0]; var data = result.data[0];
if (data.aiSendOnekeyStartStop) { if (data.aiSendOnekeyStartStop) {
ElMessage.error(data.transferName + "平台已下发一键启停命令!"); ElMessage.error(data.transferName + "平台已下发一键启停命令!");
scheduledTasks() // 定时查询
return; return;
} }
if (data.firstReplenishmentPump || data.secondReplenishmentPump || data.oneCirculatingPump || data.twoCirculatingPump) { if (data.firstReplenishmentPump || data.secondReplenishmentPump || data.oneCirculatingPump || data.twoCirculatingPump) {
ElMessage.error(data.transferName + " 循环泵或补水泵已启动,无法执行一键启动命令!"); ElMessage.error(data.transferName + " 循环泵或补水泵已启动,无法执行一键启动命令!");
scheduledTasks() // 定时查询
return; return;
} }
...@@ -611,6 +620,7 @@ async function TransferOpen() { ...@@ -611,6 +620,7 @@ async function TransferOpen() {
if (data.circuitBreakerSwitchOnStatus) { if (data.circuitBreakerSwitchOnStatus) {
ElMessage.error(result.data.transferName + " 供热设备总断路器非合闸状态,一键启动失败!"); ElMessage.error(result.data.transferName + " 供热设备总断路器非合闸状态,一键启动失败!");
startPercent[0].color = "rgb(176 63 63)"; startPercent[0].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,1,undefined)
return; return;
} }
...@@ -620,6 +630,7 @@ async function TransferOpen() { ...@@ -620,6 +630,7 @@ async function TransferOpen() {
if (data.circulatingPumpThreeImbalancesAlarm === true || data.replenishmentPumpThreeImbalancesAlarm === true) { if (data.circulatingPumpThreeImbalancesAlarm === true || data.replenishmentPumpThreeImbalancesAlarm === true) {
ElMessage.error(data.transferName + " 循环泵、补水泵电表三项不平衡报警,一键启动失败!"); ElMessage.error(data.transferName + " 循环泵、补水泵电表三项不平衡报警,一键启动失败!");
startPercent[1].color = "rgb(176 63 63)"; startPercent[1].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,2,undefined)
return; return;
} }
...@@ -628,6 +639,7 @@ async function TransferOpen() { ...@@ -628,6 +639,7 @@ async function TransferOpen() {
if (data.transferOverheated) { if (data.transferOverheated) {
ElMessage.error(data.transferName + " 内设备过热,一键启动失败!"); ElMessage.error(data.transferName + " 内设备过热,一键启动失败!");
startPercent[2].color = "rgb(176 63 63)"; startPercent[2].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,3,undefined)
return; return;
} }
...@@ -636,6 +648,7 @@ async function TransferOpen() { ...@@ -636,6 +648,7 @@ async function TransferOpen() {
if (data.liquidLevel < limit.value) { if (data.liquidLevel < limit.value) {
ElMessage.error(data.transferName + " 当前水箱液位"+data.liquidLevel+"未达到量程,一键启动失败!"); ElMessage.error(data.transferName + " 当前水箱液位"+data.liquidLevel+"未达到量程,一键启动失败!");
startPercent[3].color = "rgb(176 63 63)"; startPercent[3].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,4,undefined)
return; return;
} }
...@@ -643,7 +656,8 @@ async function TransferOpen() { ...@@ -643,7 +656,8 @@ async function TransferOpen() {
activeStep.value = 4; activeStep.value = 4;
if (data.oneCirculatingPump === true || data.twoCirculatingPump === true) { if (data.oneCirculatingPump === true || data.twoCirculatingPump === true) {
ElMessage.error(data.transferName + " 补水泵故障,一键启动失败!"); ElMessage.error(data.transferName + " 补水泵故障,一键启动失败!");
startPercent[5].color = "rgb(176 63 63)"; startPercent[4].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,5,undefined)
return; return;
} }
await new Promise(resolve => setTimeout(resolve, 1000)); await new Promise(resolve => setTimeout(resolve, 1000));
...@@ -652,6 +666,7 @@ async function TransferOpen() { ...@@ -652,6 +666,7 @@ async function TransferOpen() {
if (data.firstCirculatingPumpFault === true || data.secondCirculatingPumpFault === true) { if (data.firstCirculatingPumpFault === true || data.secondCirculatingPumpFault === true) {
ElMessage.error(data.transferName + " 循环泵故障,一键启动失败!"); ElMessage.error(data.transferName + " 循环泵故障,一键启动失败!");
startPercent[5].color = "rgb(176 63 63)"; startPercent[5].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,6,undefined)
return; return;
} }
...@@ -661,6 +676,7 @@ async function TransferOpen() { ...@@ -661,6 +676,7 @@ async function TransferOpen() {
if (data.tabletsValue === false) { if (data.tabletsValue === false) {
ElMessage.error(data.transferName + " 卡片机读取阀门开启状态异常,一键启动失败!"); ElMessage.error(data.transferName + " 卡片机读取阀门开启状态异常,一键启动失败!");
startPercent[6].color = "rgb(176 63 63)"; startPercent[6].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,7,undefined)
return; return;
} }
...@@ -680,7 +696,9 @@ async function TransferOpen() { ...@@ -680,7 +696,9 @@ async function TransferOpen() {
} }
function TransferClose() { function TransferClose() {
// 清理定时任务
clearInterval(timerQuery);
timerQuery = null; // 清空定时器 ID
activeCloseStep.value = -1; activeCloseStep.value = -1;
stopPercent.value.forEach(item => { stopPercent.value.forEach(item => {
item.color = "rgb(127,127,127)"; item.color = "rgb(127,127,127)";
...@@ -702,7 +720,9 @@ function TransferClose() { ...@@ -702,7 +720,9 @@ function TransferClose() {
}) })
.then(async () => { .then(async () => {
await OnekeyStop(); await OnekeyStop();
}) }).catch(() => {
scheduledTasks() // 定时查询
});
} }
...@@ -717,8 +737,10 @@ async function OneKeyStart(num) { ...@@ -717,8 +737,10 @@ async function OneKeyStart(num) {
if (result.success) { if (result.success) {
activeStep.value = 8; activeStep.value = 8;
startPercent[7].color = "rgb(103 194 58)"; startPercent[7].color = "rgb(103 194 58)";
await handleSetOneStartStop(stationId.value, transferId.value, true, undefined, 8, undefined)
} else { } else {
startPercent[7].color = "rgb(176 63 63)"; startPercent[7].color = "rgb(176 63 63)";
await handleSetOneStartStop(stationId.value, transferId.value, false, undefined, 8, undefined)
} }
ElMessage.success(result.message); ElMessage.success(result.message);
} else { } else {
...@@ -733,8 +755,6 @@ async function OneKeyStart(num) { ...@@ -733,8 +755,6 @@ async function OneKeyStart(num) {
async function OnekeyStop(){ async function OnekeyStop(){
console.log('1111111') console.log('1111111')
// 清理定时任务
clearInterval(timerQuery);
try { try {
isLoading.value = true; isLoading.value = true;
var result = await http.post("api/remote/OnekeyControl/WriteStop", transferId.value); var result = await http.post("api/remote/OnekeyControl/WriteStop", transferId.value);
...@@ -759,8 +779,34 @@ async function OnekeyStop(){ ...@@ -759,8 +779,34 @@ async function OnekeyStop(){
isLoading.value = false; isLoading.value = false;
} }
} }
// //换热站id
// private String stationId;
// //换热站机组id
// private String unitId;
// //启动步骤状态值
// private Boolean runStepsFlag;
// //停止步骤状态值
// private Boolean stopStepsFlag;
// //启动步骤
// private Integer runSteps;
// //停止步骤
// private Integer stopSteps;
async function handleSetOneStartStop( stationId,unitId,runStepsFlag,stopStepsFlag,runSteps,stopSteps) {
const params = {
stationId: stationId,
unitId: unitId,
runStepsFlag: runStepsFlag,
stopStepsFlag: stopStepsFlag,
runSteps: runSteps,
stopSteps: stopSteps,
}
setOneStartStop(params).then(res => {
scheduledTasks() // 定时查询
})
}
async function OnekeyStopEnd() { async function OnekeyStopEnd() {
stationId.value = options[0].children[0].children.find(item => item.value === transferId.value).stationId
try { try {
var result = await http.post("api/remote/OnekeyControl/GetTransferStatus", transferId.value); var result = await http.post("api/remote/OnekeyControl/GetTransferStatus", transferId.value);
...@@ -781,7 +827,9 @@ async function OnekeyStopEnd() { ...@@ -781,7 +827,9 @@ async function OnekeyStopEnd() {
if (data.firstReplenishmentPump || data.secondReplenishmentPump) { if (data.firstReplenishmentPump || data.secondReplenishmentPump) {
ElMessage.error(data.transferName + " 补水泵关闭失败!"); ElMessage.error(data.transferName + " 补水泵关闭失败!");
stopPercent.value[0].color = "rgb(176 63 63)"; stopPercent.value[0].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,1)
return; return;
} }
await new Promise(resolve => setTimeout(resolve, 1000)); await new Promise(resolve => setTimeout(resolve, 1000));
...@@ -790,6 +838,7 @@ async function OnekeyStopEnd() { ...@@ -790,6 +838,7 @@ async function OnekeyStopEnd() {
if (data.oneCirculatingPump || data.twoCirculatingPump) { if (data.oneCirculatingPump || data.twoCirculatingPump) {
ElMessage.error(data.transferName + " 循环泵关闭失败!"); ElMessage.error(data.transferName + " 循环泵关闭失败!");
stopPercent.value[1].color = "rgb(176 63 63)"; stopPercent.value[1].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,2)
return; return;
} }
...@@ -802,6 +851,7 @@ async function OnekeyStopEnd() { ...@@ -802,6 +851,7 @@ async function OnekeyStopEnd() {
if (!data.firstSupplyElectricValveCloseInPlace) { if (!data.firstSupplyElectricValveCloseInPlace) {
ElMessage.error(data.transferName + " 一次网供水电动阀关到位失败!"); ElMessage.error(data.transferName + " 一次网供水电动阀关到位失败!");
stopPercent.value[singleIndex].color = "rgb(176 63 63)"; stopPercent.value[singleIndex].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,singleIndex)
return; return;
} }
...@@ -811,6 +861,7 @@ async function OnekeyStopEnd() { ...@@ -811,6 +861,7 @@ async function OnekeyStopEnd() {
if (!data.rirstReturnElectricValveCloseInPlace) { if (!data.rirstReturnElectricValveCloseInPlace) {
ElMessage.error(data.transferName + " 一次网回水电动阀关到位失败!"); ElMessage.error(data.transferName + " 一次网回水电动阀关到位失败!");
stopPercent.value[singleIndex].color = "rgb(176 63 63)"; stopPercent.value[singleIndex].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,singleIndex)
return; return;
} }
...@@ -825,6 +876,7 @@ async function OnekeyStopEnd() { ...@@ -825,6 +876,7 @@ async function OnekeyStopEnd() {
console.log(singleIndex); console.log(singleIndex);
console.log(stopPercent); console.log(stopPercent);
stopPercent.value[singleIndex].color = "rgb(176 63 63)"; stopPercent.value[singleIndex].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,singleIndex)
return; return;
} }
...@@ -834,12 +886,14 @@ async function OnekeyStopEnd() { ...@@ -834,12 +886,14 @@ async function OnekeyStopEnd() {
if (!data.secReturnElectricValveCloseInPlace) { if (!data.secReturnElectricValveCloseInPlace) {
ElMessage.error(data.transferName + " 二次网回水电动阀关到位失败!"); ElMessage.error(data.transferName + " 二次网回水电动阀关到位失败!");
stopPercent.value[singleIndex].color = "rgb(176 63 63)"; stopPercent.value[singleIndex].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,singleIndex)
return; return;
} }
await new Promise(resolve => setTimeout(resolve, 1000)); await new Promise(resolve => setTimeout(resolve, 1000));
stopPercent.value[singleIndex].color = "rgb(103 194 58)"; stopPercent.value[singleIndex].color = "rgb(103 194 58)";
handleSetOneStartStop(stationId.value,transferId.value,undefined,false,undefined,singleIndex)
activeCloseStep.value = ++singleIndex; activeCloseStep.value = ++singleIndex;
ElMessage.success("一键停止执行完毕!"); ElMessage.success("一键停止执行完毕!");
...@@ -847,7 +901,6 @@ async function OnekeyStopEnd() { ...@@ -847,7 +901,6 @@ async function OnekeyStopEnd() {
ElMessage.error(error.message); ElMessage.error(error.message);
} }
finally { finally {
scheduledTasks() // 定时查询
isLoading.value = false; isLoading.value = false;
isStop.value = false; isStop.value = false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment