石墨消解仪后端服务
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

package com.iflytop.gd.app.cmd;
import com.iflytop.gd.app.core.BaseCommandHandler;
import com.iflytop.gd.app.model.dto.CmdDTO;
import com.iflytop.gd.app.service.DeviceCommandUtilService;
import com.iflytop.gd.app.service.SelfTestService;
import com.iflytop.gd.common.annotation.CommandMapping;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* 龙门架机械臂指定轴回原点
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("gantry_origin")//业务指令注解
public class GantryXOriginCommand extends BaseCommandHandler {
private final DeviceCommandUtilService deviceCommandUtilService;
private final SelfTestService selfTestService;
@Override
public CompletableFuture<Void> handle(CmdDTO cmdDTO) {
return runAsync(() -> {
Boolean x = cmdDTO.getBooleanParam("x");//x轴是否回原点
Boolean y = cmdDTO.getBooleanParam("y");//y轴是否回原点
Boolean z = cmdDTO.getBooleanParam("z");//z轴是否回原点
if (x != null && x) {
deviceCommandUtilService.gantryXMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
selfTestService.getSelfTestState().setGantryXOrigin(true);//设置是否在原点状态
}
if (y != null && y) {
deviceCommandUtilService.gantryYMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
selfTestService.getSelfTestState().setGantryYOrigin(true);//设置是否在原点状态
}
if (z != null && z) {
deviceCommandUtilService.gantryZMoveOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand());
selfTestService.getSelfTestState().setGantryZOrigin(true);//设置是否在原点状态
}
});
}
}