| | |
| | | // 所属线程 |
| | | private Thread thread; |
| | | private Thread thread2; |
| | | private Thread thread3; |
| | | private Thread thread4; |
| | | |
| | | /** |
| | | * =====>> 开始工作 |
| | | */ |
| | | public void start(){ |
| | | thread = new Thread(() -> { |
| | | thread = new Thread(this::crnAndDevRun); |
| | | thread.start(); |
| | | |
| | | thread2 = new Thread(this::crnAndDevOtherRun); |
| | | thread2.start(); |
| | | |
| | | thread3 = new Thread(this::demoRun); |
| | | thread3.start(); |
| | | |
| | | thread4 = new Thread(this::demoOpenRun); |
| | | thread4.start(); |
| | | } |
| | | |
| | | private void crnAndDevRun() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | // 间隔 |
| | | Thread.sleep(1000); |
| | | // 系统运行状态判断 |
| | | if (!SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | continue; |
| | | } |
| | | // 系统演示模式运行状态判断 |
| | | if (SystemProperties.WCS_RUNNING_STATUS_DEMO.get()) { |
| | | continue; |
| | | } |
| | | // 入库 ===>> 入库站到堆垛机站,根据条码扫描生成入库工作档 |
| | |
| | | mainService.storeFinished(); |
| | | // 任务下发 |
| | | mainService.taskStart(); |
| | | // 出库 ===>> 堆垛机2分钟无任务则回到源点 |
| | | // 出库 ===>> 堆垛机10分钟无任务则回到源点 |
| | | mainService.crnStnToOutStnSou(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | thread.start(); |
| | | |
| | | thread2 = new Thread(() -> { |
| | | } |
| | | private void crnAndDevOtherRun() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | // 间隔 |
| | | Thread.sleep(400); |
| | | // 系统运行状态判断 |
| | | if (!SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | continue; |
| | | } |
| | | // 系统演示模式运行状态判断 |
| | | if (SystemProperties.WCS_RUNNING_STATUS_DEMO.get()) { |
| | | continue; |
| | | } |
| | | // 出库 ===>> 堆垛机出库站到出库站 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | thread2.start(); |
| | | } |
| | | |
| | | private void demoRun() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | // 间隔 |
| | | Thread.sleep(1000); |
| | | // 系统运行状态判断 |
| | | if (!SystemProperties.WCS_RUNNING_STATUS.get()) { |
| | | continue; |
| | | } |
| | | // 系统演示模式运行状态判断 |
| | | if (!SystemProperties.WCS_RUNNING_STATUS_DEMO.get()) { |
| | | continue; |
| | | } |
| | | // 出库 ===>> 堆垛机出库站到出库站 |
| | | mainService.crnStnToOutStn(); |
| | | // 入出库 ===>> 堆垛机入出库作业下发 |
| | | mainService.crnIoExecute(); |
| | | // 其他 ===>> LED显示器显示时间 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void demoOpenRun() { |
| | | while (!Thread.currentThread().isInterrupted()) { |
| | | try { |
| | | // 间隔 |
| | | Thread.sleep(1000); |
| | | // 系统演示模式运行状态变化 |
| | | if (SystemProperties.WCS_RUNNING_STATUS_DEMO.get()) { |
| | | if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 2){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 3){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 0){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 1){ |
| | | |
| | | } |
| | | } else { |
| | | if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 0){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 1){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 2){ |
| | | |
| | | } else if (SystemProperties.WCS_RUNNING_STATUS_DEMO_VALUE == 3){ |
| | | |
| | | } |
| | | } |
| | | // 其他 ===>> LED显示器显示时间 |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @PreDestroy |
| | | public void shutDown(){ |
| | | if (thread != null) thread.interrupt(); |
| | | if (thread2 != null) thread2.interrupt(); |
| | | if (thread3 != null) thread3.interrupt(); |
| | | if (thread4 != null) thread4.interrupt(); |
| | | } |
| | | |
| | | } |