严智鑫
2024-05-07 b365a0879edc787655b908b0dbb65b5e966bb23b
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
package com.mes.job;
 
import cn.hutool.json.JSONObject;
import com.mes.workstation.service.UpWorkstationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
@Component
@Slf4j
public class PlcLoadGlassTask {
 
    @Autowired
    private UpWorkstationService upWorkstationService;
 
 
    /**
     * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成)
     * fixedDelay : 上一个调用结束后再次调用的延时
     */
    @Scheduled(fixedDelay = 300)
    public void plcLoadGlassTask() throws InterruptedException {
        JSONObject jsonObject = new JSONObject();
        try {
            Thread.sleep(300);
            upWorkstationService.selectPriority();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
}