| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从redis中重启任务 |
| | | */ |
| | | public synchronized void restartTaskFromRedis() { |
| | | HashMap<Object, Object> map = redisUtil.getRedis(); |
| | | for (Object key : map.keySet()) { |
| | | if (key.toString().contains("lift_wrk_no_")) {//提升机任务 |
| | | LiftRedisCommand redisCommand = JSON.parseObject(map.get(key).toString(), LiftRedisCommand.class); |
| | | if (redisCommand == null) { |
| | | continue; |
| | | } |
| | | |
| | | Short liftNo = redisCommand.getLiftNo(); |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo.intValue()); |
| | | if (liftThread == null) { |
| | | continue; |
| | | } |
| | | LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | if (!liftProtocol.isIdle()) { |
| | | continue; |
| | | } |
| | | |
| | | //提升机处于空闲状态,进行任务的恢复 |
| | | liftProtocol.setTaskNo(redisCommand.getWrkNo());//将提升机线程分配任务号 |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);//工作状态 |
| | | liftProtocol.setLiftLock(true);//提升机锁定 |
| | | |
| | | }else {//四向穿梭车任务 |
| | | ShuttleRedisCommand redisCommand = JSON.parseObject(map.get(key).toString(), ShuttleRedisCommand.class); |
| | | if (redisCommand == null) { |
| | | continue; |
| | | } |
| | | |
| | | Short shuttleNo = redisCommand.getShuttleNo(); |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo.intValue()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (!shuttleProtocol.isIdle()) { |
| | | continue; |
| | | } |
| | | |
| | | //四向穿梭车处于空闲状态,进行任务的恢复 |
| | | shuttleProtocol.setTaskNo(redisCommand.getWrkNo());//将四向穿梭车线程分配任务号 |
| | | shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WORKING);//工作状态 |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 入库 ===>> 四向穿梭车入库作业下发 |