From fdffde6512370581f7594d70a5341496cb1a0978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E5=87=A4=E5=90=89?= Date: Sun, 23 Mar 2025 22:55:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=8E=B7=E5=8F=96=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E8=87=AA=E6=A3=80=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms/app/front/cmd/business/DeviceSelfTest.java | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java b/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java index 2a14c02..9dc2d79 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java @@ -1,6 +1,5 @@ package com.qyft.ms.app.front.cmd.business; -import cn.hutool.json.JSONObject; import com.qyft.ms.app.device.status.DeviceStatus; import com.qyft.ms.app.service.SelfTestService; import com.qyft.ms.system.common.annotation.CommandMapping; @@ -14,11 +13,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; -import java.util.ArrayList; -import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; /** * 设备自检指令 @@ -39,6 +34,22 @@ public class DeviceSelfTest extends BaseCommandHandler { CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand); commandWait(overallDeviceStatusGetCommandFuture); + boolean xAxisAtOrigin = overallDeviceStatusGetCommandFuture.getResponseResult().getJSONObject("data").getBool("xAxisAtOrigin"); + boolean yAxisAtOrigin = overallDeviceStatusGetCommandFuture.getResponseResult().getJSONObject("data").getBool("yAxisAtOrigin"); + boolean zAxisAtOrigin = overallDeviceStatusGetCommandFuture.getResponseResult().getJSONObject("data").getBool("zAxisAtOrigin"); + + selfTestService.getSelfTestStatus().setXAxisAtOrigin(xAxisAtOrigin); + selfTestService.getSelfTestStatus().setYAxisAtOrigin(yAxisAtOrigin); + selfTestService.getSelfTestStatus().setZAxisAtOrigin(zAxisAtOrigin); + + if (xAxisAtOrigin && yAxisAtOrigin && zAxisAtOrigin) { + deviceStatus.setSelfTestCompleted(true); + } + + /* DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet(); + CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand); + commandWait(overallDeviceStatusGetCommandFuture); + CommandFuture motorXOriginCommandFuture = null; CommandFuture motorYOriginCommandFuture = null; CommandFuture motorZOriginCommandFuture = null; @@ -90,7 +101,7 @@ public class DeviceSelfTest extends BaseCommandHandler { deviceStatus.setSelfTestCompleted(true); } else { throw new RuntimeException("自检未完成"); - } + }*/ }); } }