#
Junjie
2024-06-08 3ce75be2e677235149e6d9b2f3141bfde7395dbd
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -9,6 +9,7 @@
import com.zy.asrs.common.utils.HttpHandler;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SnowflakeIdWorker;
import com.zy.asrs.framework.exception.CoolException;
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;
@@ -440,7 +441,7 @@
    /**
     * 出库 ====>> 同一时间一台穿梭车只能有一个出库任务
     */
    public synchronized void generateOutboundWrkMast() {
    public synchronized void analyzeOutBoundTask() {
        List<Task> tasks = taskService.selectPakOut();
        if (tasks.isEmpty()) {
            return;
@@ -476,6 +477,23 @@
//                    continue;//浅库位存在未执行任务
//                }
                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.generateMotion(task);
                if (Cools.isEmpty(motionList)) {
@@ -495,6 +513,25 @@
        }
    }
    // 解析小车移动工作档
    public synchronized void analyzeMoveTask() {
        for (Task task : taskService.selectWaitAnalyzeMoveTask()) {
            // generate motion list
            List<Motion> motionList = analyzeService.generateMotion(task);
            if (motionList.isEmpty()) {
                continue;
            }
            motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()));
            // 更新工作主档
            task.setTaskSts(TaskStsType.ANALYZE_MOVE.sts); // 工作状态
            task.setUpdateTime(new Date());
            if (!taskService.updateById(task)) {
                News.error("更新工作档失败!!! [工作号:{}]", task.getTaskNo());
            }
        }
    }
    /**
     * 四向穿梭车电量检测 ===>> 发起充电
     */