From 1b89c17c9e06eb24358ac20416f28b7b86bf7d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Wed, 14 May 2025 21:24:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E6=BA=B6=E6=B6=B2?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E6=94=AF=E6=8C=81=E5=A4=9A=E8=AF=95=E7=AE=A1?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E7=A7=8D=E6=BA=B6=E6=B6=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/iflytop/gd/app/cmd/SolutionAddCommand.java | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java b/src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java index 532832a..7f29f5f 100644 --- a/src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java +++ b/src/main/java/com/iflytop/gd/app/cmd/SolutionAddCommand.java @@ -15,6 +15,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.Arrays; import java.util.concurrent.CompletableFuture; /** @@ -37,19 +38,23 @@ public class SolutionAddCommand extends BaseCommandHandler { JSONArray dataList = (JSONArray) cmdDTO.getParams().get("dataList"); for (int i = 0; i < dataList.size(); i++) {//遍历前端传入的加液配置 JSONObject tubeSol = dataList.getJSONObject(i); - Integer tubeNum = tubeSol.getInt("tubeNum");//获取试管编号 + String tubeNum = tubeSol.getStr("tubeNum");//获取试管编号 + int[] tubeNums = Arrays.stream(tubeNum.split(",")) + .mapToInt(s -> Integer.parseInt(s.trim())) + .toArray(); JSONArray solutionList = tubeSol.getJSONArray("solutionList"); - for (int j = 0; j < solutionList.size(); j++) {//遍历该试管应该加哪种液 - JSONObject addSolution = solutionList.getJSONObject(j); - Long solId = addSolution.getLong("solId"); - Double volume = addSolution.getDouble("volume"); - AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵 - if (acidPumpDevice == null) { - throw new AppException(ResultCode.CRAFT_CONTAINER_NOT_FOUND);//工艺未找到对应溶液容器 + for (int num : tubeNums) { + for (int k = 0; k < solutionList.size(); k++) { + JSONObject addSolution = solutionList.getJSONObject(k); + Long solId = addSolution.getLong("solId"); + Double volume = addSolution.getDouble("volume"); + AcidPumpDeviceCode acidPumpDevice = containerService.getPumpBySolutionId(solId);//获取溶液对应的泵 + if (acidPumpDevice == null) { + throw new AppException(ResultCode.CRAFT_CONTAINER_NOT_FOUND);//工艺未找到对应溶液容器 + } + deviceCommandUtilService.dualRobotMovePoint(num);//移动加液机械臂到指定试管点位 + deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, volume);//添加溶液 } - deviceCommandUtilService.dualRobotMovePoint(tubeNum);//移动加液机械臂到指定试管点位 - deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), - cmdDTO.getCommand(), acidPumpDevice, volume);//添加溶液 } } deviceCommandUtilService.dualRobotOrigin();