严智鑫
2024-03-31 38e2fda87c28fa7128d971e7afac1b05a06872d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.mes.service;
 
import com.mes.tools.WebSocketServer;
import org.springframework.stereotype.Component;
 
import java.util.function.Supplier;
 
@Component
public class Plchome extends Thread {
    private int i = 1;
    private final Supplier<PlcService> plcServiceSupplier;
 
    public Plchome() {
        this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(PlcService.class);
    }
 
 
 
    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                i++;
                Thread.sleep(100);
                PlcService plcService = plcServiceSupplier.get();
               // plcService.performPlcActions();
                //plcService.unloadpush();
 
                //当下片任务表状态为1时候将数据插入到下片玻璃信息表
                plcService.insertdownglassinfo();
 
 
 
                //当机械手任务表中状态为1 更新已经落架数量,并且把下片任务表的那条记录删掉 工位表流程卡绑定了架子
                plcService.down_workstation();
 
 
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                e.printStackTrace();
            }
        }
    }
}