From 32024bcfc006985f542a3281023084b13a717131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Sun, 1 Jun 2025 22:43:00 +0800 Subject: [PATCH] 1 --- .../command/control/FilledSolutionStopCommand.java | 31 ++++++-------- .../gd/app/command/control/HeatStartCommand.java | 2 +- .../gd/app/command/control/HeatStopCommand.java | 2 +- .../app/command/control/MoveToHeatAreaCommand.java | 10 ++--- .../command/control/MoveToSolutionAreaCommand.java | 6 +-- .../gd/app/command/control/SolutionAddCommand.java | 24 ++++------- .../gd/app/command/control/TrayDownCommand.java | 11 +++++ .../iflytop/gd/app/controller/TestController.java | 12 +++--- .../model/bo/status/device/HeatModuleState.java | 16 +------ .../iflytop/gd/app/service/api/TestService.java | 7 ++++ .../gd/app/service/crafts/CraftsStepService.java | 7 +++- .../device/module/SolutionModuleService.java | 49 +++++++--------------- .../scheduled/FetchTemperatureScheduledTask.java | 16 ++++--- .../com/iflytop/gd/common/enums/HeatingType.java | 16 +------ .../com/iflytop/gd/common/result/ResultCode.java | 1 + 15 files changed, 86 insertions(+), 124 deletions(-) diff --git a/src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStopCommand.java b/src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStopCommand.java index d302ce7..3f0513c 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStopCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/FilledSolutionStopCommand.java @@ -1,5 +1,6 @@ package com.iflytop.gd.app.command.control; +import cn.hutool.json.JSONArray; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.app.service.api.ContainerService; @@ -26,26 +27,18 @@ public class FilledSolutionStopCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { return runAsync(() -> { -// JSONArray idJsonArray = cmdDTO.getJSONArrayParam("list"); -// for (int i = 0; i < idJsonArray.size(); i++) { -// String idStr = idJsonArray.getStr(i); -// CompletableFuture.runAsync(() -> { -// try { -// AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(Long.parseLong(idStr)); -// solutionModuleService.acidPumpStop(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice); -// } catch (Exception e) { -// log.error("停止预充失败", e); -// } -// }); -// } - for (AcidPumpDeviceCode acidPumpDeviceCode : AcidPumpDeviceCode.values()) { - try { - solutionModuleService.acidPumpStop(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDeviceCode); - } catch (Exception e) { - log.error("停止预充错误", e); - } + JSONArray idJsonArray = cmdDTO.getJSONArrayParam("list"); + for (int i = 0; i < idJsonArray.size(); i++) { + String idStr = idJsonArray.getStr(i); + CompletableFuture.runAsync(() -> { + try { + AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(Long.parseLong(idStr)); + solutionModuleService.acidPumpStop(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice); + } catch (Exception e) { + log.error("停止预充失败", e); + } + }); } - Thread.sleep(1000); solutionModuleService.dualRobotOrigin(); }); } diff --git a/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java b/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java index 446c97e..85e2591 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/HeatStartCommand.java @@ -32,7 +32,7 @@ public class HeatStartCommand extends BaseCommandHandler { double temperature = deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTemperature(); //开启加热 heatModuleService.heatRodOpen(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, temperature); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(true); +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(true); }); } } diff --git a/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java b/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java index 8c8a69d..5676e80 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/HeatStopCommand.java @@ -30,7 +30,7 @@ public class HeatStopCommand extends BaseCommandHandler { return runAsync(() -> { //关闭加热 heatModuleService.heatRodClose(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode); - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(false); +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setHeating(false); }); } } diff --git a/src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java b/src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java index d5c4527..802fb4a 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/MoveToHeatAreaCommand.java @@ -69,10 +69,10 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler { //校验目标加热位是否有托盘 try { deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(true); - Boolean heatModuleTray = heatModuleService.heatModuleSensorState(heatModuleCode); - if (heatModuleTray) { +// Boolean heatModuleTray = heatModuleService.heatModuleSensorState(heatModuleCode); +// if (heatModuleTray) { // throw new AppException(ResultCode.TARGET_HEAT_MODULE_OCCUPIED); - } +// } } catch (Exception e) { deviceStateService.getCommandMutexState().get().setMoveToHeatAreaCommandExecuting(false); throw e; @@ -109,8 +109,8 @@ public class MoveToHeatAreaCommand extends BaseCommandHandler { gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//抬升z轴 // trayState.setHeatModuleId(heatModuleId); // trayState.setInHeatModule(true); - heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLower);//下降加热模块托盘 - deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 +// heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLower);//下降加热模块托盘 +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0);//加热模块托盘升降状态 capModuleService.capUpBalance(cmdDTO.getCommandId(), cmdDTO.getCommand()); //提升拍子存放区 gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), capStorageCapClawPoint3D);//移动机械臂至拍子存放区上方 } finally { diff --git a/src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java b/src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java index ebcd3b1..5fdf540 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/MoveToSolutionAreaCommand.java @@ -72,10 +72,10 @@ public class MoveToSolutionAreaCommand extends BaseCommandHandler { //校验目标加热位是否有托盘 try { deviceStateService.getCommandMutexState().get().setMoveToSolutionAreaCommandExecuting(true); - Boolean heatModuleTray = heatModuleService.heatModuleSensorState(heatModuleCode); - if (!heatModuleTray) { +// Boolean heatModuleTray = heatModuleService.heatModuleSensorState(heatModuleCode); +// if (!heatModuleTray) { // throw new AppException(ResultCode.TARGET_HEAT_MODULE_NO_TRAY); - } +// } } catch (Exception e) { deviceStateService.getCommandMutexState().get().setMoveToSolutionAreaCommandExecuting(false); throw e; diff --git a/src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java b/src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java index ebcf861..b01ce7e 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/SolutionAddCommand.java @@ -5,7 +5,6 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.model.entity.Container; import com.iflytop.gd.app.service.api.ContainerService; import com.iflytop.gd.app.service.device.DeviceStateService; import com.iflytop.gd.app.service.device.module.SolutionModuleService; @@ -47,13 +46,13 @@ public class SolutionAddCommand extends BaseCommandHandler { || deviceStateService.getCommandMutexState().get().isShakeStartCommandExecuting()) { throw new AppException(ResultCode.CMD_BUSY); } - if (deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() != 1) { + if(deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() != 1){ throw new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY); } deviceStateService.getCommandMutexState().get().setSolutionAddCommandExecuting(true); deviceStateService.getDeviceState().getSolutionModule().setPumping(true); return runAsync(() -> { - try { + try{ JSONArray dataList = JSONUtil.parseArray(cmdDTO.getParams().get("dataList")); for (int i = 0; i < dataList.size(); i++) {//遍历前端传入的加液配置 JSONObject tubeSol = dataList.getJSONObject(i); @@ -67,29 +66,22 @@ public class SolutionAddCommand extends BaseCommandHandler { List futuresList = new ArrayList<>(); for (int k = 0; k < solutionList.size(); k++) { JSONObject addSolution = solutionList.getJSONObject(k); - Long solId = addSolution.getLong("solutionId");//实际前端传递的是容器id + Long solId = addSolution.getLong("solutionId"); Double volume = addSolution.getDouble("volume"); - //AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵 - Container container = containerService.getById(solId); - if (container == null) { - throw new AppException(ResultCode.CONTAINER_NOT_FOUND);//未找到对应溶液容器 + AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵 + if (acidPumpDevice == null) { + throw new AppException(ResultCode.CRAFT_CONTAINER_NOT_FOUND);//未找到对应溶液容器 } - AcidPumpDeviceCode acidPumpDevice = AcidPumpDeviceCode.valueOf(container.getPumpId());//泵 - int scale = container.getScale() == null ? 120 : container.getScale();//系数 -// Integer scale = Optional.ofNullable(container) -// .map(Container::getScale) -// .orElse(500); - CommandFuture deviceCommandFuture = solutionModuleService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, volume * ((double) scale /100));//添加溶液 + CommandFuture deviceCommandFuture = solutionModuleService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, volume);//添加溶液 futuresList.add(deviceCommandFuture); } CommandUtil.wait(futuresList.toArray(new CommandFuture[0])); } } - Thread.sleep(1000); solutionModuleService.dualRobotOrigin(); deviceStateService.getCommandMutexState().get().setSolutionAddCommandExecuting(false); deviceStateService.getDeviceState().getSolutionModule().setPumping(false); - } finally { + }finally { deviceStateService.getCommandMutexState().get().setSolutionAddCommandExecuting(false); } diff --git a/src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java b/src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java index 39f864c..9fba0cb 100644 --- a/src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java +++ b/src/main/java/com/iflytop/gd/app/command/control/TrayDownCommand.java @@ -40,11 +40,22 @@ public class TrayDownCommand extends BaseCommandHandler { HeatModuleCode heatModuleCode = HeatModuleCode.valueOf(heatId); //从数据库获取加热位下降托盘位置 double trayLower = devicePositionService.getPosition(DevicePositionCode.trayLower).getDistance(); + double trayLift = devicePositionService.getPosition(DevicePositionCode.trayLift).getDistance(); return runAsync(() -> { try { //下降加热位托盘 heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLower); deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(0); + if (deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getHeatingType() == HeatingType.thermostatic) { +// schedulerManager.scheduleOnce(heatModuleCode,() -> { +// try { +// heatModuleService.heaterMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleCode, trayLift); +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).setTrayUp(1); +// } catch (Exception e) { +// log.error("加热完毕抬起托盘错误{}", heatModuleCode, e); +// } +// }, deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTargetTime(), TimeUnit.SECONDS); + } } catch (Exception e) { log.error("降下托盘失败", e); } diff --git a/src/main/java/com/iflytop/gd/app/controller/TestController.java b/src/main/java/com/iflytop/gd/app/controller/TestController.java index 72a912f..d75bdb0 100644 --- a/src/main/java/com/iflytop/gd/app/controller/TestController.java +++ b/src/main/java/com/iflytop/gd/app/controller/TestController.java @@ -61,10 +61,12 @@ public class TestController { return Result.success(deviceStateService.getCommandMutexState().get()); } - - @Operation(summary = "获取加液区锁状态") - @GetMapping("/module-lock-try-lock") - public Result getModuleLockTryLock() { - return Result.success(solutionModuleService.getModuleLockTryLock()); + @Operation(summary = "重置状态") + @PostMapping("/reset") + public Result reset() throws Exception { + testService.reset(); + return Result.success(); } + + } diff --git a/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java b/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java index b250e74..3004c0d 100644 --- a/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java +++ b/src/main/java/com/iflytop/gd/app/model/bo/status/device/HeatModuleState.java @@ -9,8 +9,6 @@ import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; -import java.time.LocalDateTime; - @Schema(description = "加热模块") @Data @Component @@ -30,29 +28,17 @@ public class HeatModuleState { @Schema(description = "当前加热类型") private HeatingType heatingType = HeatingType.stop; - @Schema(description = "是否正在加热,true为正在加热,false为未加热")//可能去掉这个状态 - private boolean heating = false; - @Schema(description = "是否启动散热,true为正在散热,false为未在散热") private boolean fanOpen = false; @Schema(description = "是否存在拍子,true为存在拍子,false无拍子") private boolean capExist = false; - @Schema(description = "加热器加热温度") - private Double heatTemperature = null; - - @Schema(description = "加热器预热温度") - private Double warmUpTemperature = null; - @Schema(description = "加热器目标温度") private Double targetTemperature = null; @Schema(description = "加热器目标加热时间,单位秒") - private Integer targetTime = null; - - @Schema(description = "开始加热时间") - private LocalDateTime startHeatTime = null; + private Long targetTime = 0L; @Schema(description = "加热器当前温度") private Double temperature = null; diff --git a/src/main/java/com/iflytop/gd/app/service/api/TestService.java b/src/main/java/com/iflytop/gd/app/service/api/TestService.java index 21abffb..47c9d11 100644 --- a/src/main/java/com/iflytop/gd/app/service/api/TestService.java +++ b/src/main/java/com/iflytop/gd/app/service/api/TestService.java @@ -1,6 +1,7 @@ package com.iflytop.gd.app.service.api; import com.iflytop.gd.app.model.dto.AllSensorDTO; +import com.iflytop.gd.app.service.device.DeviceStateService; import com.iflytop.gd.hardware.exception.HardwareException; import com.iflytop.gd.hardware.service.GDDeviceStatusService; import com.iflytop.gd.hardware.type.IO.InputIOMId; @@ -17,6 +18,7 @@ import java.util.List; @RequiredArgsConstructor public class TestService { private final GDDeviceStatusService gdDeviceStatusService; + private final DeviceStateService deviceStateService; public List getAllSensor() throws HardwareException { List allSensorDTOList = new ArrayList<>(); @@ -38,4 +40,9 @@ public class TestService { return allSensorDTOList; } + public void reset(){ + deviceStateService.getCommandMutexState().get().reset(); + deviceStateService.getDeviceState().reset(); + } + } diff --git a/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java b/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java index a7260b7..2836a6c 100644 --- a/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java +++ b/src/main/java/com/iflytop/gd/app/service/crafts/CraftsStepService.java @@ -65,7 +65,12 @@ public class CraftsStepService { */ private boolean addLiquid(HeatModuleCode heatModuleCode, JSONObject params) throws Exception { //TODO 判断加液区是否有托盘,如果没有托盘的话,判断加热区是否有托盘,然后将其移动至加液区 - if(deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0){ + if((deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0 ) + && deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 0) { + throw new AppException(ResultCode.CRAFT_NO_TRAY); + } + if((deviceStateService.getDeviceState().getSolutionModule().getTrayStatus() == 0 ) + && deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleCode).getTrayStatus() == 1) { moveToSolutionModule(heatModuleCode); } JSONArray tubeSolList = params.getJSONArray("tubeSolList"); diff --git a/src/main/java/com/iflytop/gd/app/service/device/module/SolutionModuleService.java b/src/main/java/com/iflytop/gd/app/service/device/module/SolutionModuleService.java index d24ec5d..1c7f3bd 100644 --- a/src/main/java/com/iflytop/gd/app/service/device/module/SolutionModuleService.java +++ b/src/main/java/com/iflytop/gd/app/service/device/module/SolutionModuleService.java @@ -20,8 +20,6 @@ import org.springframework.stereotype.Service; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; /** * 加液模块 @@ -35,7 +33,6 @@ public class SolutionModuleService { private final LiquidDistributionArmDriver liquidDistributionArmDriver; private final WebSocketSender webSocketService; - private final Lock moduleLock = new ReentrantLock(); private final BlockingQueue waitingQueue = new ArrayBlockingQueue<>(1); /** @@ -48,8 +45,9 @@ public class SolutionModuleService { /** * 申请使用加液模块 */ - public void requestSolutionModule(String commandId, String command) { + public synchronized void requestSolutionModule(String commandId, String command) { try { + log.info("申请使用加液模块"); // 如果加液模块繁忙,加入队列等待 while (!deviceStateService.getDeviceState().getSolutionModule().isIdle()) { if (commandId != null && command != null) { @@ -59,7 +57,8 @@ public class SolutionModuleService { // 把当前线程放到队列中等待 waitingQueue.put(Thread.currentThread()); // 阻塞当前线程直到被唤醒 } - occupySolutionModule(); + deviceStateService.getDeviceState().getSolutionModule().setIdle(false); + log.info("加液模块申请成功"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException("等待加液区空闲错误", e); @@ -67,49 +66,32 @@ public class SolutionModuleService { } /** - * 占用加液模块 - */ - private void occupySolutionModule() { - moduleLock.lock(); - deviceStateService.getDeviceState().getSolutionModule().setIdle(false); - } - - /** * 释放加液区 */ - public void releaseSolutionModule() throws InterruptedException { - try { - deviceStateService.getDeviceState().getSolutionModule().setIdle(true); - // 唤醒队列中的第一个线程 - if (!waitingQueue.isEmpty()) { - Thread waitingThread = waitingQueue.take(); - synchronized (waitingThread) { - waitingThread.notify(); // 唤醒队列中的第一个等待线程 - } - } - } finally { - if (moduleLock.tryLock()) { - moduleLock.unlock(); + public synchronized void releaseSolutionModule() throws InterruptedException { + deviceStateService.getDeviceState().getSolutionModule().setIdle(true); + // 唤醒队列中的第一个线程 + if (!waitingQueue.isEmpty()) { + Thread waitingThread = waitingQueue.take(); + synchronized (waitingThread) { + waitingThread.notify(); // 唤醒队列中的第一个等待线程 } } } - public boolean getModuleLockTryLock(){ - return moduleLock.tryLock(); - } /** * 双轴械臂 移动至指定试管 */ public void dualRobotMovePoint(int index) throws Exception { - liquidDistributionArmDriver.liquidDistributionArmMoveTo(LiquidArmMId.LiquidDistributionArm, index); + liquidDistributionArmDriver.liquidDistributionArmMoveToBlock(LiquidArmMId.LiquidDistributionArm, index); } /** * 加液机械臂回原点 */ public void dualRobotOrigin() throws Exception { - liquidDistributionArmDriver.liquidDistributionArmMoveTo(LiquidArmMId.LiquidDistributionArm, 0); + liquidDistributionArmDriver.liquidDistributionArmMoveToBlock(LiquidArmMId.LiquidDistributionArm, 0); } /** @@ -210,7 +192,7 @@ public class SolutionModuleService { /** * 添加溶液 */ - public void acidPumpMoveBy(String commandId, String command, AcidPumpDeviceCode acidPumpDevice, double position) throws Exception { + public CommandFuture acidPumpMoveBy(String commandId, String command, AcidPumpDeviceCode acidPumpDevice, double position) throws Exception { DeviceCommandBundle deviceCommand; switch (acidPumpDevice) { case acid_pump_01 -> { @@ -239,8 +221,7 @@ public class SolutionModuleService { } default -> throw new RuntimeException("index 未找到"); } - CommandFuture deviceCommandFuture = deviceCommandService.sendCommand(commandId, command, deviceCommand); - CommandUtil.wait(deviceCommandFuture); + return deviceCommandService.sendCommand(commandId, command, deviceCommand); } /** diff --git a/src/main/java/com/iflytop/gd/app/service/scheduled/FetchTemperatureScheduledTask.java b/src/main/java/com/iflytop/gd/app/service/scheduled/FetchTemperatureScheduledTask.java index b3b632c..63b8278 100644 --- a/src/main/java/com/iflytop/gd/app/service/scheduled/FetchTemperatureScheduledTask.java +++ b/src/main/java/com/iflytop/gd/app/service/scheduled/FetchTemperatureScheduledTask.java @@ -19,7 +19,7 @@ public class FetchTemperatureScheduledTask { private final GDDeviceStatusService gdDeviceStatusService; private final DeviceStateService deviceStateService; - @Scheduled(fixedRate = 10000) + @Scheduled(fixedRate = 30000) public void fetchTemperature() { try { if (!deviceStateService.getDeviceState().isVirtual()) { @@ -42,14 +42,12 @@ public class FetchTemperatureScheduledTask { deviceStateService.getDeviceState().getHeatModuleByCode(HeatModuleCode.heat_module_06).setTemperature(heatModule06Temperature); } else {//虚拟模式随便写个值 - List heatModuleStateList = deviceStateService.getDeviceState().getHeatModule(); - for (HeatModuleState heatModuleState : heatModuleStateList) { - if (heatModuleState.isHeating()) { - heatModuleState.setTemperature(heatModuleState.getTargetTemperature()); - } else { - heatModuleState.setTemperature(26.0); - } - } +// List heatModuleStateList = deviceStateService.getDeviceState().getHeatModule(); +// for (HeatModuleState heatModuleState : heatModuleStateList) { +// if (heatModuleState.isHeating()) { +// deviceStateService.getDeviceState().getHeatModuleByCode(heatModuleState.getModuleCode()).setTemperature(123.0); +// } +// } } } catch (Exception e) { log.error("定时采集加热棒温度错误", e); diff --git a/src/main/java/com/iflytop/gd/common/enums/HeatingType.java b/src/main/java/com/iflytop/gd/common/enums/HeatingType.java index e4b88bc..9e71625 100644 --- a/src/main/java/com/iflytop/gd/common/enums/HeatingType.java +++ b/src/main/java/com/iflytop/gd/common/enums/HeatingType.java @@ -8,20 +8,6 @@ import lombok.Getter; @Getter public enum HeatingType { stop, - /** - * 预热中 - */ - warm_up, - /** - * 加热中 - */ + preheating, thermostatic, - /** - * 恒温中 - */ - constant, - /** - * 加热完成 - */ - finish, } diff --git a/src/main/java/com/iflytop/gd/common/result/ResultCode.java b/src/main/java/com/iflytop/gd/common/result/ResultCode.java index 74c7364..3a53727 100644 --- a/src/main/java/com/iflytop/gd/common/result/ResultCode.java +++ b/src/main/java/com/iflytop/gd/common/result/ResultCode.java @@ -40,6 +40,7 @@ public enum ResultCode implements IResultCode, Serializable { CRAFT_RUNNING("4101", "工艺正在执行"), CRAFT_CONTEXT_NULL("4102", "请先配置该加热区工艺"), CRAFT_CONTAINER_NOT_FOUND("4005", "工艺未找到对应溶液容器"), + CRAFT_NO_TRAY("4005", "工艺未找到托盘"), //============================ 5xxx:系统 & 第三方 ============================ SYSTEM_ERROR("5000", "系统内部错误"), SERVICE_UNAVAILABLE("5001", "服务暂不可用"),