| | |
| | | throw new CoolException("服务器错误"); |
| | | } |
| | | } |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setTaskNo(vo.getWorkNo()); |
| | | if (MessageQueue.offer(SlaveType.Ste, vo.getSteNo(), new Task(2, steCommand))) { |
| | | } else { |
| | | throw new CoolException("命令下发失败"); |
| | | } |
| | | basSte.setPakMk(vo.getPakMk()); |
| | | basSte.setWrkNo(vo.getWorkNo()); |
| | | basSte.setCrnNo(vo.getCrnNo()); |
| | |
| | | if (steNo != null) { |
| | | // 小车行走到堆垛机待搬移点 |
| | | if (wrkMast.getWrkSts() == 2L && wrkMast.getSteNo() == null) { |
| | | this.letCarBeReady(wrkMast, steNo, wrkMast.getLocNo()); |
| | | this.letCarBeWaiting(wrkMast, steNo, wrkMast.getLocNo()); |
| | | } |
| | | // 堆垛机将货放至小车上 3.小车待搬(小车不用搬运,已经在当前组库位) / 6.小车待入 ===>> 7.吊车入库中 |
| | | if (wrkMast.getWrkSts() == 3L || wrkMast.getWrkSts() == 6L) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 让小车从 远点 ====>> 待机 |
| | | * 等待堆垛机搬运 |
| | | */ |
| | | public void letCarBeWaiting(WrkMast wrkMast, Integer steNo, String locNo) { |
| | | // 获取穿梭车信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, steNo); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { return; } |
| | | if (steProtocol.isIdle()) { |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | SteCommand steCommand = new SteCommand(); |
| | | steCommand.setSteNo(steNo); // 穿梭车编号 |
| | | steCommand.setTaskNo(9999); // 工作号 |
| | | steCommand.setTaskMode(SteTaskModeType.findWaiting(steProtocol.getRow().intValue())); // 任务模式: 去近点 等待堆垛机叉取 |
| | | |
| | | steCommand.setRow(Utils.getGroupRow(steProtocol.getRow().intValue()).shortValue()); |
| | | steCommand.setBay(steProtocol.getBay()); |
| | | steCommand.setLev(steProtocol.getLev()); |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Ste, steNo, new Task(2, steCommand))) { |
| | | log.error("穿梭车命令下发失败,穿梭车号={},任务数据={}", steNo, JSON.toJSON(steCommand)); |
| | | } else { |
| | | // 修改工作档状态 绑定穿梭车 |
| | | wrkMast.setSteNo(steNo); |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("修改工作档状态 绑定穿梭车 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 让小车从 远点 ====>> 移动到近点 |
| | | * 等待堆垛机搬运 |
| | | */ |
| | |
| | | case 3: |
| | | case 11: |
| | | case 18: |
| | | return SteTaskModeType.IN_LEFT; // 右 |
| | | return SteTaskModeType.IN_RIGHT; // 右 |
| | | case 4: |
| | | case 12: |
| | | case 19: |
| | | return SteTaskModeType.IN_RIGHT; // 左 |
| | | return SteTaskModeType.IN_LEFT; // 左 |
| | | default: |
| | | throw new CoolException("解析穿梭车原点定位失败"); |
| | | } |
| | |
| | | case 16: |
| | | case 17: |
| | | case 18: |
| | | return SteTaskModeType.WAITING_LEFT; |
| | | return SteTaskModeType.WAITING_RIGHT; |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | |
| | | case 19: |
| | | case 20: |
| | | case 21: |
| | | return SteTaskModeType.WAITING_RIGHT; |
| | | return SteTaskModeType.WAITING_LEFT; |
| | | default: |
| | | throw new CoolException("解析穿梭车原点定位失败"); |
| | | } |
| | |
| | | OperateResult result = null; |
| | | // 开始任务 |
| | | if (!command.getComplete()) { |
| | | |
| | | // 1.任务号 |
| | | OperateResult result0 = siemensS7Net.Write("V998", command.getTaskNo().shortValue()); |
| | | try { |
| | | Thread.sleep(200); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 作业 |
| | | if (command.getTaskMode() != 0) { |
| | | // 1.任务号 |
| | | OperateResult result0 = siemensS7Net.Write("V998", command.getTaskNo().shortValue()); |
| | | try { |
| | | Thread.sleep(200); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 2.作业 |
| | | OperateResult result1 = siemensS7Net.Write("V1000", command.getTaskMode()); |
| | | // 3.确认开始任务 |
| | |
| | | |
| | | // 任务完成 |
| | | } else { |
| | | siemensS7Net.Write("V1000",(short) 0); |
| | | result = siemensS7Net.Write("V2000.1", true); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // public void modifyPos(int wrkNo, int row, int bay, int lev) { |
| | | // BasSteService service = SpringUtils.getBean(BasSteService.class); |
| | | // if (!service.updatePos(wrkNo,this.slave.getId(), row, bay, lev)) { |
| | | // log.error("更新{}号穿梭车定位失败 ===>> 排:【{}】, 列:【{}】,层:【{}】", this.slave.getId(), row, bay, lev); |
| | | // } |
| | | // } |
| | | |
| | | /******************************************************************************************/ |
| | | /**************************************** 测试专用 *****************************************/ |