| | |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.enums.WrkStsType; |
| | | import com.zy.core.model.StationObjModel; |
| | |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private BasCrnpService basCrnpService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | //执行输送站点入库任务 |
| | | public synchronized void stationInExecute() { |
| | |
| | | |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | |
| | | List<StationObjModel> list = basDevp.getInStationList$(); |
| | | List<StationObjModel> list = basDevp.getBarcodeStationList$(); |
| | | for (StationObjModel entity : list) { |
| | | Integer stationId = entity.getStationId(); |
| | | if(!stationMap.containsKey(stationId)){ |
| | |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、工作号9999 |
| | | Object lock = redisUtil.get(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId); |
| | | if(lock != null){ |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、有工作号 |
| | | if (stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 9999 |
| | | && stationProtocol.getTaskNo() > 0 |
| | | ) { |
| | | //检测任务是否生成 |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode())); |
| | |
| | | } |
| | | |
| | | if (wrkMast.getWrkSts() == WrkStsType.INBOUND_DEVICE_RUN.sts) { |
| | | continue; |
| | | } |
| | | |
| | | if (!wrkMast.getWrkNo().equals(stationProtocol.getTaskNo())) { |
| | | News.taskInfo(stationProtocol.getStationId(), "输送站点工作号:{}与条码搜索到的任务工作号:{}不一致", stationProtocol.getTaskNo(), wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | |
| | |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command)); |
| | | News.info("输送站点入库命令下发成功,站点号={},工作号={},命令数据={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command)); |
| | | redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5); |
| | | } |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId()); |
| | | if (lock != null) { |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、工作号0 |
| | | if (stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command)); |
| | | News.info("输送站点出库命令下发成功,站点号={},工作号={},命令数据={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command)); |
| | | redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5); |
| | | } |
| | | } |
| | | } |