diff --git a/src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java b/src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java index 4f6a3bd..88566cc 100644 --- a/src/main/java/com/iflytop/handacid/app/service/ChannelCtrlService.java +++ b/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 channelCodeList = deviceState.filterChannelStatesByState(ChannelStateCode.ADD); deviceState.setSolutionAddStop(true); + List channelCodeList = deviceState.filterChannelStatesByState(ChannelStateCode.ADD); try { List 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); } }); }