From 5615afd5551cac4b6bd8be3476fa09459ccce113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Mon, 26 May 2025 11:37:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=B0=83=E8=AF=95=E6=8C=87?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgs/app/cmd/debug/DebugDoorCloseCommand.java | 12 ++++++-- .../sgs/app/cmd/debug/DebugDoorOpenCommand.java | 12 +++++--- .../sgs/app/cmd/debug/DebugFanStartCommand.java | 8 ++--- .../sgs/app/cmd/debug/DebugFanStopCommand.java | 8 ++--- .../sgs/app/cmd/debug/DebugHeaterStartCommand.java | 10 +++--- .../sgs/app/cmd/debug/DebugHeaterStopCommand.java | 8 ++--- .../cmd/debug/DebugLiquidMotorMoveByCommand.java | 18 +++++------ .../cmd/debug/DebugLiquidMotorMoveToCommand.java | 16 +++++----- .../cmd/debug/DebugLiquidMotorOriginCommand.java | 2 +- .../app/cmd/debug/DebugLiquidMotorStopCommand.java | 2 +- .../cmd/debug/DebugLiquidPumpMoveByCommand.java | 8 ++--- .../app/cmd/debug/DebugLiquidPumpStartCommand.java | 8 ++--- .../debug/DebugLiquidValveOpenThickCommand.java | 36 ++++++++++++++++++++++ .../cmd/debug/DebugLiquidValveOpenThinCommand.java | 36 ++++++++++++++++++++++ .../debug/DebugLiquidValveOpenVacantCommand.java | 36 ++++++++++++++++++++++ .../debug/DebugLiquidValveOpenWasteCommand.java | 36 ++++++++++++++++++++++ .../debug/DebugLiquidValveOpenWaterCommand.java | 36 ++++++++++++++++++++++ .../app/cmd/debug/DebugMotorXMoveByCommand.java | 10 ++---- .../app/cmd/debug/DebugMotorXMoveToCommand.java | 2 +- .../app/cmd/debug/DebugMotorZMoveByCommand.java | 10 ++---- .../app/cmd/debug/DebugMotorZMoveToCommand.java | 2 +- .../cmd/debug/DebugValveSwitchThickCommand.java | 36 ---------------------- .../app/cmd/debug/DebugValveSwitchThinCommand.java | 36 ---------------------- .../cmd/debug/DebugValveSwitchVacantCommand.java | 36 ---------------------- .../cmd/debug/DebugValveSwitchWasteCommand.java | 36 ---------------------- .../cmd/debug/DebugValveSwitchWaterCommand.java | 36 ---------------------- .../device/module/SolutionModuleService.java | 2 +- .../sgs/common/cmd/DeviceCommandGenerator.java | 12 ++++---- 28 files changed, 253 insertions(+), 257 deletions(-) create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThickCommand.java create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThinCommand.java create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenVacantCommand.java create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWasteCommand.java create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWaterCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThickCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThinCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchVacantCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWasteCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWaterCommand.java diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorCloseCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorCloseCommand.java index c070c7c..0c8a51e 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorCloseCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorCloseCommand.java @@ -26,10 +26,16 @@ public class DebugDoorCloseCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + Double speed = cmdDTO.getDoubleParam("speed"); return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.doorMove(Double.valueOf(0)); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); + if (speed != null) { + DeviceCommandBundle doorSetDeviceCommandBundle = DeviceCommandGenerator.doorSet(speed); + CommandFuture doorSetDeviceCommandSetFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), doorSetDeviceCommandBundle); + CommandUtil.wait(doorSetDeviceCommandSetFuture); + } + DeviceCommandBundle doorMoveDeviceCommand = DeviceCommandGenerator.doorMove(0.0); + CommandFuture doorMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), doorMoveDeviceCommand); + CommandUtil.wait(doorMoveDeviceCommandFuture); }); } } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorOpenCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorOpenCommand.java index d6e180d..aad6eeb 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorOpenCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugDoorOpenCommand.java @@ -1,11 +1,10 @@ package com.iflytop.sgs.app.cmd.debug; -import cn.hutool.core.lang.Assert; import com.iflytop.sgs.app.core.BaseCommandHandler; import com.iflytop.sgs.app.model.dto.CmdDTO; import com.iflytop.sgs.app.model.entity.DevicePosition; -import com.iflytop.sgs.app.service.device.DeviceCommandService; import com.iflytop.sgs.app.service.api.DevicePositionService; +import com.iflytop.sgs.app.service.device.DeviceCommandService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.cmd.CommandFuture; import com.iflytop.sgs.common.cmd.DeviceCommandBundle; @@ -31,11 +30,14 @@ public class DebugDoorOpenCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { - double speed = cmdDTO.getDoubleParam("speed"); + Double speed = cmdDTO.getDoubleParam("speed"); DevicePosition devicePosition = devicePositionService.getPosition(DevicePositionCode.doorOpen); return runAsync(() -> { - CommandFuture deviceCommandSetFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), DeviceCommandGenerator.doorSet(speed)); - CommandUtil.wait(deviceCommandSetFuture); + if (speed != null) { + DeviceCommandBundle doorSetDeviceCommandBundle = DeviceCommandGenerator.doorSet(speed); + CommandFuture doorSetDeviceCommandSetFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), doorSetDeviceCommandBundle); + CommandUtil.wait(doorSetDeviceCommandSetFuture); + } CommandFuture deviceCommandOpenFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), DeviceCommandGenerator.doorMove(devicePosition.getDistance())); CommandUtil.wait(deviceCommandOpenFuture); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStartCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStartCommand.java index 2221c54..10a369d 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStartCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStartCommand.java @@ -27,16 +27,16 @@ public class DebugFanStartCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr); return runAsync(() -> { - String index = cmdDTO.getStringParam("index"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(index); DeviceCommandBundle deviceCommand; - switch (heatModuleId) { + switch (heatModuleCode) { case heat_module_01 -> deviceCommand = DeviceCommandGenerator.fan1Open(); case heat_module_02 -> deviceCommand = DeviceCommandGenerator.fan2Open(); case heat_module_03 -> deviceCommand = DeviceCommandGenerator.fan3Open(); case heat_module_04 -> deviceCommand = DeviceCommandGenerator.fan4Open(); - default -> throw new RuntimeException("index 未找到"); + default -> throw new RuntimeException("heatModuleCode 未找到"); } CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStopCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStopCommand.java index 3b1879d..6d69186 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStopCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugFanStopCommand.java @@ -27,16 +27,16 @@ public class DebugFanStopCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr); return runAsync(() -> { - String index = cmdDTO.getStringParam("index"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(index); DeviceCommandBundle deviceCommand; - switch (heatModuleId) { + switch (heatModuleCode) { case heat_module_01 -> deviceCommand = DeviceCommandGenerator.fan1Close(); case heat_module_02 -> deviceCommand = DeviceCommandGenerator.fan2Close(); case heat_module_03 -> deviceCommand = DeviceCommandGenerator.fan3Close(); case heat_module_04 -> deviceCommand = DeviceCommandGenerator.fan4Close(); - default -> throw new RuntimeException("index 未找到"); + default -> throw new RuntimeException("heatModuleCode 未找到"); } CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStartCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStartCommand.java index 1e4deff..d26394a 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStartCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStartCommand.java @@ -27,17 +27,17 @@ public class DebugHeaterStartCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + Double temperature = cmdDTO.getDoubleParam("temperature"); + HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr); return runAsync(() -> { - String index = cmdDTO.getStringParam("index"); - Double temperature = cmdDTO.getDoubleParam("temperature"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(index); DeviceCommandBundle deviceCommand; - switch (heatModuleId) { + switch (heatModuleCode) { case heat_module_01 -> deviceCommand = DeviceCommandGenerator.heatRod1Open(temperature); case heat_module_02 -> deviceCommand = DeviceCommandGenerator.heatRod2Open(temperature); case heat_module_03 -> deviceCommand = DeviceCommandGenerator.heatRod3Open(temperature); case heat_module_04 -> deviceCommand = DeviceCommandGenerator.heatRod4Open(temperature); - default -> throw new RuntimeException("index 未找到"); + default -> throw new RuntimeException("heatModuleCode 未找到"); } CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStopCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStopCommand.java index 68a4b5f..10abf13 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStopCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugHeaterStopCommand.java @@ -27,16 +27,16 @@ public class DebugHeaterStopCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + String heatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr); return runAsync(() -> { - String index = cmdDTO.getStringParam("index"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(index); DeviceCommandBundle deviceCommand; - switch (heatModuleId) { + switch (heatModuleCode) { case heat_module_01 -> deviceCommand = DeviceCommandGenerator.heatRod1Close(); case heat_module_02 -> deviceCommand = DeviceCommandGenerator.heatRod2Close(); case heat_module_03 -> deviceCommand = DeviceCommandGenerator.heatRod3Close(); case heat_module_04 -> deviceCommand = DeviceCommandGenerator.heatRod4Close(); - default -> throw new RuntimeException("index 未找到"); + default -> throw new RuntimeException("heatModuleCode 未找到"); } CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveByCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveByCommand.java index f4e35d3..ddb4f3b 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveByCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveByCommand.java @@ -28,14 +28,12 @@ public class DebugLiquidMotorMoveByCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { this.stop = false; + Double distance = cmdDTO.getDoubleParam("distance"); + Double speed = cmdDTO.getDoubleParam("speed"); + Integer times = cmdDTO.getIntegerParam("times"); return runAsync(() -> { - Double distance = cmdDTO.getDoubleParam("distance"); - - Double speed = cmdDTO.getDoubleParam("speed"); - Integer times = cmdDTO.getIntegerParam("times"); - if (speed != null) { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidSet(speed); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorSet(speed); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); } @@ -45,26 +43,24 @@ public class DebugLiquidMotorMoveByCommand extends BaseCommandHandler { return; } if (distance != null) { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidMoveBy(distance); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorMoveBy(distance); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); } if (distance != null) { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidMoveBy(-distance); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorMoveBy(-distance); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); } } } else { if (distance != null) { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidMoveBy(distance); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorMoveBy(distance); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); } } - - }); } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveToCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveToCommand.java index 86d519f..8d19818 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveToCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorMoveToCommand.java @@ -24,16 +24,18 @@ import java.util.concurrent.CompletableFuture; public class DebugLiquidMotorMoveToCommand extends BaseCommandHandler { private final DeviceCommandService deviceCommandService; - @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { - double position = cmdDTO.getDoubleParam("position"); - double speed = cmdDTO.getDoubleParam("speed"); + Double position = cmdDTO.getDoubleParam("position"); + Double speed = cmdDTO.getDoubleParam("speed"); return runAsync(() -> { - CommandFuture deviceSetCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), DeviceCommandGenerator.motorLiquidSet(speed)); - CommandUtil.wait(deviceSetCommandFuture); - CommandFuture deviceMoveCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), DeviceCommandGenerator.motorLiquidMove(position)); - CommandUtil.wait(deviceMoveCommandFuture); + DeviceCommandBundle liquidMotorSetDeviceCommandBundle = DeviceCommandGenerator.liquidMotorSet(speed); + CommandFuture liquidMotorSetDeviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidMotorSetDeviceCommandBundle); + CommandUtil.wait(liquidMotorSetDeviceCommandFuture); + + DeviceCommandBundle liquidMotorMoveDeviceCommandBundle = DeviceCommandGenerator.liquidMotorMove(position); + CommandFuture liquidMotorMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidMotorMoveDeviceCommandBundle); + CommandUtil.wait(liquidMotorMoveDeviceCommandFuture); }); } } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorOriginCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorOriginCommand.java index 19eac4a..7d5e6b4 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorOriginCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorOriginCommand.java @@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; import java.util.concurrent.CompletableFuture; /** - * 加液位电机复位 + * 加液位电机回原点 */ @Slf4j @Component diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorStopCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorStopCommand.java index 8638977..ac8bc3d 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorStopCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidMotorStopCommand.java @@ -27,7 +27,7 @@ public class DebugLiquidMotorStopCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidStop(); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorStop(); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); CommandUtil.wait(deviceCommandFuture); }); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpMoveByCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpMoveByCommand.java index 022ec74..066145d 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpMoveByCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpMoveByCommand.java @@ -28,12 +28,10 @@ public class DebugLiquidPumpMoveByCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { this.stop = false; + Double distance = cmdDTO.getDoubleParam("distance"); + Double speed = cmdDTO.getDoubleParam("speed"); + Integer times = cmdDTO.getIntegerParam("times"); return runAsync(() -> { - Double distance = cmdDTO.getDoubleParam("distance"); - - Double speed = cmdDTO.getDoubleParam("speed"); - Integer times = cmdDTO.getIntegerParam("times"); - if (speed != null) { DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidPumpSet(speed); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpStartCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpStartCommand.java index 60b0cc1..c17fd83 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpStartCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidPumpStartCommand.java @@ -27,11 +27,11 @@ public class DebugLiquidPumpStartCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { + Double speed = cmdDTO.getDoubleParam("speed"); + String direction = cmdDTO.getStringParam("direction");//front back 正转倒转 + Integer channel = 1; + CmdDirection cmdDirection = CmdDirection.valueOf(direction); return runAsync(() -> { - Double speed = cmdDTO.getDoubleParam("speed"); - String direction = cmdDTO.getStringParam("direction");//front back 正转倒转 - Integer channel = 1; - CmdDirection cmdDirection = CmdDirection.valueOf(direction); DeviceCommandBundle deviceCommand; if (speed != null) { deviceCommand = DeviceCommandGenerator.liquidPumpStart(cmdDirection); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThickCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThickCommand.java new file mode 100644 index 0000000..40466fc --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThickCommand.java @@ -0,0 +1,36 @@ +package com.iflytop.sgs.app.cmd.debug; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceCommandService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.cmd.CommandFuture; +import com.iflytop.sgs.common.cmd.DeviceCommandBundle; +import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; +import com.iflytop.sgs.common.utils.CommandUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 阀转换到浓硝酸通道 todo 需要与小何确定次序 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_valve_open_thick") +public class DebugLiquidValveOpenThickCommand extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(1); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + CommandUtil.wait(deviceCommandFuture); + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThinCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThinCommand.java new file mode 100644 index 0000000..774355f --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenThinCommand.java @@ -0,0 +1,36 @@ +package com.iflytop.sgs.app.cmd.debug; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceCommandService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.cmd.CommandFuture; +import com.iflytop.sgs.common.cmd.DeviceCommandBundle; +import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; +import com.iflytop.sgs.common.utils.CommandUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 阀转换到稀硝酸通道 todo 需要与小何确定次序 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_valve_open_thin") +public class DebugLiquidValveOpenThinCommand extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(2); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + CommandUtil.wait(deviceCommandFuture); + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenVacantCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenVacantCommand.java new file mode 100644 index 0000000..0630ccf --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenVacantCommand.java @@ -0,0 +1,36 @@ +package com.iflytop.sgs.app.cmd.debug; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceCommandService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.cmd.CommandFuture; +import com.iflytop.sgs.common.cmd.DeviceCommandBundle; +import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; +import com.iflytop.sgs.common.utils.CommandUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 阀转换到空通道 todo 需要与小何确定次序 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_valve_open_vacant") +public class DebugLiquidValveOpenVacantCommand extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveClose(); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + CommandUtil.wait(deviceCommandFuture); + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWasteCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWasteCommand.java new file mode 100644 index 0000000..6073247 --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWasteCommand.java @@ -0,0 +1,36 @@ +package com.iflytop.sgs.app.cmd.debug; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceCommandService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.cmd.CommandFuture; +import com.iflytop.sgs.common.cmd.DeviceCommandBundle; +import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; +import com.iflytop.sgs.common.utils.CommandUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 阀转换到废液通道 todo 需要与小何确定次序 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_valve_open_waste") +public class DebugLiquidValveOpenWasteCommand extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(4); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + CommandUtil.wait(deviceCommandFuture); + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWaterCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWaterCommand.java new file mode 100644 index 0000000..046fa9b --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugLiquidValveOpenWaterCommand.java @@ -0,0 +1,36 @@ +package com.iflytop.sgs.app.cmd.debug; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceCommandService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import com.iflytop.sgs.common.cmd.CommandFuture; +import com.iflytop.sgs.common.cmd.DeviceCommandBundle; +import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; +import com.iflytop.sgs.common.utils.CommandUtil; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 阀转换到蒸馏水通道 todo 需要与小何确定次序 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_valve_open_water") +public class DebugLiquidValveOpenWaterCommand extends BaseCommandHandler { + private final DeviceCommandService deviceCommandService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(3); + CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); + CommandUtil.wait(deviceCommandFuture); + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveByCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveByCommand.java index 20a4559..31ddcad 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveByCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveByCommand.java @@ -28,14 +28,10 @@ public class DebugMotorXMoveByCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { this.stop = false; + Double distance = cmdDTO.getDoubleParam("distance"); + Double speed = cmdDTO.getDoubleParam("speed"); + Integer times = cmdDTO.getIntegerParam("times"); return runAsync(() -> { - Double distance = cmdDTO.getDoubleParam("distance"); - - - Double speed = cmdDTO.getDoubleParam("speed"); - - Integer times = cmdDTO.getIntegerParam("times"); - if (speed != null) { DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferXSet(speed); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveToCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveToCommand.java index 93bbf7e..c92cd35 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveToCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorXMoveToCommand.java @@ -26,7 +26,7 @@ public class DebugMotorXMoveToCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { - double position = cmdDTO.getDoubleParam("position"); + Double position = cmdDTO.getDoubleParam("position"); return runAsync(() -> { DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferXMove(position); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveByCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveByCommand.java index 488fa64..6ac745b 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveByCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveByCommand.java @@ -28,13 +28,10 @@ public class DebugMotorZMoveByCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { this.stop = false; + Double distance = cmdDTO.getDoubleParam("distance"); + Double speed = cmdDTO.getDoubleParam("speed"); + Integer times = cmdDTO.getIntegerParam("times"); return runAsync(() -> { - Double distance = cmdDTO.getDoubleParam("distance"); - - Double speed = cmdDTO.getDoubleParam("speed"); - Integer times = cmdDTO.getIntegerParam("times"); - - if (speed != null) { DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZSet(speed); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); @@ -65,7 +62,6 @@ public class DebugMotorZMoveByCommand extends BaseCommandHandler { } - }); } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveToCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveToCommand.java index 46308e8..e773d8d 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveToCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugMotorZMoveToCommand.java @@ -27,7 +27,7 @@ public class DebugMotorZMoveToCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { - double position = cmdDTO.getDoubleParam("position"); + Double position = cmdDTO.getDoubleParam("position"); return runAsync(() -> { DeviceCommandBundle deviceCommand = DeviceCommandGenerator.transferZMove(position); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThickCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThickCommand.java deleted file mode 100644 index 3d124e2..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThickCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.sgs.app.cmd.debug; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceCommandService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import com.iflytop.sgs.common.cmd.CommandFuture; -import com.iflytop.sgs.common.cmd.DeviceCommandBundle; -import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; -import com.iflytop.sgs.common.utils.CommandUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 阀转换到浓硝酸通道 todo 需要与小何确定次序 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("valve_switch_thick") -public class DebugValveSwitchThickCommand extends BaseCommandHandler { - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(1); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThinCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThinCommand.java deleted file mode 100644 index d82d807..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchThinCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.sgs.app.cmd.debug; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceCommandService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import com.iflytop.sgs.common.cmd.CommandFuture; -import com.iflytop.sgs.common.cmd.DeviceCommandBundle; -import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; -import com.iflytop.sgs.common.utils.CommandUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 阀转换到稀硝酸通道 todo 需要与小何确定次序 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("valve_switch_thin") -public class DebugValveSwitchThinCommand extends BaseCommandHandler { - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(2); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchVacantCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchVacantCommand.java deleted file mode 100644 index 4dee67c..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchVacantCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.sgs.app.cmd.debug; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceCommandService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import com.iflytop.sgs.common.cmd.CommandFuture; -import com.iflytop.sgs.common.cmd.DeviceCommandBundle; -import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; -import com.iflytop.sgs.common.utils.CommandUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 阀转换到空通道 todo 需要与小何确定次序 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("valve_switch_vacant") -public class DebugValveSwitchVacantCommand extends BaseCommandHandler { - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveClose(); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWasteCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWasteCommand.java deleted file mode 100644 index 6673fc1..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWasteCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.sgs.app.cmd.debug; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceCommandService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import com.iflytop.sgs.common.cmd.CommandFuture; -import com.iflytop.sgs.common.cmd.DeviceCommandBundle; -import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; -import com.iflytop.sgs.common.utils.CommandUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 阀转换到废液通道 todo 需要与小何确定次序 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("valve_switch_waste") -public class DebugValveSwitchWasteCommand extends BaseCommandHandler { - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(4); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWaterCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWaterCommand.java deleted file mode 100644 index 319d153..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/debug/DebugValveSwitchWaterCommand.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.iflytop.sgs.app.cmd.debug; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceCommandService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import com.iflytop.sgs.common.cmd.CommandFuture; -import com.iflytop.sgs.common.cmd.DeviceCommandBundle; -import com.iflytop.sgs.common.cmd.DeviceCommandGenerator; -import com.iflytop.sgs.common.utils.CommandUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 阀转换到蒸馏水通道 todo 需要与小何确定次序 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("valve_switch_water") -public class DebugValveSwitchWaterCommand extends BaseCommandHandler { - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.valveTurn(3); - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdDTO.getCommandId(), cmdDTO.getCommand(), deviceCommand); - CommandUtil.wait(deviceCommandFuture); - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java b/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java index ffffdf1..0bcf39e 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/module/SolutionModuleService.java @@ -97,7 +97,7 @@ public class SolutionModuleService { * 加液机械臂移动到指定点 */ public void motorLiquidMove(String cmdId, String cmdCode, double position) throws Exception { - DeviceCommandBundle deviceCommand = DeviceCommandGenerator.motorLiquidMove(position); + DeviceCommandBundle deviceCommand = DeviceCommandGenerator.liquidMotorMove(position); CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, deviceCommand); CommandUtil.wait(deviceCommandFuture); } diff --git a/src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandGenerator.java b/src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandGenerator.java index e3213a2..2891000 100644 --- a/src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandGenerator.java +++ b/src/main/java/com/iflytop/sgs/common/cmd/DeviceCommandGenerator.java @@ -86,7 +86,7 @@ public class DeviceCommandGenerator { * * @param speed 速度 单位 mm/s */ - public static DeviceCommandBundle motorLiquidSet(Double speed) { + public static DeviceCommandBundle liquidMotorSet(Double speed) { DeviceCommandParams params = new DeviceCommandParams(); params.setSpeed(speed); return setInfoCmd(CmdDevice.liquid_motor, CmdAction.set, params, "加液臂电机设置参数"); @@ -178,7 +178,7 @@ public class DeviceCommandGenerator { /** * 加液位电机停止 */ - public static DeviceCommandBundle motorLiquidStop() { + public static DeviceCommandBundle liquidMotorStop() { return controlMotorCmd(CmdDevice.liquid_motor, CmdAction.stop, null, "加液位电机 停止"); } @@ -187,7 +187,7 @@ public class DeviceCommandGenerator { * * @param position 位置 单位 mm */ - public static DeviceCommandBundle motorLiquidMove(Double position) { + public static DeviceCommandBundle liquidMotorMove(Double position) { DeviceCommandParams params = new DeviceCommandParams(); params.setPosition(position); return controlMotorCmd(CmdDevice.liquid_motor, CmdAction.move, params, "加液升降电机移动"); @@ -198,7 +198,7 @@ public class DeviceCommandGenerator { * * @param position 加液量 单位mL */ - public static DeviceCommandBundle motorLiquidMoveBy(Double position) { + public static DeviceCommandBundle liquidMotorMoveBy(Double position) { DeviceCommandParams params = new DeviceCommandParams(); params.setPosition(position); return controlCmd(CmdDevice.liquid_motor, CmdAction.move_by, params, "加液机械臂 相对移动"); @@ -216,10 +216,10 @@ public class DeviceCommandGenerator { } /** - * 加液泵 泵1旋转 + * 加液泵旋转 * */ - public static DeviceCommandBundle acidPump1Rotate(CmdDirection direction) { + public static DeviceCommandBundle liquidPumpRotate(CmdDirection direction) { DeviceCommandParams params = new DeviceCommandParams(); params.setDirection(direction); return setInfoCmd(CmdDevice.liquid_pump, CmdAction.rotate, params, "加液泵 旋转");