#
Junjie
2025-08-13 4267b157278462ff6fd84bd0262fb50f641cdc83
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -62,7 +62,6 @@
 */
@Slf4j
@Service("mainService")
@Transactional
public class MainServiceImpl {
    public static final long COMMAND_TIMEOUT = 5 * 1000;
@@ -684,7 +683,7 @@
                staProtocol = staProtocol.clone();
            }
            if (staProtocol.isAutoing() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
            if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
                CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, wrkMast.getCrnNo());
                CrnProtocol crnProtocol = crnThread.getCrnProtocol();
@@ -1229,12 +1228,22 @@
                    }
                    if (crnProtocol.getCrnNo() == 1) {
                        //判断堆垛机和当前任务是否处于一个巷道
                        if (Utils.getLaneByLocNo(wrkMast.getSourceLocNo()) != crnProtocol.getCrnLane()) {
                            //判断堆垛机所在巷道是否存在其他任务,如存在则优先执行
                            List<WrkMast> currentWrkMasts = wrkMastService.selectLaneWrkMast(crnProtocol.getCrnLane(), false);
                            if (!currentWrkMasts.isEmpty()) {
                                continue;//当前堆垛机所在巷道存在任务
                        String turnCrnExecuteCurrentChannel = "Y";
                        Config turnCrnExecuteCurrentChannelConfig = configService.selectOne(new EntityWrapper<Config>()
                                .eq("code", "turnCrnExecuteCurrentChannel")
                        );
                        if (turnCrnExecuteCurrentChannelConfig != null) {
                            turnCrnExecuteCurrentChannel = turnCrnExecuteCurrentChannelConfig.getValue();
                        }
                        if(turnCrnExecuteCurrentChannel.equals("Y")) {
                            //判断堆垛机和当前任务是否处于一个巷道
                            if (Utils.getLaneByLocNo(wrkMast.getSourceLocNo()) != crnProtocol.getCrnLane()) {
                                //判断堆垛机所在巷道是否存在其他任务,如存在则优先执行
                                List<WrkMast> currentWrkMasts = wrkMastService.selectLaneWrkMast(crnProtocol.getCrnLane(), false);
                                if (!currentWrkMasts.isEmpty()) {
                                    continue;//当前堆垛机所在巷道存在任务
                                }
                            }
                        }
                    }
@@ -1520,6 +1529,7 @@
            if (wrkMastMapper.updateById(wrkMast) == 0) {
                News.error("" + mark + " - 3" + " - 5" + " - 【库位移转】 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo());
            }
            crnProtocol.setLastIo("O");
        }
        News.infoNoLog("" + mark + " - 3" + " - 0" + " - 堆垛机入出库作业下发:库位移转完成");
@@ -1653,7 +1663,10 @@
                        crnThread.setResetFlag(true);
                    }
                }else {
                    if (wrkMast.getWrkSts() != 14 || wrkMast.getWrkSts() != 15) {
                    List<Long> list = new ArrayList<>();
                    list.add(14L);
                    list.add(15L);
                    if (!list.contains(wrkMast.getWrkSts())) {
                        News.error("" + mark + " - 1" + " - 堆垛机处于等待确认但工作档状态未完成。堆垛机号={},工作号={}", crn.getId(), crnProtocol.getTaskNo());
                        continue;
                    }
@@ -1877,9 +1890,13 @@
                        if (jsonObject.getInteger("code").equals(200)) {
                            StartupDto dto = jsonObject.getObject("data", StartupDto.class);
                            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
                                    .eq("loc_no", dto.getLocNo()));
                            // 更新站点信息 且 下发plc命令
                            staProtocol.setWorkNo(dto.getWorkNo().shortValue());
                            staProtocol.setStaNo(dto.getStaNo().shortValue());
                            staProtocol.setPalletSize(locMast.getLocType2());
                            devpThread.setPakMk(staProtocol.getSiteId(), false);
                            boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                            if (!result) {
@@ -2000,6 +2017,7 @@
                    // 更新站点信息 且 下发plc命令
                    staProtocol.setWorkNo((short) workNo);
                    staProtocol.setStaNo((short) 2003);
                    staProtocol.setPalletSize((short) 1);
                    devpThread.setPakMk(staProtocol.getSiteId(), false);
                    boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol));
                    if (!result) {