Browse Source

fix:调整指令执行顺序

master
白凤吉 1 day ago
parent
commit
6ed250190b
  1. 17
      src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java

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

@ -101,9 +101,6 @@ public class ChannelCtrlService {
handleCalculateActualDispensedVolume(channelState, formulation.getVolume(), formulation.getRevolutions());
}
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
for (ChannelState channelState : channelStateList) {
channelState.setStateCode(ChannelStateCode.IDLE);
//关闭阀门
@ -111,6 +108,8 @@ public class ChannelCtrlService {
deviceCommandService.sendCommand(valveCloseDeviceCommand);
}
deviceState.setSolutionAddStop(false);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}
@ -119,8 +118,8 @@ public class ChannelCtrlService {
* 停止加液
*/
public void solutionAddStop() {
List<ChannelState> channelCodeList = deviceState.filterChannelStatesByState(ChannelStateCode.ADD);
deviceState.setSolutionAddStop(true);
List<ChannelState> channelCodeList = deviceState.filterChannelStatesByState(ChannelStateCode.ADD);
try {
List<CommandFuture> commandFutureList = new ArrayList<>();
for (ChannelState channelState : channelCodeList) {
@ -128,12 +127,11 @@ public class ChannelCtrlService {
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand));
}
CommandUtil.wait(commandFutureList);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
for (ChannelState channelCode : channelCodeList) {
channelCode.setStateCode(ChannelStateCode.IDLE);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@ -202,9 +200,6 @@ public class ChannelCtrlService {
commandFutureList.add(deviceCommandService.sendCommand(deviceCommand));
}
CommandUtil.wait(commandFutureList);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
for (ChannelState channelCode : channelCodeList) {
channelCode.setPre(true);
channelCode.setStateCode(ChannelStateCode.IDLE);
@ -212,6 +207,8 @@ public class ChannelCtrlService {
DeviceCommand valveCloseDeviceCommand = getValveCloseCommandByChannel(channelCode.getChannelCode());
deviceCommandService.sendCommand(valveCloseDeviceCommand);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}

Loading…
Cancel
Save