| | |
| | | StationThread stationThread, |
| | | StationObjModel stationObjModel, |
| | | StationProtocol stationProtocol) { |
| | | if (stationProtocol == null) { |
| | | return false; |
| | | } |
| | | |
| | | if (!stationProtocol.isAutoing()) { |
| | | return false; |
| | | } |
| | |
| | | return true;//站点无异常 |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId()); |
| | | StationObjModel backStation = stationObjModel.getBackStation(); |
| | | if (backStation == null || backStation.getStationId() == null) { |
| | | News.warn("条码站退回失败,退回站未配置。deviceNo={},stationId={}", |
| | | basDevp == null ? null : basDevp.getDevpNo(), |
| | | stationProtocol.getStationId()); |
| | | return false; |
| | | } |
| | | |
| | | // 当前站点已经挂着退回目标时,不再重复生成新的退回工作号。 |
| | | if (stationProtocol.getTaskNo() != null |
| | | && stationProtocol.getTaskNo() > 0 |
| | | && backStation.getStationId().equals(stationProtocol.getTargetStaNo())) { |
| | | 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(); |
| | | Object lock = redisUtil.get(lockKey); |
| | | if (lock != null) { |
| | | return false; |
| | | } |
| | | |
| | | StationObjModel backStation = stationObjModel.getBackStation(); |
| | | StationCommand command = stationThread.getCommand(StationCommandType.MOVE, |
| | | commonService.getWorkNo(WrkIoType.STATION_BACK.id), |
| | | stationObjModel.getStationId(), |
| | |
| | | return false; |
| | | } |
| | | stationCommandDispatcher.dispatch(basDevp.getDevpNo(), command, "gsl-process", "station-back"); |
| | | News.taskInfo(stationProtocol.getTaskNo(), "{}扫码异常,已退回至{}", backStation.getStationId()); |
| | | redisUtil.set(RedisKeyType.GENERATE_STATION_BACK_LIMIT.key + stationProtocol.getStationId(), "lock", 10); |
| | | News.taskInfo(stationProtocol.getTaskNo(), "扫码异常,已退回至{}", backStation.getStationId()); |
| | | redisUtil.set(lockKey, "lock", 10); |
| | | return false; |
| | | } |
| | | |