| | |
| | | |
| | | @Value("${constant-parameters.avoidDistance}") |
| | | private Long avoidDistance; |
| | | @Autowired |
| | | private TaskWrkLogServiceImpl taskWrkLogService; |
| | | |
| | | public void generateStoreWrkFile() { |
| | | try { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 堆垛机5分钟无任务则回到源点 |
| | | */ |
| | | public void crnStnToOutStnSou() { |
| | | for (CrnSlave crn : slaveProperties.getCrn()) { |
| | | try{ |
| | | // 获取堆垛机信息 |
| | | CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, crn.getId()); |
| | | CrnProtocol crnProtocol = crnThread.getCrnProtocol(); |
| | | if (crnProtocol == null) { |
| | | continue; |
| | | } |
| | | BasCrnp basCrnp = basCrnpService.selectById(crn.getId()); |
| | | if (basCrnp == null) { |
| | | log.error("{}号堆垛机尚未在数据库进行维护!", crn.getId()); |
| | | continue; |
| | | } |
| | | |
| | | if (crnProtocol.getLaneNo()!=0 && (crnProtocol.getBay()!=1 || crnProtocol.getLevel()!=1)){ |
| | | if (crnProtocol.modeType == CrnModeType.AUTO && crnProtocol.statusType == CrnStatusType.IDLE && crnProtocol.getTaskNo() != 0) { |
| | | //获取工作档 |
| | | List<TaskWrk> taskWrks = taskWrkMapper.selectByLaneNo(crnProtocol.getLaneNo()); |
| | | if (!taskWrks.isEmpty()) { |
| | | continue; |
| | | } |
| | | List<TaskWrkLog> taskWrkLogs = taskWrkLogService.selectList(new EntityWrapper<TaskWrkLog>().eq("CRN_NO",crnProtocol.getLaneNo()).orderBy("COMPLETE_TIME",true)); |
| | | if (taskWrkLogs.isEmpty()) { |
| | | CrnCommand command = new CrnCommand(); |
| | | if (!MessageQueue.offer(SlaveType.Crn, crnProtocol.getCrnNo(), new Task(4, command))) { |
| | | log.error("堆垛机自动回源点失败,堆垛机号={}", crnProtocol.getCrnNo()); |
| | | } |
| | | } |
| | | // long differenceInSeconds = TimeCalculatorUtils.differenceInMilliseconds(taskWrkLogs.get(0).getCompleteTime(), new Date()); |
| | | // if (differenceInSeconds <= 1000) { |
| | | // return; |
| | | // } |
| | | |
| | | } |
| | | } |
| | | } catch (Exception e){ |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 入出库 ===>> 堆垛机入出库作业下发 |
| | | */ |
| | | public synchronized void crnIoExecute() throws IOException { |