|
@ -24,7 +24,7 @@ import org.springframework.stereotype.Component; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 注射器管路_清洗注射器管路 |
|
|
|
|
|
|
|
|
* 清洗注射器管路 |
|
|
*/ |
|
|
*/ |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@Component |
|
|
@Component |
|
@ -40,6 +40,9 @@ public class SyringePipelineWash extends BaseCommandHandler { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public CompletableFuture<Void> handle(FrontCmdControlForm form) { |
|
|
public CompletableFuture<Void> handle(FrontCmdControlForm form) { |
|
|
|
|
|
if(deviceStatus.isSpraying()){ |
|
|
|
|
|
throw new RuntimeException("正在喷涂,无法开启清洗注射器管路"); |
|
|
|
|
|
} |
|
|
if ( deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) { |
|
|
if ( deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) { |
|
|
throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路"); |
|
|
throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路"); |
|
|
} |
|
|
} |
|
@ -49,11 +52,13 @@ public class SyringePipelineWash extends BaseCommandHandler { |
|
|
throw new RuntimeException("参数 speed 必填"); |
|
|
throw new RuntimeException("参数 speed 必填"); |
|
|
} |
|
|
} |
|
|
if (speed > 100) { |
|
|
if (speed > 100) { |
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "清洗速度不能大于100")); |
|
|
|
|
|
throw new RuntimeException("预充速度不能大于100"); |
|
|
|
|
|
|
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "移动速度不能大于100")); |
|
|
|
|
|
throw new RuntimeException("移动速度不能大于100"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return runAsync(() -> { |
|
|
try { |
|
|
try { |
|
|
|
|
|
deviceStatus.setCleaningSyringePipeline(true); |
|
|
//2.判断z轴是否在安全距离,如果不在安全距离可以不抬升z轴 |
|
|
//2.判断z轴是否在安全距离,如果不在安全距离可以不抬升z轴 |
|
|
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); |
|
|
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); |
|
|
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); |
|
|
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); |
|
@ -73,48 +78,44 @@ public class SyringePipelineWash extends BaseCommandHandler { |
|
|
commandWait(motorZPositionSetCommandFuture); |
|
|
commandWait(motorZPositionSetCommandFuture); |
|
|
} |
|
|
} |
|
|
Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor")); |
|
|
Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor")); |
|
|
//xy轴移动到废液位置 |
|
|
|
|
|
|
|
|
//3.x轴移动到废液位置 |
|
|
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); |
|
|
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); |
|
|
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); |
|
|
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); |
|
|
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getY(), 20.0); |
|
|
|
|
|
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYPositionSetCommand); |
|
|
|
|
|
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture); |
|
|
|
|
|
//下降z轴高度,防止飞溅 |
|
|
|
|
|
|
|
|
commandWait(motorXPositionSetCommandFuture); |
|
|
|
|
|
//4.下降z轴高度,防止飞溅 |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); |
|
|
commandWait(motorZPositionSetCommandFuture); |
|
|
commandWait(motorZPositionSetCommandFuture); |
|
|
|
|
|
|
|
|
//5.开启喷嘴阀 |
|
|
|
|
|
|
|
|
//5.三通阀打开注射器管路 |
|
|
|
|
|
DeviceCommand openSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline(); |
|
|
|
|
|
CommandFuture openSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), openSyringePipelineCommand); |
|
|
|
|
|
commandWait(openSyringePipelineCommandFuture); |
|
|
|
|
|
|
|
|
|
|
|
//6.关闭清洗和除湿阀 开启喷嘴阀 |
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 |
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 |
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); |
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); |
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
Thread.sleep(500);//开启喷嘴阀后需要延迟500毫秒 |
|
|
|
|
|
|
|
|
|
|
|
//6.设置注射泵速度,推注射泵 |
|
|
|
|
|
DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 |
|
|
|
|
|
CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand); |
|
|
|
|
|
commandWait(syringePumpStartCommandFuture); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DeviceCommand washValveCloseCommand = DeviceCommandGenerator.washValveClose(); // 关闭清洗阀 |
|
|
|
|
|
CommandFuture washValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveCloseCommand); |
|
|
|
|
|
commandWait(washValveCloseCommandFuture); |
|
|
|
|
|
|
|
|
//5.打开三通阀注射器管路 |
|
|
|
|
|
// DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); |
|
|
|
|
|
// CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenNozzlePipelineCommand); |
|
|
|
|
|
// commandWait(threeWayValveOpenNozzlePipelineCommandFuture); |
|
|
|
|
|
|
|
|
DeviceCommand dehumidifierCloseCommand = DeviceCommandGenerator.dehumidifierValveClose(); // 关闭除湿阀门 |
|
|
|
|
|
CommandFuture dehumidifierCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), dehumidifierCloseCommand); |
|
|
|
|
|
commandWait(dehumidifierCloseCommandFuture); |
|
|
|
|
|
|
|
|
//6.打开清洗阀 |
|
|
|
|
|
// DeviceCommand washValveOpenCommand = DeviceCommandGenerator.washValveOpen(); // 生成打开清洗阀指令 |
|
|
|
|
|
// CommandFuture washValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenCommand); |
|
|
|
|
|
// commandWait(washValveOpenCommandFuture); |
|
|
|
|
|
|
|
|
Thread.sleep(500); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deviceStatus.setCleaningSyringePipeline(true); |
|
|
|
|
|
|
|
|
//7.设置注射泵速度,推注射泵 |
|
|
|
|
|
DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 |
|
|
|
|
|
CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand); |
|
|
|
|
|
commandWait(syringePumpStartCommandFuture); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
deviceStatus.setCleaningSyringePipeline(false); |
|
|
deviceStatus.setCleaningSyringePipeline(false); |
|
|
throw new RuntimeException(e); |
|
|
throw new RuntimeException(e); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return runAsync(() -> { |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|