| | |
| | | private MainServiceImpl mainService; |
| | | // 所属线程 |
| | | private Thread thread; |
| | | private Thread thread2; |
| | | // 频率 |
| | | private int i = 0; |
| | | private int k = 0; |
| | |
| | | * =====>> 开始工作 |
| | | */ |
| | | public void start(){ |
| | | thread = new Thread(() -> { |
| | | thread = new Thread(this::crnAndDevRun); |
| | | thread.start(); |
| | | |
| | | thread2 = new Thread(this::roboticArmDispatch); |
| | | // thread2.start(); |
| | | } |
| | | private void crnAndDevRun() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | thread.start(); |
| | | } |
| | | |
| | | private void roboticArmDispatch() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | |
| | | // 间隔 |
| | | Thread.sleep(1000); |
| | | |
| | | // 系统运行状态判断 |
| | | if (!SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | continue; |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @PreDestroy |
| | | public void shutDown(){ |
| | | if (thread != null) thread.interrupt(); |
| | | if (thread2 != null) thread2.interrupt(); |
| | | } |
| | | |
| | | } |