Browse Source

fix:使用的量写入到数据库

master
白凤吉 3 days ago
parent
commit
053acbbca8
  1. 12
      src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

12
src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

@ -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.DeviceState;
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.service.AuditRecordService;
import com.iflytop.handacid.common.service.ChannelService;
import com.iflytop.handacid.common.service.FormulationService;
import com.iflytop.handacid.common.service.SystemConfigService;
import lombok.RequiredArgsConstructor;
@ -36,11 +38,15 @@ public class ChannelCtrlService {
private final DeviceState deviceState;
private final AuditRecordService auditRecordService;
private final SystemConfigService systemConfigService;
private final ChannelService channelService;
/**
* 开始加液
*/
public void solutionAddStart() {
if(deviceState.isSolutionAdding()){
return;
}
CompletableFuture.runAsync(() -> {
List<ChannelState> channelStateList = deviceState.filterChannelStatesIsSelected();
try {
@ -84,6 +90,9 @@ public class ChannelCtrlService {
currentVolume = 0;
}
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(),
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume);
auditRecordService.saveOrUpdate(auditRecord);
@ -123,6 +132,9 @@ public class ChannelCtrlService {
currentVolume = 0;
}
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(),
channelState.getSolutionName(), formulation.getConcentration(), channelState.getChannelCode().name(), dispensedVolume);
auditRecordService.saveOrUpdate(auditRecord);

Loading…
Cancel
Save