石墨消解仪后端服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.9 KiB

3 months ago
3 months ago
3 months ago
  1. package com.iflytop.gd.app.cmd;
  2. import com.iflytop.gd.app.core.BaseCommandHandler;
  3. import com.iflytop.gd.app.model.dto.CmdDTO;
  4. import com.iflytop.gd.app.service.DeviceCommandUtilService;
  5. import com.iflytop.gd.app.service.SelfTestService;
  6. import com.iflytop.gd.common.annotation.CommandMapping;
  7. import lombok.RequiredArgsConstructor;
  8. import lombok.extern.slf4j.Slf4j;
  9. import org.springframework.stereotype.Component;
  10. import java.util.concurrent.CompletableFuture;
  11. /**
  12. * 龙门架机械臂指定轴回原点
  13. */
  14. @Slf4j
  15. @Component
  16. @RequiredArgsConstructor
  17. @CommandMapping("gantry_origin")//业务指令注解
  18. public class GantryXOriginCommand extends BaseCommandHandler {
  19. private final DeviceCommandUtilService deviceCommandUtilService;
  20. private final SelfTestService selfTestService;
  21. @Override
  22. public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
  23. return runAsync(() -> {
  24. Boolean x = cmdDTO.getBooleanParam("x");//x轴是否回原点
  25. Boolean y = cmdDTO.getBooleanParam("y");//y轴是否回原点
  26. Boolean z = cmdDTO.getBooleanParam("z");//z轴是否回原点
  27. if (x != null && x) {
  28. deviceCommandUtilService.gantryXMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
  29. selfTestService.getSelfTestState().setGantryXOrigin(true);//设置是否在原点状态
  30. }
  31. if (y != null && y) {
  32. deviceCommandUtilService.gantryYMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
  33. selfTestService.getSelfTestState().setGantryYOrigin(true);//设置是否在原点状态
  34. }
  35. if (z != null && z) {
  36. deviceCommandUtilService.gantryZMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
  37. selfTestService.getSelfTestState().setGantryZOrigin(true);//设置是否在原点状态
  38. }
  39. });
  40. }
  41. }