| | |
| | | } |
| | | |
| | | //搜索是否有待处理的任务 |
| | | WrkMast wrkMast = wrkMastMapper.selectLiftStep62327(); |
| | | WrkMast wrkMast = wrkMastMapper.selectLiftStep262327(); |
| | | if (wrkMast == null) { |
| | | continue; |
| | | } |
| | |
| | | //给提升机分配任务 |
| | | liftProtocol.setLiftLock(true);//锁定提升机 |
| | | liftProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());//设置任务号 |
| | | liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//设置四向穿梭车号 |
| | | liftProtocol.setProtocolStatus(LiftProtocolStatusType.WORKING);//设置提升机状态为工作中 |
| | | |
| | | //找到四向穿梭车的线程 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, liftProtocol.getShuttleNo().intValue()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | //命令list |
| | | ArrayList<LiftCommand> commands = new ArrayList<>(); |
| | | |
| | | //当前穿梭车库位号 |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | //当前穿梭车楼层 |
| | | int currentLocNoLey = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length())); |
| | | if (wrkMast.getWrkSts() == 2) { |
| | | //工作档目标库位号 |
| | | String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo(); |
| | | //工作档目标库位楼层 |
| | | int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length())); |
| | | |
| | | //工作档目标库位号 |
| | | String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo(); |
| | | //工作档目标库位楼层 |
| | | int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length())); |
| | | //提升机当前楼层 |
| | | int liftLev = liftProtocol.getLev().intValue(); |
| | | if (liftLev != 1) { |
| | | //提升机不在1层 |
| | | LiftCommand command1 = new LiftCommand(); |
| | | command1.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command1.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command1.setRun((short) 1);//升降 |
| | | command1.setDistPosition((short) 1);//目标楼层1层 |
| | | command1.setLiftLock(true);//锁定提升机 |
| | | |
| | | //提升机当前楼层 |
| | | int liftLev = liftProtocol.getLev().intValue(); |
| | | if (liftLev != currentLocNoLey) { |
| | | //不同楼层 |
| | | LiftCommand command1 = new LiftCommand(); |
| | | command1.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command1.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command1.setRun((short) 1);//升降 |
| | | command1.setDistPosition((short) currentLocNoLey);//目标楼层(穿梭车所在楼层) |
| | | command1.setLiftLock(true);//锁定提升机 |
| | | commands.add(command1);//将命令添加进list |
| | | } |
| | | |
| | | commands.add(command1);//将命令添加进list |
| | | } |
| | | //输送线将货物运进来 |
| | | LiftCommand command2 = new LiftCommand(); |
| | | command2.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command2.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command2.setRun((short) 6);//输送线运作 |
| | | command2.setLiftLock(true);//锁定提升机 |
| | | |
| | | //输送线将四向穿梭车移动进来 |
| | | LiftCommand command2 = new LiftCommand(); |
| | | command2.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command2.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command2.setRun((short) 6);//输送线运作 |
| | | command2.setLiftLock(true);//锁定提升机 |
| | | commands.add(command2);//将命令添加进list |
| | | |
| | | commands.add(command2);//将命令添加进list |
| | | |
| | | if (liftLev != currentLocNoLey) { |
| | | //提升机前往目标楼层 |
| | | LiftCommand command3 = new LiftCommand(); |
| | | command3.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | |
| | | command3.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command3);//将命令添加进list |
| | | |
| | | //提升机到达指定楼层,输送线将货物移出去 |
| | | //输送线将货物移出去 |
| | | LiftCommand command4 = new LiftCommand(); |
| | | command4.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command4.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command4.setRun((short) 3);//输送线运作 |
| | | command4.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command4);//将命令添加进list |
| | | }else { |
| | | liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//设置四向穿梭车号 |
| | | |
| | | //找到四向穿梭车的线程 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, wrkMast.getShuttleNo()); |
| | | if (shuttleThread == null) { |
| | | continue; |
| | | } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | if (shuttleProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | //当前穿梭车库位号 |
| | | String currentLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | //当前穿梭车楼层 |
| | | int currentLocNoLey = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length())); |
| | | |
| | | //工作档目标库位号 |
| | | String wrkMastLocNo = wrkMast.getIoType() == 101 ? wrkMast.getSourceLocNo() : wrkMast.getLocNo(); |
| | | //工作档目标库位楼层 |
| | | int wrkMastLocNoLey = Integer.parseInt(wrkMastLocNo.substring(wrkMastLocNo.length() - 2, wrkMastLocNo.length())); |
| | | |
| | | //提升机当前楼层 |
| | | int liftLev = liftProtocol.getLev().intValue(); |
| | | if (liftLev != currentLocNoLey) { |
| | | //不同楼层 |
| | | LiftCommand command1 = new LiftCommand(); |
| | | command1.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command1.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command1.setRun((short) 1);//升降 |
| | | command1.setDistPosition((short) currentLocNoLey);//目标楼层(穿梭车所在楼层) |
| | | command1.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command1);//将命令添加进list |
| | | } |
| | | |
| | | //输送线将四向穿梭车移动进来 |
| | | LiftCommand command2 = new LiftCommand(); |
| | | command2.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command2.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command2.setRun((short) 6);//输送线运作 |
| | | command2.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command2);//将命令添加进list |
| | | |
| | | if (liftLev != currentLocNoLey) { |
| | | //提升机前往目标楼层 |
| | | LiftCommand command3 = new LiftCommand(); |
| | | command3.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command3.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command3.setRun((short) 1);//升降 |
| | | command3.setDistPosition((short) wrkMastLocNoLey);//工作档目标楼层 |
| | | command3.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command3);//将命令添加进list |
| | | } |
| | | |
| | | //提升机到达指定楼层,输送线将四向穿梭车移出去 |
| | | //输送线将四向穿梭车移动出去 |
| | | LiftCommand command4 = new LiftCommand(); |
| | | command4.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command4.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command4.setRun((short) 3);//输送线运作 |
| | | command4.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command4);//将命令添加进list |
| | | } |
| | | |
| | | //提升机到达指定楼层,输送线将四向穿梭车移出去 |
| | | //输送线将四向穿梭车移动出去 |
| | | LiftCommand command4 = new LiftCommand(); |
| | | command4.setLiftNo(liftProtocol.getLiftNo());//提升机号 |
| | | command4.setTaskNo(liftProtocol.getTaskNo());//任务号 |
| | | command4.setRun((short) 3);//输送线运作 |
| | | command4.setLiftLock(true);//锁定提升机 |
| | | |
| | | commands.add(command4);//将命令添加进list |
| | | |
| | | switch (wrkMast.getWrkSts().intValue()) { |
| | | case 2://2.设备上走 |
| | | wrkMast.setWrkSts(3L);//3.提升机搬运中 |
| | | break;//3.提升机搬运中 |
| | | case 6://6.迁移小车至提升机口完成 |
| | | wrkMast.setWrkSts(7L);//7.提升机迁移小车中 |
| | | break; |
| | |
| | | //提升机为等待确认 |
| | | if (liftProtocol.getProtocolStatus() == LiftProtocolStatusType.WAITING.id && liftProtocol.getTaskNo() != 0) { |
| | | //将任务档标记为完成 |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo72428(liftProtocol.getTaskNo().intValue()); |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo372428(liftProtocol.getTaskNo().intValue()); |
| | | if (wrkMast != null) { |
| | | switch (wrkMast.getWrkSts().intValue()) { |
| | | case 3://3.提升机搬运中 ==> 4.提升机搬运完成 |
| | | wrkMast.setWrkSts(4L); |
| | | break; |
| | | case 7://7.提升机迁移小车中 ==> 8.提升机迁移小车完成 |
| | | wrkMast.setWrkSts(8L); |
| | | break; |
| | |
| | | break; |
| | | case 28://28.提升机搬运中 ==> 29.提升机搬运完成 |
| | | wrkMast.setWrkSts(29L); |
| | | wrkMast.setWrkSts(34L);//34.出库完成,暂时先直接完成出库工作档,后续需要根据输送线给出的状态来确定34.出库完成状态 |
| | | break; |
| | | default: |
| | | } |