Junjie
2026-04-11 37efb9725fcbcf921534d032ad2aa4ce2aaa7fde
src/main/java/com/zy/core/plugin/GslProcess.java
@@ -130,7 +130,29 @@
                        && stationProtocol.getTaskNo() == 0
                        && stationProtocol.isEnableIn()
                ) {
                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, commonService.getWorkNo(WrkIoType.ENABLE_IN.id), stationId, entity.getBarcodeStation().getStationId(), 0);
                    if (stationProtocol.getIoMode() != 1) {
                        continue;//不属于入库模式
                    }
                    //启动入库,删除条码站退回限制
                    Integer backStationId = entity.getBarcodeStation().getStationId();
                    String lockKey = RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + backStationId;
                    if (redisUtil.hasKey(lockKey)) {
                        StationProtocol backStationProtocol = stationMap.get(backStationId);
                        if (backStationProtocol == null) {
                            continue;
                        }
                        if (backStationProtocol.isAutoing()
                                && !backStationProtocol.isLoading()
                                && stationProtocol.getTaskNo() == 0
                        ) {
                            //条码站自动、无物、工作号0。删除条码站退回限制
                            redisUtil.del(lockKey);
                        }
                    }
                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, commonService.getWorkNo(WrkIoType.ENABLE_IN.id), stationId, backStationId, 0);
                    stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "gsl-process", "enable-in");
                    if (entity.getBarcodeStation() != null && entity.getBarcodeStation().getStationId() != null) {
                        Utils.precomputeInTaskEnableRow(entity.getBarcodeStation().getStationId());
@@ -167,23 +189,44 @@
                if (!handleErrorStationBack(basDevp, stationThread, stationObjModel, stationMap.get(stationId))) {
                    continue;
                }
                if (!canRequestStoreIn(stationMap.get(stationId))) {
                StationProtocol stationProtocol = stationMap.get(stationId);
                if (stationProtocol == null) {
                    continue;
                }
                if (!stationProtocol.isAutoing()) {
                    continue;
                }
                if (!stationProtocol.isLoading()) {
                    continue;
                }
                if (!stationProtocol.isInEnable()) {
                    continue;
                }
                if (stationProtocol.getTaskNo() == 0) {
                    continue;
                }
                if (Cools.isEmpty(stationProtocol.getBarcode())) {
                    continue;
                }
                if (stationProtocol.getError() > 0) {
                    continue;
                }
                if (stationProtocol.isInBarcodeError()) {
                    continue;
                }
                storeInTaskGenerationService.submitGenerateStoreTask(this, basDevp, stationObjModel, DISPATCH_INTERVAL_MS,
                        () -> storeInTaskGenerationService.generate(this, basDevp, stationObjModel));
            }
        }
    }
    private boolean canRequestStoreIn(StationProtocol stationProtocol) {
        return stationProtocol != null
                && stationProtocol.getError() <= 0
                && stationProtocol.isAutoing()
                && stationProtocol.isLoading()
                && stationProtocol.isInEnable()
                && stationProtocol.getTaskNo() > 0
                && !Cools.isEmpty(stationProtocol.getBarcode());
    }
    private boolean handleErrorStationBack(BasDevp basDevp,
@@ -242,10 +285,7 @@
            return false;
        }
        Integer lockTaskNo = stationProtocol.getTaskNo();
        String lockKey = (lockTaskNo != null && lockTaskNo > 0)
                ? RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + lockTaskNo
                : RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + "station_" + stationProtocol.getStationId();
        String lockKey = RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId();
        Object lock = redisUtil.get(lockKey);
        if (lock != null) {
            return false;
@@ -260,8 +300,8 @@
            return false;
        }
        stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "gsl-process", "station-back");
        News.taskInfo(stationProtocol.getTaskNo(), "扫码异常,已退回至{}", backStation.getStationId());
        redisUtil.set(lockKey, "lock", 10);
        News.info("{}扫码站异常,已退回至{},条码站状态:{}", stationProtocol.getTaskNo(), backStation.getStationId(), JSON.toJSONString(stationProtocol));
        redisUtil.set(lockKey, "lock", 60 * 60);
        return false;
    }