| | |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | staProtocol.setPakMk(false); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | @Async |
| | | public void crnStnToOutStn() { |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | // 遍历拣料入库口 |
| | | for (DevpSlave.Sta outSta : devp.getOutSta()) { |
| | | for (CrnSlave crnSlave : slaveProperties.getCrn()) { |
| | | // 遍历堆垛机出库站 |
| | | for (CrnSlave.CrnStn crnStn : crnSlave.getCrnOutStn()) { |
| | | // 获取堆垛机出库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(outSta.getStaNo()); |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, crnStn.getDevpPlcId()); |
| | | StaProtocol staProtocol = devpThread.getStation().get(crnStn.getStaNo()); |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) { |
| | | // 查询工作档 |
| | | WrkMast wrkMast = wrkMastMapper.selectPakOutStep2(staProtocol.getSiteId()); |
| | |
| | | // 移动中 |
| | | continue; |
| | | } |
| | | // 更新工作档状态为14失败 todo:luxiaotao |
| | | // 判断堆垛机状态等待确认 |
| | | if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.getTaskNo().equals(wrkMast.getWrkNo().shortValue()) |
| | | && crnProtocol.statusType == CrnStatusType.IDLE |
| | | && crnProtocol.statusType == CrnStatusType.WAITING |
| | | && crnProtocol.forkPosType == CrnForkPosType.HOME) { |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 1.复位堆垛机 |
| | | crnThread.setResetFlag(true); |
| | | |
| | | // 2.下发站点信息 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(2, staProtocol))) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | |
| | | // 更新工作档状态为14失败 |
| | | wrkMast.setWrkSts(14L); |
| | | wrkMast.setCrnEndTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | throw new CoolException("更新工作档的工作状态为14失败,工作号"+wrkMast.getWrkNo()); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 1.复位堆垛机 更新堆垛机信息 且 下发plc命令 todo:luxiaotao |
| | | crnProtocol.setStatus(CrnStatusType.IDLE); |
| | | crnProtocol.setTaskNo((short)0); |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(4, crnProtocol))) { |
| | | throw new CoolException("更新堆垛机信息失败"); |
| | | } |
| | | |
| | | // 2.下发站点信息 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | if (!MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol))) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | // // 命令下发区 ------------------------------------------------------------------------- |
| | | // 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); |
| | | } |
| | | |
| | | // 完成通知档 |