|
@ -12,8 +12,10 @@ import com.iflytop.handacid.app.core.command.DeviceCommandGenerator; |
|
|
import com.iflytop.handacid.app.core.state.ChannelState; |
|
|
import com.iflytop.handacid.app.core.state.ChannelState; |
|
|
import com.iflytop.handacid.app.core.state.DeviceState; |
|
|
import com.iflytop.handacid.app.core.state.DeviceState; |
|
|
import com.iflytop.handacid.common.model.entity.AuditRecord; |
|
|
import com.iflytop.handacid.common.model.entity.AuditRecord; |
|
|
|
|
|
import com.iflytop.handacid.common.model.entity.Channel; |
|
|
import com.iflytop.handacid.common.model.entity.Formulation; |
|
|
import com.iflytop.handacid.common.model.entity.Formulation; |
|
|
import com.iflytop.handacid.common.service.AuditRecordService; |
|
|
import com.iflytop.handacid.common.service.AuditRecordService; |
|
|
|
|
|
import com.iflytop.handacid.common.service.ChannelService; |
|
|
import com.iflytop.handacid.common.service.FormulationService; |
|
|
import com.iflytop.handacid.common.service.FormulationService; |
|
|
import com.iflytop.handacid.common.service.SystemConfigService; |
|
|
import com.iflytop.handacid.common.service.SystemConfigService; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
@ -36,11 +38,15 @@ public class ChannelCtrlService { |
|
|
private final DeviceState deviceState; |
|
|
private final DeviceState deviceState; |
|
|
private final AuditRecordService auditRecordService; |
|
|
private final AuditRecordService auditRecordService; |
|
|
private final SystemConfigService systemConfigService; |
|
|
private final SystemConfigService systemConfigService; |
|
|
|
|
|
private final ChannelService channelService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 开始加液 |
|
|
* 开始加液 |
|
|
*/ |
|
|
*/ |
|
|
public void solutionAddStart() { |
|
|
public void solutionAddStart() { |
|
|
|
|
|
if(deviceState.isSolutionAdding()){ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
CompletableFuture.runAsync(() -> { |
|
|
CompletableFuture.runAsync(() -> { |
|
|
List<ChannelState> channelStateList = deviceState.filterChannelStatesIsSelected(); |
|
|
List<ChannelState> channelStateList = deviceState.filterChannelStatesIsSelected(); |
|
|
try { |
|
|
try { |
|
@ -84,6 +90,9 @@ public class ChannelCtrlService { |
|
|
currentVolume = 0; |
|
|
currentVolume = 0; |
|
|
} |
|
|
} |
|
|
channelState.setCurrentVolume(currentVolume); |
|
|
channelState.setCurrentVolume(currentVolume); |
|
|
|
|
|
Channel channel = channelService.getOne(new LambdaQueryWrapper<>(new Channel()).eq(Channel::getCode, channelState.getChannelCode())); |
|
|
|
|
|
channel.setCurrentVolume(currentVolume); |
|
|
|
|
|
channelService.updateById(channel); |
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume); |
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume); |
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
@ -123,6 +132,9 @@ public class ChannelCtrlService { |
|
|
currentVolume = 0; |
|
|
currentVolume = 0; |
|
|
} |
|
|
} |
|
|
channelState.setCurrentVolume(currentVolume); |
|
|
channelState.setCurrentVolume(currentVolume); |
|
|
|
|
|
Channel channel = channelService.getOne(new LambdaQueryWrapper<>(new Channel()).eq(Channel::getCode, channelState.getChannelCode())); |
|
|
|
|
|
channel.setCurrentVolume(currentVolume); |
|
|
|
|
|
channelService.updateById(channel); |
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
AuditRecord auditRecord = new AuditRecord(deviceState.getCurrentUser().getId(), deviceState.getCurrentUser().getNickname(), channelState.getSolutionId(), |
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume); |
|
|
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume); |
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|
auditRecordService.saveOrUpdate(auditRecord); |
|
|