| | |
| | | // 如果最近一次是入库模式 |
| | | if (crnProtocol.getLastIo().equals("I")) { |
| | | if (basCrnp.getInEnable().equals("Y")) { |
| | | this.crnStnToLoc(crn); // 入库 |
| | | this.crnStnToLoc(crn, crnProtocol); // 入库 |
| | | crnProtocol.setLastIo("O"); |
| | | } else if (basCrnp.getOutEnable().equals("Y")) { |
| | | this.locToCrnStn(crn); // 出库 |
| | | this.locToCrnStn(crn, crnProtocol); // 出库 |
| | | crnProtocol.setLastIo("I"); |
| | | } |
| | | } |
| | | // 如果最近一次是出库模式 |
| | | else if (crnProtocol.getLastIo().equals("O")) { |
| | | if (basCrnp.getOutEnable().equals("Y")) { |
| | | this.locToCrnStn(crn); // 出库 |
| | | this.locToCrnStn(crn, crnProtocol); // 出库 |
| | | crnProtocol.setLastIo("I"); |
| | | } else if (basCrnp.getInEnable().equals("Y")) { |
| | | this.crnStnToLoc(crn); // 入库 |
| | | this.crnStnToLoc(crn, crnProtocol); // 入库 |
| | | crnProtocol.setLastIo("O"); |
| | | } |
| | | } |
| | | } |
| | | // 库位移转 |
| | | this.locToLoc(crn); |
| | | this.locToLoc(crn, crnProtocol); |
| | | } |
| | | } |
| | | |
| | |
| | | * 入库 ===>> 堆垛机站到库位 |
| | | */ |
| | | @Async |
| | | public void crnStnToLoc(CrnSlave slave){ |
| | | public void crnStnToLoc(CrnSlave slave, CrnProtocol crnProtocol){ |
| | | for (CrnSlave.CrnStn crnStn : slave.getCrnInStn()) { |
| | | boolean flag = false; |
| | | // 获取堆垛机入库站信息 |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 堆垛机控制过滤 |
| | | if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) { |
| | | continue; |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | |
| | | * 出库 ===>> 库位到堆垛机站 |
| | | */ |
| | | @Async |
| | | public void locToCrnStn(CrnSlave slave){ |
| | | public void locToCrnStn(CrnSlave slave, CrnProtocol crnProtocol){ |
| | | for (CrnSlave.CrnStn crnStn : slave.getCrnOutStn()) { |
| | | // 获取工作状态为11(生成出库ID)的出库工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakOutStep1(slave.getId()); |
| | |
| | | if (staProtocol.isAutoing() && !staProtocol.isLoading() && staDetl.getCanouting() !=null && staDetl.getCanouting().equals("Y") |
| | | && staProtocol.getWorkNo() == 0) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 堆垛机控制过滤 |
| | | if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) { |
| | | continue; |
| | | } |
| | | |
| | | // 1.堆垛机开始移动 |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | |
| | | * 库位移转 |
| | | */ |
| | | @Async |
| | | public void locToLoc(CrnSlave slave){ |
| | | public void locToLoc(CrnSlave slave, CrnProtocol crnProtocol){ |
| | | // 获取工作档信息 |
| | | WrkMast wrkMast = wrkMastMapper.selectLocMove(slave.getId()); |
| | | if (null == wrkMast) { |
| | |
| | | if (!basCrnp.getInEnable().equals("Y") && !basCrnp.getOutEnable().equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | // 堆垛机控制过滤 |
| | | if (!crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() != 0) { |
| | | return; |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | |
| | | log.error("【库位移转】 修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | wrkMast.setModiTime(now); |
| | | // 修改成功后复位堆垛机 |
| | | if (wrkMastMapper.updateById(wrkMast) > 0) { |
| | | // // 命令下发区 ------------------------------------------------------------------------- |
| | | // if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | // // 堆垛机复位 |
| | | // if (!MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(3, new CrnCommand()))) { |
| | | // log.error("堆垛机复位命令下发失败,工作号={}", wrkMast.getWrkNo()); |
| | | // } |
| | | // } |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | } |
| | | |