Junjie
2023-03-27 eb5eb35a7ef56a01a4c788a8c2efef9fc7b823e7
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -10,15 +10,11 @@
import com.zy.asrs.mapper.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.MatDto;
import com.zy.common.model.SearchLocParam;
import com.zy.common.model.StartupDto;
import com.zy.common.model.*;
import com.zy.common.model.enums.WrkChargeType;
import com.zy.common.service.CommonService;
import com.zy.common.service.erp.ErpService;
import com.zy.common.utils.CollectionUtils;
import com.zy.common.utils.HttpHandler;
import com.zy.common.utils.*;
import com.zy.core.CrnThread;
import com.zy.core.DevpThread;
import com.zy.core.News;
@@ -26,17 +22,13 @@
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.*;
import com.zy.core.model.*;
import com.zy.core.model.command.CrnCommand;
import com.zy.core.model.command.LedCommand;
import com.zy.core.model.command.SteCommand;
import com.zy.core.model.command.*;
import com.zy.core.model.protocol.CrnProtocol;
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.model.protocol.StaProtocol;
import com.zy.core.model.protocol.SteProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.BarcodeThread;
import com.zy.core.thread.LedThread;
import com.zy.core.thread.SiemensDevpThread;
import com.zy.core.thread.SteThread;
import com.zy.core.thread.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -96,6 +88,8 @@
    private OrderMapper orderMapper;
    @Autowired
    private OrderDetlMapper orderDetlMapper;
    @Autowired
    private RedisUtil redisUtil;
    /**
     * 组托
@@ -612,6 +606,51 @@
    }
    /**
     * 入出库  ===>>  四向穿梭车入出库作业下发
     */
    public synchronized void shuttleIoExecute() {
        for (ShuttleSlave shuttle : slaveProperties.getShuttle()) {
            //获取四向穿梭车信息
            ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId());
            ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
            if (shuttleProtocol == null) {
                continue;
            }
            // 只有当四向穿梭车空闲 并且无任务时才继续执行
            if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.IDLE && shuttleProtocol.getTaskNo() == 0) {
                //入出库逻辑
                for (WrkMast wrkSts : wrkMastMapper.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", 2))) {
                    //分配任务号
                    shuttleProtocol.setTaskNo(wrkSts.getWrkNo().shortValue());
                    //分配源库位
                    shuttleProtocol.setSourceLocNo(wrkSts.getSourceLocNo());
                    //分配目标库位
                    shuttleProtocol.setLocNo(wrkSts.getLocNo());
                    ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
                    //四向穿梭车号
                    assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());
                    //任务号
                    assignCommand.setTaskNo(wrkSts.getWrkNo().shortValue());
                    //入出库模式
                    assignCommand.setTaskMode((short) 0);
                    //源库位
                    assignCommand.setSourceLocNo(wrkSts.getSourceLocNo());
                    //目标库位
                    assignCommand.setDistLocNo(wrkSts.getLocNo());
                    //下发任务
                    MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
                }
            }
        }
    }
    /**
     * 入出库  ===>>  堆垛机入出库作业下发
     */
    public synchronized void crnIoExecute(){