|
|
@ -10,7 +10,9 @@ import com.iflytop.handacid.app.core.command.DeviceCommand; |
|
|
|
import com.iflytop.handacid.app.core.command.DeviceCommandGenerator; |
|
|
|
import com.iflytop.handacid.app.core.state.ChannelState; |
|
|
|
import com.iflytop.handacid.app.core.state.DeviceState; |
|
|
|
import com.iflytop.handacid.common.model.entity.AuditRecord; |
|
|
|
import com.iflytop.handacid.common.model.entity.Formulation; |
|
|
|
import com.iflytop.handacid.common.service.AuditRecordService; |
|
|
|
import com.iflytop.handacid.common.service.FormulationService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -30,6 +32,7 @@ public class ChannelCtrlService { |
|
|
|
private final FormulationService formulationService; |
|
|
|
private final DeviceCommandService deviceCommandService; |
|
|
|
private final DeviceState deviceState; |
|
|
|
private final AuditRecordService auditRecordService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 开始加液 |
|
|
@ -48,6 +51,9 @@ public class ChannelCtrlService { |
|
|
|
Formulation formulation = formulationService.getOne(new LambdaQueryWrapper<Formulation>().eq(Formulation::getSolutionId, channelState.getSolutionId())); |
|
|
|
DeviceCommand deviceCommand = getPumpMoveByCommandByChannel(channelState.getChannelCode(), formulation.getRevolutions()); |
|
|
|
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand)); |
|
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), formulation.getVolume()); |
|
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|
|
} |
|
|
|
CommandUtil.wait(commandFutureList); |
|
|
|
Thread.sleep(deviceState.getDelay() * 1000L); |
|
|
@ -58,6 +64,9 @@ public class ChannelCtrlService { |
|
|
|
Formulation formulation = formulationService.getOne(new LambdaQueryWrapper<Formulation>().eq(Formulation::getSolutionId, channelState.getSolutionId())); |
|
|
|
DeviceCommand deviceCommand = getPumpMoveByCommandByChannel(channelState.getChannelCode(), formulation.getRevolutions()); |
|
|
|
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand)); |
|
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), formulation.getVolume()); |
|
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|
|
} |
|
|
|
CommandUtil.wait(commandFutureList); |
|
|
|
} |
|
|
@ -108,6 +117,9 @@ public class ChannelCtrlService { |
|
|
|
for (ChannelState channelState : channelStateList) { |
|
|
|
DeviceCommand deviceCommand = getPumpForwardRotateCommandByChannel(channelState.getChannelCode()); |
|
|
|
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand)); |
|
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
|
channelState.getSolutionName(), channelState.getConcentration(), channelState.getChannelCode().name(), channelState.getTargetVolume()); |
|
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|
|
} |
|
|
|
CommandUtil.wait(commandFutureList); |
|
|
|
} catch (Exception e) { |
|
|
|