|
|
@ -1,6 +1,7 @@ |
|
|
|
package com.iflytop.handacid.app.command.control; |
|
|
|
|
|
|
|
import com.iflytop.handacid.app.common.annotation.CommandMapping; |
|
|
|
import com.iflytop.handacid.app.common.enums.ChannelCode; |
|
|
|
import com.iflytop.handacid.app.common.enums.ChannelStateCode; |
|
|
|
import com.iflytop.handacid.app.common.enums.SystemConfigKey; |
|
|
|
import com.iflytop.handacid.app.common.utils.CommandUtil; |
|
|
@ -36,17 +37,18 @@ public class SolutionDrainStartCommand extends BaseCommandHandler { |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CommandDTO commandDTO) { |
|
|
|
List<ChannelState> channelCodeList = deviceState.filterChannelStatesIsPre(); |
|
|
|
return runAsync(() -> { |
|
|
|
List<CommandFuture> commandFutureList = new ArrayList<>(); |
|
|
|
for (ChannelState channelState : channelCodeList) { |
|
|
|
for(ChannelCode channelCode : ChannelCode.values()){ |
|
|
|
ChannelState channelState = deviceState.getChannelStateMap().get(channelCode); |
|
|
|
channelState.setStateCode(ChannelStateCode.DRAIN); |
|
|
|
Double drainRevolutions = systemConfigService.getValueByKeyToDouble(SystemConfigKey.DRAIN_REVOLUTIONS); |
|
|
|
DeviceCommand deviceCommand = channelCtrlService.getPumpMoveByCommandByChannel(channelState.getChannelCode(), -drainRevolutions); |
|
|
|
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand)); |
|
|
|
} |
|
|
|
CommandUtil.wait(commandFutureList); |
|
|
|
for (ChannelState channelState : channelCodeList) { |
|
|
|
for(ChannelCode channelCode : ChannelCode.values()){ |
|
|
|
ChannelState channelState = deviceState.getChannelStateMap().get(channelCode); |
|
|
|
channelState.setStateCode(ChannelStateCode.IDLE); |
|
|
|
} |
|
|
|
}); |
|
|
|