|
|
@ -0,0 +1,40 @@ |
|
|
|
package com.qyft.ms.app.front.cmd.business; |
|
|
|
|
|
|
|
import com.qyft.ms.system.common.annotation.CommandMapping; |
|
|
|
import com.qyft.ms.system.common.device.command.CommandFuture; |
|
|
|
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; |
|
|
|
import com.qyft.ms.system.core.handler.BaseCommandHandler; |
|
|
|
import com.qyft.ms.system.model.bo.DeviceCommand; |
|
|
|
import com.qyft.ms.system.model.form.FrontCmdControlForm; |
|
|
|
import com.qyft.ms.system.service.device.DeviceCommandService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
|
|
|
/** |
|
|
|
* xyz轴回原点方法 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
@CommandMapping("motor_xyz_origin") |
|
|
|
public class MotorXTZOrigin extends BaseCommandHandler { |
|
|
|
private final DeviceCommandService deviceCommandService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(FrontCmdControlForm form) { |
|
|
|
return runAsync(() -> { |
|
|
|
DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); // x轴回原点 |
|
|
|
CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXOriginCommand); |
|
|
|
|
|
|
|
DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin();//y轴回原点 |
|
|
|
CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYOriginCommand); |
|
|
|
|
|
|
|
DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin();//z轴回原点 |
|
|
|
CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZOriginCommand); |
|
|
|
commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |