| | |
| | | import com.zy.asrs.entity.BasCrnp; |
| | | import com.zy.asrs.service.BasCrnOptService; |
| | | import com.zy.asrs.service.BasCrnpService; |
| | | import com.zy.asrs.service.DeviceErrorService; |
| | | import com.zy.core.CrnThread; |
| | | import com.zy.core.cache.CrnErrCache; |
| | | import com.zy.core.cache.MessageQueue; |
| | |
| | | * 堆垛机是否在回原点运动中标记 |
| | | */ |
| | | private boolean backHpFlag = false; |
| | | public Long currentTimeMilliConnectCrn= 0L; |
| | | |
| | | public SiemensCrnThread(CrnSlave slave) { |
| | | this.slave = slave; |
| | |
| | | command.setDestinationPosY((short)0); // 目标库位列 |
| | | command.setDestinationPosZ((short)0); // 目标库位层 |
| | | write(command); |
| | | break; |
| | | // 复位 |
| | | case 4: |
| | | CrnCommand command4 = (CrnCommand) task.getData(); |
| | | if (null == command4) { |
| | | command4 = new CrnCommand(); |
| | | } |
| | | command4.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | command4.setTaskNo((short) 9999); // 工作号 |
| | | command4.setAckFinish((short) 0); // 任务完成确认位 |
| | | command4.setTaskMode(CrnTaskModeType.GO_ORIGIN); // 任务模式 |
| | | command4.setSourcePosX((short)0); // 源库位排 |
| | | command4.setSourcePosY((short)0); // 源库位列 |
| | | command4.setSourcePosZ((short)0); // 源库位层 |
| | | int row = slave.getId() * 2; |
| | | command4.setDestinationPosX((short)row); // 目标库位排 |
| | | command4.setDestinationPosY((short)1); // 目标库位列 |
| | | command4.setDestinationPosZ((short)1); // 目标库位层 |
| | | write(command4); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | initCrn(); |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】读取堆垛机plc状态信息失败 ===>> [id:{1}] [ip:{2}] [port:{3}] [rack:{4}] [slot:{5}]", DateUtils.convert(new Date()), slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot())); |
| | | log.error("读取堆垛机plc状态信息失败 ===>> [id:{}] [ip:{}] [port:{}] [rack:{}] [slot:{}]", slave.getId(), slave.getIp(), slave.getPort(), slave.getRack(), slave.getSlot()); |
| | | if (System.currentTimeMillis()-currentTimeMilliConnectCrn>1000*60*10){ |
| | | try{ |
| | | DeviceErrorService deviceErrorService = SpringUtils.getBean(DeviceErrorService.class); |
| | | deviceErrorService.addDeviceError("Crn", slave.getId(), "读取堆垛机plc状态信息失败"); |
| | | } catch (Exception e2){ |
| | | Thread.sleep(1000); |
| | | // log.error("e2:"+e2.getMessage()); |
| | | } |
| | | if (currentTimeMilliConnectCrn == 0){ |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis()-1000*60*10-1; |
| | | } else { |
| | | currentTimeMilliConnectCrn = System.currentTimeMillis(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | isRunning = false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 清除作业启动中 |
| | | */ |
| | | @Override |
| | | public void setWrkSign() { |
| | | } |
| | | |
| | | } |