| | |
| | | package com.zy.core.thread; |
| | | |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.ThreadHandler; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.Task; |
| | | import lombok.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.command.CrnCommand; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/4 |
| | | */ |
| | | @Slf4j |
| | | @Data |
| | | public class CrnThread implements Runnable, ThreadHandler { |
| | | public interface CrnThread extends ThreadHandler { |
| | | |
| | | private Slave slave; |
| | | CrnProtocol getStatus(); |
| | | |
| | | public CrnThread(Slave slave) { |
| | | this.slave = slave; |
| | | } |
| | | CrnCommand getPickAndPutCommand(String sourceLocNo, String targetLocNo, Integer taskNo, Integer crnNo);//取放货 |
| | | |
| | | @Override |
| | | @SuppressWarnings("InfiniteLoopStatement") |
| | | public void run() { |
| | | while (true) { |
| | | try { |
| | | Task task = MessageQueue.poll(SlaveType.Crn, slave.getId()); |
| | | if (task == null) { |
| | | System.out.println("无任务"); |
| | | } else { |
| | | System.out.println("任务"+task.getId()); |
| | | } |
| | | Thread.sleep(3000); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | CrnCommand getMoveCommand(String targetLocNo, Integer taskNo, Integer crnNo);//移动 |
| | | |
| | | } |
| | | } |
| | | CrnCommand getResetCommand(Integer crnNo);//复位 |
| | | |
| | | @Override |
| | | public void close() { |
| | | } |
| | | CommandResponse sendCommand(CrnCommand command);//下发命令 |
| | | |
| | | } |