From ea0e0d92730db94628bc1e90397ebfeb223223c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Thu, 17 Jul 2025 13:47:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B0=83=E6=95=B4=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms/app/front/cmd/business/NozzleHeatStart.java | 4 +- .../ms/app/front/cmd/business/NozzleHeatStop.java | 4 +- .../front/cmd/business/NozzlePipelinePreFill.java | 11 +- .../cmd/business/NozzlePipelinePreFillStop.java | 1 + .../app/front/cmd/business/NozzlePipelineWash.java | 192 ++++++++++----------- .../app/front/cmd/business/SlidePlatHeatStart.java | 5 +- .../app/front/cmd/business/SlidePlatHeatStop.java | 6 +- .../ms/app/front/cmd/business/SlideTrayIn.java | 72 ++++---- .../ms/app/front/cmd/business/SlideTrayOut.java | 72 ++++---- .../front/cmd/business/SyringePipelineWash.java | 11 +- .../cmd/business/SyringePipelineWashStop.java | 1 + 11 files changed, 195 insertions(+), 184 deletions(-) diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java index bc37fce..fe5c27d 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java @@ -3,6 +3,7 @@ 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.constant.CommandStatus; +import com.qyft.ms.system.common.device.command.CommandFuture; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.FrontResponseGenerator; import com.qyft.ms.system.core.handler.BaseCommandHandler; @@ -39,7 +40,8 @@ public class NozzleHeatStart extends BaseCommandHandler { } return runAsync(() -> { DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.nozzleHeatStart(temperature); // 生成喷头加热 - deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令 + CommandFuture nozzleHeatStartCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令 + commandWait(nozzleHeatStartCmdFuture); deviceStatus.setNozzleHeating(true);//设置喷头加热状态 }); } diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java index 08f1dc9..7d7208d 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java @@ -2,6 +2,7 @@ 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; @@ -29,7 +30,8 @@ public class NozzleHeatStop extends BaseCommandHandler { public CompletableFuture handle(FrontCmdControlForm form) { return runAsync(() -> { DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.nozzleHeatStop(); // 生成喷头加热关闭 - deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令 + CommandFuture nozzleHeatStopCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令 + commandWait(nozzleHeatStopCmdFuture); deviceStatus.setNozzleHeating(false);//设置喷头加热状态 }); } diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java index e086f03..22c1893 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java @@ -72,11 +72,13 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { commandWait(motorZPositionSetCommandFuture); } Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper().eq(Position::getPointCode, "waste_liquor")); - //3.x轴移动到废液位置 + //xy轴移动到废液位置 DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); - commandWait(motorXPositionSetCommandFuture); - //4.下降z轴高度,防止飞溅 + DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getY(), 20.0); + CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYPositionSetCommand); + commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture); + //下降z轴高度,防止飞溅 DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); commandWait(motorZPositionSetCommandFuture); @@ -85,12 +87,13 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); commandWait(nozzleValveOpenCommandFuture); + Thread.sleep(500);//开启喷嘴阀后需要延迟500毫秒 //5.打开三通阀注射器管路 // DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); // CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenNozzlePipelineCommand); // commandWait(threeWayValveOpenNozzlePipelineCommandFuture); - Thread.sleep(500); + //6.设置注射泵速度,推注射泵 DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java index 3bdcaca..1fb1387 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java @@ -41,6 +41,7 @@ public class NozzlePipelinePreFillStop extends BaseCommandHandler { DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵 CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); Thread.sleep(500); + //2.全部关闭三通阀 DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java index 3b1c27f..7d81570 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java @@ -1,96 +1,96 @@ -package com.qyft.ms.app.front.cmd.business; - -import cn.hutool.json.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.qyft.ms.app.device.status.DeviceStatus; -import com.qyft.ms.app.model.entity.Position; -import com.qyft.ms.app.model.entity.SysSettings; -import com.qyft.ms.app.service.PositionService; -import com.qyft.ms.app.service.SysSettingsService; -import com.qyft.ms.system.common.annotation.CommandMapping; -import com.qyft.ms.system.common.constant.CommandStatus; -import com.qyft.ms.system.common.device.command.CommandFuture; -import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; -import com.qyft.ms.system.common.device.command.FrontResponseGenerator; -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.WebSocketService; -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")//业务指令注解 -public class NozzlePipelineWash extends BaseCommandHandler { - - private final DeviceCommandService deviceCommandService; - private final SysSettingsService sysSettingsService; - private final PositionService positionService; - private final DeviceStatus deviceStatus; - private final WebSocketService webSocketService; - - @Override - public CompletableFuture handle(FrontCmdControlForm form) { - if (deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) { - throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路"); - } - try { - //1.判断z轴是否在安全距离,如果不在安全距离可以不抬升z轴 - DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); - CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); - commandWait(motorXyzPositionGetCommandFuture); - JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); - Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition"); - if (zAxisPosition == null) { - webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult)); - throw new RuntimeException("获得电机XYZ相对原点坐标失败"); - } - zAxisPosition = Math.abs(zAxisPosition); - SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper().eq(SysSettings::getCode, "safe_z_height")); - double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue()); - if (zAxisPosition > safeZHeight) { //z轴超出安全距离,抬升z轴 - DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(safeZHeight, 15.0); - CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); - commandWait(motorZPositionSetCommandFuture); - } - Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper().eq(Position::getPointCode, "waste_liquor")); - //2.轴移动到废液位置 - DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); - CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); - commandWait(motorXPositionSetCommandFuture); - //3.下降z轴高度,防止飞溅 - DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 15.0); - CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); - commandWait(motorZPositionSetCommandFuture); - //4.开启三通阀到喷嘴管路 - DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline(); // 打开三通阀喷嘴管路 - CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand); - commandWait(threeWayValveOpenSyringePipelineCommandFuture); - - //6.打开清洗阀 - DeviceCommand washValveOpenCommand = DeviceCommandGenerator.washValveOpen(); // 生成打开清洗阀指令 - CommandFuture washValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenCommand); - commandWait(washValveOpenCommandFuture); - - deviceStatus.setCleaningNozzlePipeline(true); - } catch (Exception e) { - deviceStatus.setCleaningNozzlePipeline(false); - throw new RuntimeException(e); - } - return runAsync(() -> { - - - }); - - } -} +//package com.qyft.ms.app.front.cmd.business; +// +//import cn.hutool.json.JSONObject; +//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +//import com.qyft.ms.app.device.status.DeviceStatus; +//import com.qyft.ms.app.model.entity.Position; +//import com.qyft.ms.app.model.entity.SysSettings; +//import com.qyft.ms.app.service.PositionService; +//import com.qyft.ms.app.service.SysSettingsService; +//import com.qyft.ms.system.common.annotation.CommandMapping; +//import com.qyft.ms.system.common.constant.CommandStatus; +//import com.qyft.ms.system.common.device.command.CommandFuture; +//import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; +//import com.qyft.ms.system.common.device.command.FrontResponseGenerator; +//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.WebSocketService; +//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")//业务指令注解 +//public class NozzlePipelineWash extends BaseCommandHandler { +// +// private final DeviceCommandService deviceCommandService; +// private final SysSettingsService sysSettingsService; +// private final PositionService positionService; +// private final DeviceStatus deviceStatus; +// private final WebSocketService webSocketService; +// +// @Override +// public CompletableFuture handle(FrontCmdControlForm form) { +// if (deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) { +// throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路"); +// } +// try { +// //1.判断z轴是否在安全距离,如果不在安全距离可以不抬升z轴 +// DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); +// CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); +// commandWait(motorXyzPositionGetCommandFuture); +// JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult(); +// Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition"); +// if (zAxisPosition == null) { +// webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult)); +// throw new RuntimeException("获得电机XYZ相对原点坐标失败"); +// } +// zAxisPosition = Math.abs(zAxisPosition); +// SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper().eq(SysSettings::getCode, "safe_z_height")); +// double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue()); +// if (zAxisPosition > safeZHeight) { //z轴超出安全距离,抬升z轴 +// DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(safeZHeight, 15.0); +// CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); +// commandWait(motorZPositionSetCommandFuture); +// } +// Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper().eq(Position::getPointCode, "waste_liquor")); +// //2.轴移动到废液位置 +// DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); +// CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); +// commandWait(motorXPositionSetCommandFuture); +// //3.下降z轴高度,防止飞溅 +// DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 15.0); +// CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); +// commandWait(motorZPositionSetCommandFuture); +// //4.开启三通阀到喷嘴管路 +// DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline(); // 打开三通阀喷嘴管路 +// CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand); +// commandWait(threeWayValveOpenSyringePipelineCommandFuture); +// +// //6.打开清洗阀 +// DeviceCommand washValveOpenCommand = DeviceCommandGenerator.washValveOpen(); // 生成打开清洗阀指令 +// CommandFuture washValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenCommand); +// commandWait(washValveOpenCommandFuture); +// +// deviceStatus.setCleaningNozzlePipeline(true); +// } catch (Exception e) { +// deviceStatus.setCleaningNozzlePipeline(false); +// throw new RuntimeException(e); +// } +// return runAsync(() -> { +// +// +// }); +// +// } +//} diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java index 6b10d38..45a524f 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java @@ -3,6 +3,7 @@ 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.constant.CommandStatus; +import com.qyft.ms.system.common.device.command.CommandFuture; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.FrontResponseGenerator; import com.qyft.ms.system.core.handler.BaseCommandHandler; @@ -37,9 +38,9 @@ public class SlidePlatHeatStart extends BaseCommandHandler { throw new RuntimeException("参数 temperature 必填"); } return runAsync(() -> { - DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.slidePlatHeatStart(temperature); // 生成载玻台加热指令 - deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令 + CommandFuture nozzleHeatStartCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令 + commandWait(nozzleHeatStartCmdFuture); deviceStatus.setSlidePlatHeating(true);//设置载玻台加热状态 }); } diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java index e074bc1..d21c3f4 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java @@ -2,6 +2,7 @@ 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; @@ -28,11 +29,10 @@ public class SlidePlatHeatStop extends BaseCommandHandler { @Override public CompletableFuture handle(FrontCmdControlForm form) { return runAsync(() -> { - DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.slidePlatHeatStop(); // 生成载板加热关闭指令 - deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令 + CommandFuture nozzleHeatStopCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令 + commandWait(nozzleHeatStopCmdFuture); deviceStatus.setSlidePlatHeating(false);//设置载玻台加热状态 - }); } } diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java index e1b32ab..41ff06c 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java @@ -1,36 +1,36 @@ -package com.qyft.ms.app.front.cmd.business; - -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("slide_tray_in")//业务指令注解 -public class SlideTrayIn extends BaseCommandHandler { - - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(FrontCmdControlForm form) { - return runAsync(() -> { - DeviceCommand slideTrayInCommand = DeviceCommandGenerator.slideTrayIn(0.0, 20.0);//推入玻片托盘 - CommandFuture slideTrayInCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayInCommand); - commandWait(slideTrayInCommandFuture); - }); - - } -} +//package com.qyft.ms.app.front.cmd.business; +// +//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("slide_tray_in")//业务指令注解 +//public class SlideTrayIn extends BaseCommandHandler { +// +// private final DeviceCommandService deviceCommandService; +// +// @Override +// public CompletableFuture handle(FrontCmdControlForm form) { +// return runAsync(() -> { +// DeviceCommand slideTrayInCommand = DeviceCommandGenerator.slideTrayIn(0.0, 20.0);//推入玻片托盘 +// CommandFuture slideTrayInCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayInCommand); +// commandWait(slideTrayInCommandFuture); +// }); +// +// } +//} diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java index e9b25cf..218ee39 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java @@ -1,36 +1,36 @@ -package com.qyft.ms.app.front.cmd.business; - -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("slide_tray_out")//业务指令注解 -public class SlideTrayOut extends BaseCommandHandler { - - private final DeviceCommandService deviceCommandService; - - @Override - public CompletableFuture handle(FrontCmdControlForm form) { - return runAsync(() -> { - DeviceCommand slideTrayOutCommand = DeviceCommandGenerator.slideTrayOut(150.0, 20.0);//推出玻片托盘 - CommandFuture slideTrayOutCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayOutCommand); - commandWait(slideTrayOutCommandFuture); - }); - - } -} +//package com.qyft.ms.app.front.cmd.business; +// +//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("slide_tray_out")//业务指令注解 +//public class SlideTrayOut extends BaseCommandHandler { +// +// private final DeviceCommandService deviceCommandService; +// +// @Override +// public CompletableFuture handle(FrontCmdControlForm form) { +// return runAsync(() -> { +// DeviceCommand slideTrayOutCommand = DeviceCommandGenerator.slideTrayOut(150.0, 20.0);//推出玻片托盘 +// CommandFuture slideTrayOutCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayOutCommand); +// commandWait(slideTrayOutCommandFuture); +// }); +// +// } +//} diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java index 5c52294..393ab55 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java @@ -73,11 +73,13 @@ public class SyringePipelineWash extends BaseCommandHandler { commandWait(motorZPositionSetCommandFuture); } Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper().eq(Position::getPointCode, "waste_liquor")); - //3.x轴移动到废液位置 + //xy轴移动到废液位置 DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); - commandWait(motorXPositionSetCommandFuture); - //4.下降z轴高度,防止飞溅 + DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getY(), 20.0); + CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYPositionSetCommand); + commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture); + //下降z轴高度,防止飞溅 DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); commandWait(motorZPositionSetCommandFuture); @@ -86,7 +88,7 @@ public class SyringePipelineWash extends BaseCommandHandler { DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); commandWait(nozzleValveOpenCommandFuture); - Thread.sleep(500); + Thread.sleep(500);//开启喷嘴阀后需要延迟500毫秒 //6.设置注射泵速度,推注射泵 DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 @@ -105,7 +107,6 @@ public class SyringePipelineWash extends BaseCommandHandler { // commandWait(washValveOpenCommandFuture); - deviceStatus.setCleaningSyringePipeline(true); } catch (Exception e) { deviceStatus.setCleaningSyringePipeline(false); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java index d395f43..5a572a0 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java @@ -40,6 +40,7 @@ public class SyringePipelineWashStop extends BaseCommandHandler { //1.停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); + //2.全部关闭三通阀 DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand);