#
zjj
2025-04-08 3df03c486fde77ab36b9298a94bdbb0aa065a7e2
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -8,25 +8,16 @@
import com.zy.asrs.common.domain.param.SearchLocParam;
import com.zy.asrs.common.utils.HttpHandler;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.framework.common.SnowflakeIdWorker;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wcs.core.action.LiftAction;
import com.zy.asrs.wcs.core.domain.dto.MatDto;
import com.zy.asrs.wcs.core.domain.dto.RedisMapDto;
import com.zy.asrs.wcs.core.domain.dto.StaDto;
import com.zy.asrs.wcs.core.domain.param.CreateInTaskParam;
import com.zy.asrs.wcs.core.entity.*;
import com.zy.asrs.wcs.core.kernel.AnalyzeService;
import com.zy.asrs.wcs.core.model.MapNode;
import com.zy.asrs.wcs.core.model.command.LiftAssignCommand;
import com.zy.asrs.wcs.core.model.command.LiftCommand;
import com.zy.asrs.wcs.core.model.enums.*;
import com.zy.asrs.wcs.core.service.*;
import com.zy.asrs.wcs.core.utils.OpenUtils;
import com.zy.asrs.wcs.core.utils.RedisUtil;
import com.zy.asrs.wcs.core.utils.ShuttleDispatcher;
import com.zy.asrs.wcs.core.utils.Utils;
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.constant.DeviceRedisConstant;
@@ -34,7 +25,6 @@
import com.zy.asrs.wcs.rcs.model.command.LedCommand;
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;
import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
import com.zy.asrs.wcs.rcs.model.protocol.StaProtocol;
import com.zy.asrs.wcs.rcs.service.DeviceService;
@@ -45,7 +35,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
/**
@@ -95,6 +84,10 @@
    private OpenUtils openUtils;
    @Autowired
    private LiftAction liftAction;
    @Autowired
    private LiftDispatcher liftDispatcher;
    @Autowired
    private ShuttleStandbyService shuttleStandbyService;
    /**
     * 组托
@@ -172,33 +165,28 @@
                            && staProtocol.isPakMk()
                    ) {
                        // 获取条码扫描仪信息
                        DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId());
                        if(deviceBarcode == null) {
                        Object object = redisUtil.get(DeviceRedisConstant.LIFT_PALLET_INBOUND + inSta.getStaNo());
                        if (object != null) {
                            continue;
                        }
                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, Integer.parseInt(deviceBarcode.getDeviceId()));
                        if (barcodeThread == null) {
                            continue;
                        }
                        String barcode = barcodeThread.getBarcode();
//                        // 获取条码扫描仪信息
//                        DeviceBarcode deviceBarcode = deviceBarcodeService.getById(basConveyorSta.getBarcodeId());
//                        if(deviceBarcode == null) {
//                            continue;
//                        }
//                        BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, Integer.parseInt(deviceBarcode.getDeviceId()));
//                        if (barcodeThread == null) {
//                            continue;
//                        }
//                        String barcode = barcodeThread.getBarcode();
//                        if (!Cools.isEmpty(barcode)) {
//                            News.info("{}号条码扫描器检测条码信息:{}", deviceBarcode.getId(), barcode);
//                        }
                        String barcode = staProtocol.getBarcode();
                        if (!Cools.isEmpty(barcode)) {
                            News.info("{}号条码扫描器检测条码信息:{}", deviceBarcode.getId(), barcode);
                            if ("NG".endsWith(barcode) || "NoRead".equals(barcode) || "empty".equals(barcode) || "00000000".equals(barcode)) {
                                staProtocol.setWorkNo((short) 32002);
                                staProtocol.setStaNo(inSta.getBackSta().shortValue());
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                                devpThread.writeWorkSta(staProtocol.getSiteId(), (short) 32002, inSta.getBackSta().shortValue());
                                // led 异常显示
                                LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, inSta.getLed());
                                if (ledThread != null) {
                                    String errorMsg = "扫码失败,请重试";
                                    ledThread.error(errorMsg);
                                }
                                continue;
                            }
                            News.info("条码扫描器检测条码信息:{}", barcode);
                        }
                        // 判断重复工作档
@@ -209,7 +197,7 @@
                        if (task1 != null) {
                            News.error("工作档已存在,工作号={}", task1.getTaskNo());
                            if (staProtocol.getWorkNo().intValue() != Integer.parseInt(task1.getTaskNo())) {
                                devpThread.writeWorkSta(staProtocol.getSiteId(), Short.parseShort(task1.getTaskNo()), Short.parseShort(task1.getDestSite()));
                                devpThread.writeWorkSta(staProtocol.getSiteId(), Short.parseShort(task1.getTaskNo()), Short.parseShort(task1.getOriginSite()));
                                devpThread.setPakMk(staProtocol.getSiteId(), false);
                                News.info("输送线入库命令下发,任务数据={}", JSON.toJSON(task1));
                            }
@@ -242,43 +230,43 @@
                            if (code.equals(200)) {
                                StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                                String wmsLocNo = dto.getLocNo();
                                int row = Integer.parseInt(wmsLocNo.substring(0, 2));
                                int bay = Integer.parseInt(wmsLocNo.substring(2, 5));
                                int lev = Integer.parseInt(wmsLocNo.substring(5, 7));
                                row -= 16;
                                String wcsLocNo = Utils.getLocNo(row, bay, lev);
//                                String wmsLocNo = dto.getLocNo();
//                                int row = Integer.parseInt(wmsLocNo.substring(0, 2));
//                                int bay = Integer.parseInt(wmsLocNo.substring(2, 5));
//                                int lev = Integer.parseInt(wmsLocNo.substring(5, 7));
//                                String wcsLocNo = Utils.getLocNo(row, bay, lev);
//
//                                CreateInTaskParam createInTaskParam = new CreateInTaskParam();
//                                createInTaskParam.setTaskNo(String.valueOf(dto.getWorkNo()));
//                                createInTaskParam.setDestLoc(wcsLocNo);
//                                createInTaskParam.setOriginSite(dto.getSourceStaNo().toString());
//                                createInTaskParam.setDestSite(dto.getStaNo().toString());
//                                createInTaskParam.setPriority(11);
//                                createInTaskParam.setBarcode(barcode);
//
//                                R result = openUtils.createInTask(createInTaskParam);
//                                News.info("创建入库任务,任务数据={},WMS响应={},请求响应={}", JSON.toJSON(param), JSON.toJSON(jsonObject), JSON.toJSON(result));
//                                try{
//                                    String msg = "";
//                                    HashMap<String, String> hashMap = new HashMap<>();
//                                    hashMap.put("msg", msg);
//                                    hashMap.put("sta", inSta.getStaNo().toString());
//                                    new HttpHandler.Builder()
//                                            .setUri(wmsUrl)
//                                            .setPath("/rpc/led/getError")
//                                            .setJson(JSON.toJSONString(hashMap))
//                                            .build()
//                                            .doPost();
//                                }catch (Exception e){
//
//                                }
                                CreateInTaskParam createInTaskParam = new CreateInTaskParam();
                                createInTaskParam.setTaskNo(String.valueOf(dto.getWorkNo()));
                                createInTaskParam.setDestLoc(wcsLocNo);
                                createInTaskParam.setOriginSite("31002");
                                createInTaskParam.setDestSite("31004");
                                createInTaskParam.setPriority(11);
                                createInTaskParam.setBarcode(barcode);
                                R result = openUtils.createInTask(createInTaskParam);
                                News.info("创建入库任务,任务数据={},WMS响应={},请求响应={}", JSON.toJSON(param), JSON.toJSON(jsonObject), JSON.toJSON(result));
                                try{
                                    String msg = "";
                                    HashMap<String, String> hashMap = new HashMap<>();
                                    hashMap.put("msg", msg);
                                    hashMap.put("sta", "31001");
                                    new HttpHandler.Builder()
                                            .setUri(wmsUrl)
                                            .setPath("/rpc/led/getError")
                                            .setJson(JSON.toJSONString(hashMap))
                                            .build()
                                            .doPost();
                                }catch (Exception e){
                                }
                                redisUtil.set(DeviceRedisConstant.LIFT_PALLET_INBOUND + inSta.getStaNo(), "in", 10);
                            }else {
                                String msg = jsonObject.getString("msg");
                                HashMap<String, String> hashMap = new HashMap<>();
                                hashMap.put("msg", msg);
                                hashMap.put("sta", "31001");
                                hashMap.put("sta", inSta.getStaNo().toString());
                                new HttpHandler.Builder()
                                        .setUri(wmsUrl)
                                        .setPath("/rpc/led/getError")
@@ -290,134 +278,6 @@
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 入库-托盘进库
     */
    public synchronized void palletInbound() {
        try {
            // 根据输送线plc遍历
            List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                    .eq(Device::getDeviceType, DeviceCtgType.CONVEYOR.val())
                    .eq(Device::getStatus, 1));
            for (Device devp : list) {
                BasConveyor basConveyor = basConveyorService.getOne(new LambdaQueryWrapper<BasConveyor>().eq(BasConveyor::getDeviceId, devp.getId()).eq(BasConveyor::getHostId, devp.getHostId()));
                // 遍历入库口
                for (StaDto inSta : JSON.parseArray(basConveyor.getInSta(), StaDto.class)) {
                    BasConveyorSta basConveyorSta = basConveyorStaService.selectBySiteNo(inSta.getDeviceStaNo().toString());
                    if(basConveyorSta == null) {
                        continue;
                    }
                    // 获取入库站信息
                    DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, devp.getId().intValue());
                    StaProtocol staProtocol = devpThread.getStation().get(inSta.getDeviceStaNo());
                    if (staProtocol == null) {
                        continue;
                    } else {
                        staProtocol = staProtocol.clone();
                    }
                    int workNo = staProtocol.getWorkNo().intValue();
                    // 判断是否满足入库条件
                    if (staProtocol.isAutoing()
                            && staProtocol.isLoading()
                            && staProtocol.isInEnable()
                            && (workNo >= 0)
                            && staProtocol.isPakMk()
                    ) {
                        Object object = redisUtil.get(DeviceRedisConstant.LIFT_PALLET_INBOUND + workNo);
                        if (object != null) {
                            continue;
                        }
                        Task task = taskService.getOne(new LambdaQueryWrapper<Task>()
                                .eq(Task::getDestSite, inSta.getDeviceStaNo())
                                .in(Task::getTaskSts, TaskStsType.NEW_INBOUND.sts)
                                .eq(Task::getTaskNo, workNo));
                        if (task != null) {
                            int lev = Utils.getLev(task.getDestLoc());
                            Integer targetSite = null;
                            if (lev == 1) {
                                targetSite = 31006;
                            }else if (lev == 2) {
                                targetSite = 31007;
                            }else if (lev == 3) {
                                targetSite = 31008;
                            }
                            if(targetSite == null) {
                                throw new CoolException(lev + "层站点信息不存在");
                            }
                            StaProtocol staProtocol1 = devpThread.getStation().get(targetSite);
                            if (staProtocol1 == null) {
                                break;
                            }
                            if (!staProtocol1.isAutoing()) {
                                break;
                            }
                            if (staProtocol1.isLoading()) {
                                break;
                            }
                            if (staProtocol1.getWorkNo().intValue() != 0) {
                                break;
                            }
                            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, inSta.getLiftNo());
                            if (liftThread == null) {
                                break;
                            }
                            LiftProtocol liftProtocol = liftThread.getStatus();
                            if (liftProtocol == null) {
                                break;
                            }
                            if (!liftThread.isIdle()) {
                                break;
                            }
                            if (motionService.count(new LambdaQueryWrapper<Motion>()
                                    .eq(Motion::getDeviceCtg, DeviceCtgType.LIFT.val())
                                    .eq(Motion::getDevice, inSta.getLiftNo())
                                    .eq(Motion::getMotionSts, MotionStsType.EXECUTING.val())) > 0) {
                                break;
                            }
                            //检测提升机是否有任务绑定
                            boolean liftResult = Utils.checkLiftHasBinding(liftProtocol.getLiftNo(), String.valueOf(workNo));
                            if (liftResult) {
                                //存在任务,禁止执行
                                break;
                            }
                            //每次执行提升机指令都绑定提升机
                            task.setLiftNo(liftProtocol.getLiftNo());
                            task.setUpdateTime(new Date());
                            if (!taskService.updateById(task)) {
                                break;
                            }
                            List<LiftCommand> command = liftThread.getPalletInOutCommand(workNo, 1, lev, inSta.getDeviceStaNo(), targetSite, LiftCommandModeType.PALLET_INOUT);
                            LiftAssignCommand assignCommand = new LiftAssignCommand();
                            assignCommand.setLiftNo(liftProtocol.getLiftNo());
                            assignCommand.setTaskNo(workNo);
                            assignCommand.setDeviceTaskNo(liftThread.generateDeviceTaskNo(workNo, MotionCtgType.LIFT_WITH_GOODS));
                            assignCommand.setCommands(command);
                            liftAction.assignWork(liftThread.getDevice(), assignCommand);
                            redisUtil.set(DeviceRedisConstant.LIFT_PALLET_INBOUND + workNo, "send", 60 * 60 * 6);
                            break;
                        }
                    }
                }
            }
@@ -629,9 +489,10 @@
                    // 判断是否满足入库条件
                    if (staProtocol.isAutoing()
                            && staProtocol.isLoading()
                            && staProtocol.isInEnable()
                            && (workNo >= 0)
                            && staProtocol.isPakMk()
//                            && staProtocol.isPakMk()
                    ) {
                        Task task = taskService.getOne(new LambdaQueryWrapper<Task>()
@@ -648,20 +509,51 @@
                                }
                            }
                            //获取距离目标位置最近的可换层提升机(可能不空闲)
                            LiftThread liftThread = liftDispatcher.searchLift(task.getDestLoc(), task.getHostId(), true);
                            if (liftThread == null) {
                                continue;
                            }
                            Device transferLiftDevice = liftThread.getDevice();
                            //获取小车待机库位 ==> 进提升机
                            ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
                                    .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
                                    .eq(ShuttleStandby::getDeviceLev, Utils.getLev(task.getDestLoc()))
                                    .eq(ShuttleStandby::getStatus, 1));
                            //穿梭车进提升机库位号
                            String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
                            //穿梭车进提升机待机位库位号  输送线位置
                            String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
                            //不走提升机
                            if (staProtocol.getSiteId() == 1015 || staProtocol.getSiteId() == 1026) {
                                standbyLocNoTo = staProtocol.getLocNo();
                            }
                            if (Cools.isEmpty(task.getShuttleNo())) {
                                //分配小车
                                //搜索空闲车
                                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
                                if (shuttleThread == null) {
                                //调度空闲车去取货待机位
                                Device shuttleDevice = shuttleDispatcher.dispatchShuttle(task, standbyLocNoTo);
                                if (shuttleDevice == null) {
                                    News.info("{}任务未找到空闲穿梭车", task.getTaskNo());
                                    continue;
                                }
                                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//保存穿梭车号
                                task.setShuttleNo(Integer.valueOf(shuttleDevice.getDeviceNo()));//保存穿梭车号
                                task.setUpdateTime(new Date());
                                if (!taskService.updateById(task)) {
                                    News.info("{}任务更新穿梭车号失败", task.getTaskNo());
                                }
                                continue;
                            }
                            //判断小车是否到达取货待机位置
                            String shuttleLocNo = shuttleDispatcher.findShuttleLocNo(task.getShuttleNo(), task.getHostId());
                            if (shuttleLocNo == null) {
                                continue;
                            }
                            if (!standbyLocNoTo.equals(shuttleLocNo)) {
                                continue;
                            }
@@ -780,40 +672,26 @@
        }
        for (Task task : tasks) {
            BasConveyorSta originStaObj = basConveyorStaService.selectBySiteNo(task.getOriginSite());//获取源站
            if (originStaObj == null) {
            BasConveyorSta destStaObj = basConveyorStaService.selectBySiteNo(task.getDestSite());//获取目标站
            if (destStaObj == null) {
                continue;
            }
            BasConveyor basConveyor = basConveyorService.getById(originStaObj.getConveyorId());
            BasConveyor basConveyor = basConveyorService.getById(destStaObj.getConveyorId());
            if(basConveyor == null) {
                continue;
            }
            DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, basConveyor.getDeviceId().intValue());
            StaProtocol staProtocol = devpThread.getStation().get(Integer.parseInt(task.getOriginSite()));//源站
//            StaProtocol staProtocol1 = devpThread.getStation().get(Integer.parseInt(task.getDestSite()));//目标站
            StaProtocol staProtocol = devpThread.getStation().get(Integer.parseInt(task.getDestSite()));//目标站
            if (staProtocol == null) {
                continue;
            } else {
                staProtocol = staProtocol.clone();
//                staProtocol1 = staProtocol1.clone();
            }
            // 判断出库站状态
            if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) {
//                if (!(staProtocol1.isAutoing() && !staProtocol1.isLoading() && staProtocol1.getWorkNo() == 0 && staProtocol1.isOutEnable())) {
//                    continue;
//                }
//                //同库位组校验
//                List<String> outerLoc = Utils.getGroupOuterLoc(wrkMast.getSourceLocNo());
//                List<LocMast> outerLocMasts = locMastService.selectNotEmptyLocNos(outerLoc);
//                if (!outerLocMasts.isEmpty()) {
//                    News.info("{}任务,浅库位存在货物,系统等待中", wrkMast.getWrkNo());
//                    continue;//浅库位存在未执行任务
//                }
                if (Cools.isEmpty(task.getShuttleNo())) {
                    //分配小车
                    //搜索空闲车
@@ -834,7 +712,7 @@
                // generate motion list
                List<Motion> motionList = analyzeService.generateMotion(task);
                if (Cools.isEmpty(motionList)) {
                    log.error("出库 ===>> 暂时没有空闲小车, 任务号={}", task.getTaskNo());
                    log.error("出库 ===>> 任务解析失败, 任务号={}", task.getTaskNo());
                    continue;
                }
                motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
@@ -853,23 +731,6 @@
    // 解析小车移动工作档
    public synchronized void analyzeMoveTask() {
        for (Task task : taskService.selectWaitAnalyzeMoveTask()) {
            if (Cools.isEmpty(task.getShuttleNo())) {
                //分配小车
                //搜索空闲车
                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
                if (shuttleThread == null) {
                    News.info("{}任务未找到空闲穿梭车", task.getTaskNo());
                    continue;
                }
                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//保存穿梭车号
                task.setUpdateTime(new Date());
                if (!taskService.updateById(task)) {
                    News.info("{}任务更新穿梭车号失败", task.getTaskNo());
                }
                continue;
            }
            // generate motion list
            List<Motion> motionList = analyzeService.generateShuttleMoveMotion(task);
            if (motionList.isEmpty()) {
@@ -879,6 +740,54 @@
            // 更新工作主档
            task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts); // 工作状态
            task.setUpdateTime(new Date());
            if (!taskService.updateById(task)) {
                News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo());
            }
        }
    }
    // 解析小车充电工作档
    public synchronized void analyzeChargeTask() {
        List<Task> list = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, TaskStsType.NEW_CHARGE.sts));
        for (Task task : list) {
            String locNo = task.getDestLoc();
            Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
                    .eq(Device::getDeviceNo, task.getShuttleNo())
                    .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
                    .eq(Device::getHostId, task.getHostId())
                    .eq(Device::getStatus, 1));
            if (shuttleDevice == null) {
                continue;
            }
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
            if (shuttleThread == null) {
                continue;
            }
            ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
                continue;
            }
            String shuttleLocNo = task.getOriginLoc();
            if (Utils.getLev(locNo) != Utils.getLev(shuttleLocNo)) {
                shuttleDispatcher.dispatchShuttle(task, task.getDestLoc());
                continue;
            }
            // generate motion list
            List<Motion> motionList = analyzeService.generateChargeMotion(task);
            if (Cools.isEmpty(motionList)) {
                News.error("保存{}号四向穿梭车充电任务失败!!!", task.getTaskNo());
                continue;
            }
            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
            // 更新工作主档
            task.setTaskSts(TaskStsType.ANALYZE_CHARGE.sts);
            task.setUpdateTime(new Date());
            if (!taskService.updateById(task)) {
                News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo());
@@ -1013,15 +922,6 @@
            task.setMemo("charge");
            task.setShuttleNo(Integer.valueOf(device.getDeviceNo()));
            // generate motion list
            List<Motion> motionList = analyzeService.generateChargeMotion(task);
            if (Cools.isEmpty(motionList)) {
                News.error("保存{}号四向穿梭车充电任务失败!!!", device.getDeviceNo());
                continue;
            }
            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
            task.setTaskSts(TaskStsType.ANALYZE_CHARGE.sts);
            if (!taskService.save(task)) {
                News.error("保存{}号四向穿梭车充电任务失败!!!", device.getDeviceNo());
                continue;
@@ -1103,7 +1003,7 @@
            task.setTaskCtg(taskCtg.getId());
            task.setPriority(10);
            task.setOriginSite(null);
            task.setOriginLoc(null);
            task.setOriginLoc(shuttleProtocol.getCurrentLocNo());
            task.setDestSite(null);
            task.setDestLoc(standByLocNo); // 避让位置
            task.setIoTime(new Date());
@@ -1290,4 +1190,39 @@
        }
    }
    // 解析小车载货移动工作档
    public synchronized void analyzeLadenMoveTask() {
        for (Task task : taskService.selectWaitAnalyzeLadenMoveTask()) {
            if (Cools.isEmpty(task.getShuttleNo())) {
                //分配小车
                //搜索空闲车
                ShuttleThread shuttleThread = shuttleDispatcher.searchIdleShuttle(task);
                if (shuttleThread == null) {
                    News.info("{}任务未找到空闲穿梭车", task.getTaskNo());
                    continue;
                }
                task.setShuttleNo(Integer.valueOf(shuttleThread.getDevice().getDeviceNo()));//保存穿梭车号
                task.setUpdateTime(new Date());
                if (!taskService.updateById(task)) {
                    News.info("{}任务更新穿梭车号失败", task.getTaskNo());
                }
                continue;
            }
            // generate motion list
            List<Motion> motionList = analyzeService.generateShuttleLadenMoveMotion(task);
            if (motionList.isEmpty()) {
                continue;
            }
            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId());
            // 更新工作主档
            task.setTaskSts(TaskStsType.ANALYZE_LADEN_MOVE.sts); // 工作状态
            task.setUpdateTime(new Date());
            if (!taskService.updateById(task)) {
                News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo());
            }
        }
    }
}