| | |
| | | import HslCommunication.Profinet.Siemens.SiemensPLCS; |
| | | import HslCommunication.Profinet.Siemens.SiemensS7Net; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.BasCrnOpt; |
| | |
| | | private CrnProtocol crnProtocol; |
| | | private boolean resetFlag = false; |
| | | |
| | | public Long sign = System.currentTimeMillis(); |
| | | |
| | | public boolean isRunning = true; |
| | | |
| | | /** |
| | | * 堆垛机是否在回原点运动中标记 |
| | | */ |
| | |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | this.connect(); |
| | | while (true) { |
| | | while (isRunning) { |
| | | try { |
| | | int step = 1; |
| | | Task task = MessageQueue.poll(SlaveType.Crn, slave.getId()); |
| | |
| | | } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | } |
| | | |
| | | // System.out.println("第"+slave.getId()+"个堆垛机线程运行一轮:"+(System.currentTimeMillis()-sign)); |
| | | sign = System.currentTimeMillis(); |
| | | } |
| | | } |
| | | |
| | |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId())); |
| | | |
| | | // 复位信号 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | if (!Cools.isEmpty(crnProtocol.getStatusType()) && crnProtocol.getStatusType().equals(CrnStatusType.WAITING)) { |
| | | log.error("-------------------------------------------第一步、[堆垛机号:{}, 工作号:{}, 载货台:{}]==>> 状态为10,等待确认!!", |
| | | slave.getId(),crnProtocol.getTaskNo(), crnProtocol.getLoaded()==1 ? "有物" : "无物"); |
| | | if (resetFlag) { |
| | |
| | | |
| | | } |
| | | |
| | | // 提供一个方法来停止线程 |
| | | public void requestStop() { |
| | | isRunning = false; |
| | | } |
| | | |
| | | } |