Browse Source

fix:定量预充不用计算加液量

master
白凤吉 3 days ago
parent
commit
a910692142
  1. 8
      src/main/java/com/iflytop/handacid/app/command/control/SolutionDrainStartCommand.java
  2. 14
      src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

8
src/main/java/com/iflytop/handacid/app/command/control/SolutionDrainStartCommand.java

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

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

@ -158,13 +158,13 @@ public class ChannelCtrlService {
} }
CommandUtil.wait(commandFutureList); CommandUtil.wait(commandFutureList);
for (ChannelState channelState : channelStateList) {//与缓存的位置比较计算加液量
PreFill preFill = preFillService.lambdaQuery()
.eq(PreFill::getSolutionId, channelState.getSolutionId())
.eq(PreFill::getConcentration, channelState.getConcentration())
.one();
handleCalculateActualDispensedVolume(channelState, preFill.getVolume(), preFill.getConcentration());
}
// for (ChannelState channelState : channelStateList) {//与缓存的位置比较计算加液量
// PreFill preFill = preFillService.lambdaQuery()
// .eq(PreFill::getSolutionId, channelState.getSolutionId())
// .eq(PreFill::getConcentration, channelState.getConcentration())
// .one();
// handleCalculateActualDispensedVolume(channelState, preFill.getVolume(), preFill.getConcentration());
// }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

Loading…
Cancel
Save