From 95d0cae71136f1688159d48c2b046fb9add0ba3c 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 21:11:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=9A=E5=8A=A1=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=EF=BC=8C=E7=A7=BB=E8=87=B3=E5=8A=A0=E7=83=AD=E3=80=81?= =?UTF-8?q?=E5=8A=A0=E6=B6=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgs/app/cmd/control/LiquidAddCommand.java | 32 ++++++++++ .../sgs/app/cmd/control/LiquidReduceCommand.java | 31 +++++++++ .../sgs/app/cmd/control/MoveToHeatAreaCommand.java | 69 +++++++------------- .../app/cmd/control/MoveToLiquidAreaCommand.java | 74 ++++++++++------------ .../sgs/app/cmd/control/SolutionAddCommand.java | 32 ---------- .../sgs/app/cmd/control/SolutionReduceCommand.java | 31 --------- .../app/model/bo/status/device/DeviceState.java | 12 ++++ .../service/device/module/HeatModuleService.java | 3 + 8 files changed, 134 insertions(+), 150 deletions(-) create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java create mode 100644 src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/control/SolutionAddCommand.java delete mode 100644 src/main/java/com/iflytop/sgs/app/cmd/control/SolutionReduceCommand.java diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java new file mode 100644 index 0000000..3d06747 --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java @@ -0,0 +1,32 @@ +package com.iflytop.sgs.app.cmd.control; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceStateService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 添加溶液 todo wmy 需要记录托盘每一行的坐标 机械臂移动成功后 调动泵机加液 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_add")//业务指令注解 +public class LiquidAddCommand extends BaseCommandHandler { + private final SolutionModuleService solutionModuleService; + private final DeviceStateService deviceStateService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java new file mode 100644 index 0000000..54c346a --- /dev/null +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidReduceCommand.java @@ -0,0 +1,31 @@ +package com.iflytop.sgs.app.cmd.control; + +import com.iflytop.sgs.app.core.BaseCommandHandler; +import com.iflytop.sgs.app.model.dto.CmdDTO; +import com.iflytop.sgs.app.service.device.DeviceStateService; +import com.iflytop.sgs.app.service.device.module.SolutionModuleService; +import com.iflytop.sgs.common.annotation.CommandMapping; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.concurrent.CompletableFuture; + +/** + * 抽取溶液 todo wmy 需要记录托盘每一行的坐标 机械臂移动成功后 调动泵机抽液体 + */ +@Slf4j +@Component +@RequiredArgsConstructor +@CommandMapping("liquid_reduce")//业务指令注解 +public class LiquidReduceCommand extends BaseCommandHandler { + private final SolutionModuleService solutionModuleService; + private final DeviceStateService deviceStateService; + + @Override + public CompletableFuture handle(CmdDTO cmdDTO) { + return runAsync(() -> { + }); + } +} + diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java index 6cd0981..460f23f 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToHeatAreaCommand.java @@ -1,10 +1,7 @@ package com.iflytop.sgs.app.cmd.control; -import cn.hutool.core.lang.Assert; import com.iflytop.sgs.app.core.BaseCommandHandler; import com.iflytop.sgs.app.model.bo.Point3D; -import com.iflytop.sgs.app.model.bo.status.device.HeatModuleState; -import com.iflytop.sgs.app.model.bo.status.device.SolutionModuleState; import com.iflytop.sgs.app.model.dto.CmdDTO; import com.iflytop.sgs.app.service.api.DevicePositionService; import com.iflytop.sgs.app.service.device.DeviceStateService; @@ -14,8 +11,6 @@ import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.enums.HeatModuleCode; import com.iflytop.sgs.common.enums.data.DevicePositionCode; -import com.iflytop.sgs.common.exception.AppException; -import com.iflytop.sgs.common.result.ResultCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -23,7 +18,7 @@ import org.springframework.stereotype.Component; import java.util.concurrent.CompletableFuture; /** - * 移至加热 todo wmy 需要改 + * 将上料区托盘或者机械臂上的托盘移至目标加热模块 */ @Slf4j @Component @@ -39,49 +34,31 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { - if (deviceStateService.getCommandMutexState().get().isMoveToHeatAreaCommandExecuting()) { - throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING); + if (!deviceStateService.getDeviceState().getTransferModule().isTrayStatus()) { //判断机械臂上是否有托盘 + //TODO 判断目标加热模块传感器是否有托盘,如果有托盘的话提示错误 } - if (deviceStateService.getCommandMutexState().get().isMoveToSolutionAreaCommandExecuting()) { - throw new AppException(ResultCode.CMD_BUSY); - } - try { - deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(true); - } catch (Exception e) { - deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(false); - throw e; - } - String heatId = cmdDTO.getStringParam("heatId"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(heatId); - HeatModuleState heatModuleState=deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleId); - SolutionModuleState solutionModuleState=deviceStateService.getDeviceState().getSolutionModule(); - //判断泵现在处于关闭状态 - Assert.isTrue(solutionModuleState.isPumping(),"蠕动泵正在运行,无法转移"); - //转运模块Z轴拿取托盘时起下降的高度位置 - Point3D transferModuleZPickTrayDownPositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZPickTrayDownPositon).getPoint3D(); - //转运模块Z轴移动托盘时起托盘的高度位置 - Point3D transferModuleZTrayUpMovePositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZTrayUpMovePositon).getPoint3D(); - //转运模块X轴拿取托盘进出卡槽移动距离 - double transferModuleXPickTrayMoveDistance=devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance(); - //获取指定加热模块上方点位 - Point3D heatAreaTrayPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(heatModuleId); + + String targetHeatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode targetHeatModuleCode = HeatModuleCode.valueOf(targetHeatModuleCodeStr);//目标加热模块 + + Point3D targetHeatModuleTrayClawPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(targetHeatModuleCode);//获取目标加热模块托盘夹取点 + Double transferModuleXPickTrayMoveDistance = devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance();//获取转运模块X轴拿取托盘进出卡槽移动距离 + Double transferModuleZPickTrayDownPositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZPickTrayDownPositon).getPositon();//获取转运模块Z轴拿取托盘时下降的高度位置 + Point3D feedAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.feedAreaTrayPoint).getPoint3D();//获取上料区托盘夹爪位置点 + return runAsync(() -> { - try { - //升高加液电机高度 回0点 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0); - //移动机械臂到加热区上方 此时机械臂夹着托盘 - transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaTrayPoint3D); - //下降z轴 - transferModuleService.transferZMove(transferModuleZPickTrayDownPositon.getZ()); - //移动x轴向右脱离托盘 - transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance); - //z轴返回0点 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(),0); - //设置加热区有托盘 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleId).setTrayStatus(true); - } finally { - deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(false); + if (!deviceStateService.getDeviceState().getTransferModule().isTrayStatus()) { //判断机械臂上是否有托盘 + //机械臂上无托盘,取上料区托盘 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至上料区托盘夹取点 + 进出卡槽移动距离 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 } + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getX());//将X轴移动至目标加热模块托盘夹取点 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleXPickTrayMoveDistance);//X轴移出卡槽 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(true);//设置目标加热区有托盘 }); } } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java index 8b2527b..8091ef6 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java @@ -2,8 +2,6 @@ package com.iflytop.sgs.app.cmd.control; import com.iflytop.sgs.app.core.BaseCommandHandler; import com.iflytop.sgs.app.model.bo.Point3D; -import com.iflytop.sgs.app.model.bo.status.device.HeatModuleState; -import com.iflytop.sgs.app.model.bo.status.device.SolutionModuleState; import com.iflytop.sgs.app.model.dto.CmdDTO; import com.iflytop.sgs.app.service.api.DevicePositionService; import com.iflytop.sgs.app.service.device.DeviceStateService; @@ -13,8 +11,6 @@ import com.iflytop.sgs.app.service.device.module.TransferModuleService; import com.iflytop.sgs.common.annotation.CommandMapping; import com.iflytop.sgs.common.enums.HeatModuleCode; import com.iflytop.sgs.common.enums.data.DevicePositionCode; -import com.iflytop.sgs.common.exception.AppException; -import com.iflytop.sgs.common.result.ResultCode; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -30,7 +26,6 @@ import java.util.concurrent.CompletableFuture; @CommandMapping("move_to_liquid_area")//业务指令注解 public class MoveToLiquidAreaCommand extends BaseCommandHandler { private final HeatModuleService heatModuleService; - private final SolutionModuleService solutionModuleService; private final TransferModuleService transferModuleService; private final DevicePositionService devicePositionService; @@ -38,45 +33,42 @@ public class MoveToLiquidAreaCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) throws Exception { - if (deviceStateService.getCommandMutexState().get().isMoveToSolutionAreaCommandExecuting()) { - throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING); + String targetHeatModuleCodeStr = cmdDTO.getStringParam("heatModuleCode"); + HeatModuleCode targetHeatModuleCode;//目标加热模块 + if (targetHeatModuleCodeStr != null) {//目标加热模块非必填,如果没有传递目标加热模块则尝试获取上料区是否有托盘 + targetHeatModuleCode = HeatModuleCode.valueOf(targetHeatModuleCodeStr); + }else{ + targetHeatModuleCode = null; + //TODO 尝试获取上料区是否有托盘,如果没有托盘则提示错误 } - if (deviceStateService.getCommandMutexState().get().isMoveToHeatAreaCommandExecuting()) { - throw new AppException(ResultCode.CMD_BUSY); - } - String heatId = cmdDTO.getStringParam("heatId"); - HeatModuleCode heatModuleId = HeatModuleCode.valueOf(heatId); - HeatModuleState heatModuleState=deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleId); - SolutionModuleState solutionModuleState=deviceStateService.getDeviceState().getSolutionModule(); - //转运模块Z轴拿取托盘时起下降的高度位置 - Point3D transferModuleZPickTrayDownPositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZPickTrayDownPositon).getPoint3D(); - //转运模块Z轴移动托盘时起托盘的高度位置 - Point3D transferModuleZTrayUpMovePositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZTrayUpMovePositon).getPoint3D(); - //转运模块X轴拿取托盘进出卡槽移动距离 - double transferModuleXPickTrayMoveDistance=devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance(); - //获取指定加热模块上方点位 - Point3D heatAreaTrayPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(heatModuleId); - //获取加液区上方点位 - Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); + + Point3D targetHeatModuleTrayClawPoint3D = heatModuleService.getHeatModuleTrayClawPoint3D(targetHeatModuleCode);//获取目标加热模块托盘夹取点 + Double transferModuleXPickTrayMoveDistance = devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance();//获取转运模块X轴拿取托盘进出卡槽移动距离 + Double transferModuleZPickTrayDownPositon = devicePositionService.getPosition(DevicePositionCode.transferModuleZPickTrayDownPositon).getPositon();//获取转运模块Z轴拿取托盘时下降的高度位置 + Point3D feedAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.feedAreaTrayPoint).getPoint3D();//获取上料区托盘夹爪位置点 + Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液时托盘位置点 + return runAsync(() -> { - try { - //升高加液电机高度 回0点 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0); - //移动机械臂到加热区上方 此时机械臂夹着托盘 - transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatAreaTrayPoint3D); - //下降z轴 - transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(),transferModuleZPickTrayDownPositon.getZ()); - //移动x轴向左托起托盘 - transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleXPickTrayMoveDistance); - //z轴返回0点 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(),0); - //移动到建邺区 - transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint); - //设置加液区有托盘 todo - //deviceStateService.getDeviceState().getSolutionModule().setTrayStatus(1); - } finally { - deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(false); + if(targetHeatModuleCode == null){ + //获取上料区托盘 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至上料区托盘夹取点 + 进出卡槽移动距离 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + deviceStateService.getDeviceState().getSolutionModule().setFeedAreaTrayStatus(false);//设定上料区托盘状态 + deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInFeedArea(false);//设定托盘不在上料区中 + }else{ + //获取目标加热模块托盘 + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至目标加热模块托盘夹取点 + 进出卡槽移动距离 + transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleZPickTrayDownPositon);//Z轴下降至夹取点,使托盘落入石墨加热盘 + transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(false);//设定目标加热模块托盘状态 + deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInHeatModule(false);//设定托盘不在加热模块中 } + transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D.getX());//将X轴移动至加液时托盘位置点 + deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInSolutionPositon(true);//设定托盘在加液位中 + }); } } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionAddCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionAddCommand.java deleted file mode 100644 index a7e682a..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionAddCommand.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.iflytop.sgs.app.cmd.control; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceStateService; -import com.iflytop.sgs.app.service.device.module.SolutionModuleService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 添加溶液 todo wmy 需要记录托盘每一行的坐标 机械臂移动成功后 调动泵机加液 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("solution_add")//业务指令注解 -public class SolutionAddCommand extends BaseCommandHandler { - private final SolutionModuleService solutionModuleService; - private final DeviceStateService deviceStateService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionReduceCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionReduceCommand.java deleted file mode 100644 index f13a3e6..0000000 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/SolutionReduceCommand.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.iflytop.sgs.app.cmd.control; - -import com.iflytop.sgs.app.core.BaseCommandHandler; -import com.iflytop.sgs.app.model.dto.CmdDTO; -import com.iflytop.sgs.app.service.device.DeviceStateService; -import com.iflytop.sgs.app.service.device.module.SolutionModuleService; -import com.iflytop.sgs.common.annotation.CommandMapping; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.concurrent.CompletableFuture; - -/** - * 抽取溶液 todo wmy 需要记录托盘每一行的坐标 机械臂移动成功后 调动泵机抽液体 - */ -@Slf4j -@Component -@RequiredArgsConstructor -@CommandMapping("solution_reduce")//业务指令注解 -public class SolutionReduceCommand extends BaseCommandHandler { - private final SolutionModuleService solutionModuleService; - private final DeviceStateService deviceStateService; - - @Override - public CompletableFuture handle(CmdDTO cmdDTO) { - return runAsync(() -> { - }); - } -} - diff --git a/src/main/java/com/iflytop/sgs/app/model/bo/status/device/DeviceState.java b/src/main/java/com/iflytop/sgs/app/model/bo/status/device/DeviceState.java index e560bd0..7a773dc 100644 --- a/src/main/java/com/iflytop/sgs/app/model/bo/status/device/DeviceState.java +++ b/src/main/java/com/iflytop/sgs/app/model/bo/status/device/DeviceState.java @@ -59,4 +59,16 @@ public class DeviceState { return null; } + /** + * 根据指定加热模块获取所属托盘 + */ + public synchronized TrayState getTrayIn(HeatModuleCode heatModuleCode) { + for (TrayState t : trays) { + if (heatModuleCode.equals(t.getHeatModuleCode())) { + return t; + } + } + return null; + } + } diff --git a/src/main/java/com/iflytop/sgs/app/service/device/module/HeatModuleService.java b/src/main/java/com/iflytop/sgs/app/service/device/module/HeatModuleService.java index 55eeae4..38d5d01 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/module/HeatModuleService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/module/HeatModuleService.java @@ -70,6 +70,9 @@ public class HeatModuleService { * 获取指定加热区托盘夹爪点位 */ public Point3D getHeatModuleTrayClawPoint3D(HeatModuleCode heatModuleId) { + if(heatModuleId == null){ + return null; + } DevicePosition devicePosition = switch (heatModuleId) { case heat_module_01 -> devicePositionService.getPosition(DevicePositionCode.heatArea1TrayClawPoint); case heat_module_02 -> devicePositionService.getPosition(DevicePositionCode.heatArea2TrayClawPoint);