From f2ec6c206586f52f11faa8ee2fae7b45d14869cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Thu, 17 Jul 2025 17:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E5=96=B7=E5=98=B4=E6=B8=85?= =?UTF-8?q?=E6=B4=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../front/cmd/business/NozzlePipelineWashStop.java | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWashStop.java diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWashStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWashStop.java new file mode 100644 index 0000000..7c654d1 --- /dev/null +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWashStop.java @@ -0,0 +1,68 @@ +package com.qyft.ms.app.front.cmd.business; + +import com.qyft.ms.app.device.status.DeviceStatus; +import com.qyft.ms.system.common.annotation.CommandMapping; +import com.qyft.ms.system.common.device.command.CommandFuture; +import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; +import com.qyft.ms.system.core.handler.BaseCommandHandler; +import com.qyft.ms.system.model.bo.DeviceCommand; +import com.qyft.ms.system.model.form.FrontCmdControlForm; +import com.qyft.ms.system.service.device.DeviceCommandService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 停止清洗喷嘴管路 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("nozzle_pipeline_wash_stop")//业务指令注解 +public class NozzlePipelineWashStop extends BaseCommandHandler { + + private final DeviceCommandService deviceCommandService; + private final DeviceStatus deviceStatus; + + @Override + public CompletableFuture handle(FrontCmdControlForm form) { + return runAsync(() -> { + try { + DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动 + DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动 + DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动 + CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand); + CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand); + CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); + commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); + + //1.全部关闭三通阀 + DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 + CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); + commandWait(threeWayValveCloseAllCommandFuture); + + //2.关闭清洗阀 + DeviceCommand washValveCloseCommand = DeviceCommandGenerator.washValveClose(); // 关闭清洗阀 + CommandFuture washValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveCloseCommand); + commandWait(washValveCloseCommandFuture); + + //3.关闭喷嘴阀 + DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); // 关闭喷嘴阀 + CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveCloseCommand); + commandWait(nozzleValveCloseCommandFuture); + + //4.关闭除湿阀 + DeviceCommand dehumidifierValveCloseCommand = DeviceCommandGenerator.dehumidifierValveClose(); // 关闭除湿阀 + CommandFuture dehumidifierValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), dehumidifierValveCloseCommand); + commandWait(dehumidifierValveCloseCommandFuture); + } catch (Exception e) { + throw new RuntimeException(e); + }finally { + deviceStatus.setCleaningNozzlePipeline(false); + } + }); + + } +}