#
Junjie
2024-10-16 0f5a5a759221bde50ace126eae797326837f5f72
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java
@@ -15,6 +15,7 @@
import com.zy.asrs.wcs.core.utils.*;
import com.zy.asrs.wcs.rcs.News;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
import com.zy.asrs.wcs.rcs.entity.Device;
import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol;
@@ -60,6 +61,8 @@
    private BasConveyorService basConveyorService;
    @Autowired
    private BasConveyorStaService basConveyorStaService;
    @Autowired
    private ShuttleDispatcher shuttleDispatcher;
    // 计算
    public Boolean accept(Motion motion) {
@@ -68,6 +71,8 @@
        if (shuttleThread == null) {
            return false;
        }
        Device shuttleDevice = shuttleThread.getDevice();
        ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
        if (null == shuttleProtocol) {
            return false;
@@ -272,6 +277,21 @@
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_UPDATE_LOCATION;
                shuttleCommands.add(shuttleThread.getUpdateLocationCommand(motion.getTaskNo(), motion.getTarget()));
                break;
            case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位
                shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO;
                //获取全部待机位
                List<String> standbyLocs = JSON.parseArray(motion.getTemp(), String.class);
                //获取可用待机位
                String shuttleFromLiftStandbyLoc = shuttleDispatcher.searchAvailableLocNo(Integer.valueOf(shuttleDevice.getDeviceNo()), shuttleDevice.getHostId(), shuttleThread.getStatus().getCurrentLocNo(), standbyLocs);
                shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), shuttleFromLiftStandbyLoc, NavigationMapType.NORMAL.id, assignCommand, shuttleThread);
                //更新动作可用待机位
                motion.setTarget(shuttleFromLiftStandbyLoc);
                motion.setUpdateTime(new Date());
                motionService.updateById(motion);
                break;
            default:
                throw new CoolException(motion.getMotionCtgEl() + "没有指定任务作业流程!!!");
        }
@@ -461,6 +481,19 @@
                    return false;
                }
                break;
            case SHUTTLE_MOVE_STANDBY://穿梭车移动到待机位
                if (!shuttleProtocol.getCurrentLocNo().equals(motion.getTarget())) {
                    return false;
                }
                if (Optional.ofNullable(motion.getReleaseShuttle()).orElse(0) == 1) {//释放穿梭车
                    task.setShuttleNo(0);
                    task.setUpdateTime(new Date());
                    if (!taskService.updateById(task)) {
                        return false;
                    }
                }
                break;
            default:
                break;
        }