Browse Source

fix:回原点逻辑修改,停止清洗停止基质预充也应当停止xyz轴移动

tags/1.0
白凤吉 4 months ago
parent
commit
6f522dd93c
  1. 27
      src/main/java/com/qyft/ms/app/controller/SelfTestController.java
  2. 4
      src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java
  3. 8
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java
  4. 8
      src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java

27
src/main/java/com/qyft/ms/app/controller/SelfTestController.java

@ -1,8 +1,13 @@
package com.qyft.ms.app.controller; package com.qyft.ms.app.controller;
import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.app.model.vo.SelfTestVO; import com.qyft.ms.app.model.vo.SelfTestVO;
import com.qyft.ms.app.service.SelfTestService; import com.qyft.ms.app.service.SelfTestService;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.common.result.Result; import com.qyft.ms.system.common.result.Result;
import com.qyft.ms.system.model.bo.DeviceCommand;
import com.qyft.ms.system.service.device.DeviceCommandService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -11,6 +16,10 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Tag(name = "自检") @Tag(name = "自检")
@RestController @RestController
@RequestMapping("/api/self-test") @RequestMapping("/api/self-test")
@ -18,10 +27,26 @@ import org.springframework.web.bind.annotation.RestController;
@Slf4j @Slf4j
public class SelfTestController { public class SelfTestController {
private final SelfTestService selfTestService; private final SelfTestService selfTestService;
private final DeviceCommandService deviceCommandService;
private final DeviceStatus deviceStatus;
@Operation(summary = "获取自检状态") @Operation(summary = "获取自检状态")
@GetMapping("/") @GetMapping("/")
public Result<SelfTestVO> getSelfTestStatus() {
public Result<SelfTestVO> getSelfTestStatus() throws ExecutionException, InterruptedException, TimeoutException {
DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet();
CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommandNoFront(overallDeviceStatusGetCommand);
overallDeviceStatusGetCommandFuture.getResponseFuture().get(5, TimeUnit.SECONDS);
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);
}
return Result.success(selfTestService.getSelfTestStatus()); return Result.success(selfTestService.getSelfTestStatus());
} }

4
src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java

@ -30,7 +30,7 @@ public class DeviceSelfTest extends BaseCommandHandler {
@Override @Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) { public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> { return runAsync(() -> {
DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet();
/* DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet();
CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand); CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand);
commandWait(overallDeviceStatusGetCommandFuture); commandWait(overallDeviceStatusGetCommandFuture);
@ -45,7 +45,7 @@ public class DeviceSelfTest extends BaseCommandHandler {
if (xAxisAtOrigin && yAxisAtOrigin && zAxisAtOrigin) { if (xAxisAtOrigin && yAxisAtOrigin && zAxisAtOrigin) {
deviceStatus.setSelfTestCompleted(true); deviceStatus.setSelfTestCompleted(true);
} }
*/
/* DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet(); /* DeviceCommand overallDeviceStatusGetCommand = DeviceCommandGenerator.overallDeviceStatusGet();
CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand); CommandFuture overallDeviceStatusGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), overallDeviceStatusGetCommand);
commandWait(overallDeviceStatusGetCommandFuture); commandWait(overallDeviceStatusGetCommandFuture);

8
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java

@ -29,6 +29,14 @@ public class NozzlePipelinePreFillStop extends BaseCommandHandler {
@Override @Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) { public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> { return runAsync(() -> {
DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动
DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动
DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动
CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand);
CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand);
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand);
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture);
//1.停止推动注射泵 //1.停止推动注射泵
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand);

8
src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java

@ -29,6 +29,14 @@ public class SyringePipelineWashStop extends BaseCommandHandler {
@Override @Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) { public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> { return runAsync(() -> {
DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动
DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动
DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动
CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand);
CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand);
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand);
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture);
//1.停止推动注射泵 //1.停止推动注射泵
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand);

Loading…
Cancel
Save