| | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.BasLift; |
| | | import com.zy.asrs.entity.BasLiftOpt; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.WrkMastMapper; |
| | | import com.zy.asrs.service.BasLiftOptService; |
| | | import com.zy.asrs.service.BasLiftService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.CommonUtils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.DevpThread; |
| | |
| | | short[] array = getCommandArr(command);//获取命令报文 |
| | | |
| | | try { |
| | | Thread.sleep(1000);//命令下发前休眠1s |
| | | Thread.sleep(500);//命令下发前休眠 |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command))); |
| | | |
| | | try { |
| | | Thread.sleep(1000);//命令下发后休眠 |
| | | Thread.sleep(500);//命令下发后休眠 |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | for (int i = 0; i < 5; i++) { |
| | | if (command.getRun().intValue() == 4 || command.getRun().intValue() == 5) { |
| | | break;//系统复位和链条停止转动不需要重发 |
| | | } |
| | | readStatus();//重新读取状态 |
| | | if (liftProtocol.getRunning()) { |
| | | break; |
| | |
| | | News.info("提升机命令下发[id:{}] >>>>> {},次数:{}", slave.getId(), JSON.toJSON(command), i); |
| | | OutputQueue.LIFT.offer(MessageFormat.format("【{0}】[id:{1}] >>>>> 命令下发: {2},次数:{}", DateUtils.convert(new Date()), slave.getId(), JSON.toJSON(command), i)); |
| | | try { |
| | | Thread.sleep(3000);//命令下发后休眠 |
| | | Thread.sleep(300);//命令下发后休眠 |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | return false; |
| | | } |
| | | |
| | | WrkMastMapper wrkMastMapper = SpringUtils.getBean(WrkMastMapper.class); |
| | | Object o = redisUtil.get("lift_wrk_no_" + wrkNo); |
| | | if (o == null) { |
| | | return false; |
| | |
| | | //站点和输送线ID不为null,需要下发站点指令调度指定站点进行链条转动 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, command.getDevpId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(command.getOperaStaNo().intValue()); |
| | | staProtocol = staProtocol.clone(); |
| | | if (!staProtocol.isLiftArrival()) {//链条转动条件,需要有提升机到位信号 |
| | | liftProtocol.setPakMk(true); |
| | | return false; |
| | |
| | | boolean result1 = MessageQueue.offer(SlaveType.Devp, devpId, new Task(3, staProtocol));//下发命令使输送线链条运转 |
| | | } |
| | | |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo(wrkNo.intValue()); |
| | | if (wrkMast != null) { |
| | | if (wrkMast.getWrkSts() == 28) {//28.提升机搬运中 |
| | | if (command.getRun().intValue() == 1 && command.getDistPosition().intValue() == LiftLevType.TWO.lev) { |
| | | //提升机移动且位置是到输送线楼层,需要判断站点货物是否无物,提升机是否有物 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, command.getDevpId()); |
| | | //工作档源库位楼层 |
| | | int wrkMastLocNoLey = Utils.getLev(wrkMast.getSourceLocNo()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(Utils.levToOutInStaNo(wrkMastLocNoLey >= 2 ? wrkMastLocNoLey + 1 : wrkMastLocNoLey));//起始站点 |
| | | //判断输送站点是否有物,只有无物情况才能继续调度提升机 |
| | | if (staProtocol.isLoading()) { |
| | | //有物禁止调度 |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //下发命令 |
| | | if (!write(command)) { |
| | | News.error("提升机命令下发失败,提升机号={},任务数据={}", command.getLiftNo(), JSON.toJSON(command)); |