1 changed files with 68 additions and 0 deletions
@ -0,0 +1,68 @@ |
|||||
|
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; |
||||
|
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("nozzle_pipeline_wash_stop")//业务指令注解 |
||||
|
public class NozzlePipelineWashStop extends BaseCommandHandler { |
||||
|
|
||||
|
private final DeviceCommandService deviceCommandService; |
||||
|
private final DeviceStatus deviceStatus; |
||||
|
|
||||
|
@Override |
||||
|
public CompletableFuture<Void> handle(FrontCmdControlForm form) { |
||||
|
return runAsync(() -> { |
||||
|
try { |
||||
|
DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动 |
||||
|
DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动 |
||||
|
DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动 |
||||
|
CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand); |
||||
|
CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand); |
||||
|
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); |
||||
|
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); |
||||
|
|
||||
|
//1.全部关闭三通阀 |
||||
|
DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 |
||||
|
CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); |
||||
|
commandWait(threeWayValveCloseAllCommandFuture); |
||||
|
|
||||
|
//2.关闭清洗阀 |
||||
|
DeviceCommand washValveCloseCommand = DeviceCommandGenerator.washValveClose(); // 关闭清洗阀 |
||||
|
CommandFuture washValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveCloseCommand); |
||||
|
commandWait(washValveCloseCommandFuture); |
||||
|
|
||||
|
//3.关闭喷嘴阀 |
||||
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); // 关闭喷嘴阀 |
||||
|
CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveCloseCommand); |
||||
|
commandWait(nozzleValveCloseCommandFuture); |
||||
|
|
||||
|
//4.关闭除湿阀 |
||||
|
DeviceCommand dehumidifierValveCloseCommand = DeviceCommandGenerator.dehumidifierValveClose(); // 关闭除湿阀 |
||||
|
CommandFuture dehumidifierValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), dehumidifierValveCloseCommand); |
||||
|
commandWait(dehumidifierValveCloseCommandFuture); |
||||
|
} catch (Exception e) { |
||||
|
throw new RuntimeException(e); |
||||
|
}finally { |
||||
|
deviceStatus.setCleaningNozzlePipeline(false); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue