#
Junjie
2024-04-30 f09b972bb7adf8d4fd75fcb87c85973e493432a8
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -4,12 +4,14 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.wcs.common.ExecuteSupport;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.entity.Task;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.command.ShuttleRedisCommand;
import com.zy.asrs.wcs.core.model.enums.MotionCtgType;
import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import com.zy.asrs.wcs.core.model.enums.ShuttleTaskModeType;
import com.zy.asrs.wcs.core.service.BasShuttleService;
@@ -31,6 +33,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Component
public class ShuttleAction {
@@ -109,16 +112,6 @@
        if (shuttleProtocol == null) {
            return false;
        }
        //判断设备是否空闲
        if (!shuttleThread.isDeviceIdle()) {
            return false;
        }
//        if (!shuttleThread.isIdle(() -> {
//            return shuttleProtocol.getTaskNo().equals(taskNo);
//        })) {
//            return false;
//        }
        //判断工作号是否相同
        if (!shuttleProtocol.getTaskNo().equals(taskNo)) {
@@ -222,6 +215,20 @@
        //取出命令
        ShuttleCommand command = commands.get(commandStep);
        Integer mode = command.getMode();
        //判断设备是否空闲
        if (!shuttleThread.isDeviceIdle(new ExecuteSupport() {
            @Override
            public Boolean judgement() {
                if (ShuttleCommandModeType.CHARGE_CLOSE.id.equals(mode)) {//关闭充电motion
                    return false;//不需要判断状态
                }
                return true;//需要判断状态
            }
        })) {
            return false;
        }
        // 下发命令
        if (!write(command, device)) {
            News.error("四向穿梭车命令下发失败,穿梭车号={},任务数据={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));