From 6fc13caac2496543e970efe6955d12cd418c2ddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Tue, 20 May 2025 15:58:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E4=BB=A3=E7=A0=81=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gd/app/cmd/FilledSolutionStartCommand.java | 21 ++++++--------------- .../gd/app/cmd/FilledSolutionStopCommand.java | 17 +++++++---------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStartCommand.java b/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStartCommand.java index ab72815..c7dc5a7 100644 --- a/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStartCommand.java +++ b/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStartCommand.java @@ -1,20 +1,16 @@ package com.iflytop.gd.app.cmd; +import cn.hutool.json.JSONArray; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; -import com.iflytop.gd.app.model.entity.Container; import com.iflytop.gd.app.service.ContainerService; import com.iflytop.gd.app.service.DeviceCommandUtilService; import com.iflytop.gd.common.annotation.CommandMapping; import com.iflytop.gd.common.enums.AcidPumpDeviceCode; -import com.iflytop.gd.hardware.drivers.TricolorLightDriver; -import com.iflytop.gd.hardware.exception.HardwareException; -import com.iflytop.gd.hardware.type.MId; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.Arrays; import java.util.concurrent.CompletableFuture; /** @@ -31,18 +27,13 @@ public class FilledSolutionStartCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { return runAsync(() -> { - String ids = cmdDTO.getStringParam("list"); - - Long[] idArray = Arrays.stream(ids.split(",")) - .map(String::trim) - .map(Long::valueOf) - .toArray(Long[]::new); - for (Long id : idArray) { - + JSONArray idJsonArray = cmdDTO.getJSONArrayParam("list"); + for (int i = 0; i < idJsonArray.size(); i++) { + String idStr = idJsonArray.getStr(i); CompletableFuture.runAsync(() -> { try { - AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(id); - deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, 99999);//添加溶液 + AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(Long.parseLong(idStr)); + deviceCommandUtilService.acidPumpFilledSolutionStart(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice); } catch (Exception e) { log.error("预充失败", e); } diff --git a/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStopCommand.java b/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStopCommand.java index fb8d775..39fe475 100644 --- a/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStopCommand.java +++ b/src/main/java/com/iflytop/gd/app/cmd/FilledSolutionStopCommand.java @@ -1,5 +1,6 @@ package com.iflytop.gd.app.cmd; +import cn.hutool.json.JSONArray; import com.iflytop.gd.app.core.BaseCommandHandler; import com.iflytop.gd.app.model.dto.CmdDTO; import com.iflytop.gd.app.service.ContainerService; @@ -27,20 +28,16 @@ public class FilledSolutionStopCommand extends BaseCommandHandler { @Override public CompletableFuture handle(CmdDTO cmdDTO) { return runAsync(() -> { - String ids = cmdDTO.getStringParam("list"); - - Long[] idArray = Arrays.stream(ids.split(",")) - .map(String::trim) - .map(Long::valueOf) - .toArray(Long[]::new); - for (Long id : idArray) { + JSONArray idJsonArray = cmdDTO.getJSONArrayParam("list"); + for (int i = 0; i < idJsonArray.size(); i++) { + String idStr = idJsonArray.getStr(i); CompletableFuture.runAsync(() -> { try { - AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(id); - deviceCommandUtilService.acidPumpMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice, 99999);//添加溶液 + AcidPumpDeviceCode acidPumpDevice = containerService.getPumpByContainerId(Long.parseLong(idStr)); + deviceCommandUtilService.acidPumpStop(cmdDTO.getCommandId(), cmdDTO.getCommand(), acidPumpDevice); } catch (Exception e) { - log.error("预充失败", e); + log.error("停止预充失败", e); } }); }