#
Junjie
9 天以前 728ad81fa10d2879654c5f9ae4314db94eafb865
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
45
46
package com.zy.core.task;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.asrs.service.DeviceConfigService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.action.ShuttleAction;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
@Slf4j
@Component
public class ShuttleExecuteScheduler {
 
//    @Autowired
//    private ShuttleAction shuttleAction;
//    @Autowired
//    private DeviceConfigService deviceConfigService;
//    @Autowired
//    private RedisUtil redisUtil;
//
//    @Scheduled(cron = "0/1 * * * * ? ")
//    public void execute() {
//        List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
//                .eq("device_type", String.valueOf(SlaveType.Shuttle)));
//        for (DeviceConfig deviceConfig : shuttleList) {
//            Object object = redisUtil.get(RedisKeyType.SHUTTLE_FLAG.key + deviceConfig.getDeviceNo());
//            if (object == null) {
//                continue;
//            }
//
//            int taskNo = Integer.parseInt(String.valueOf(object));
//            if (taskNo != 0) {
//                //存在任务需要执行
//                boolean result = shuttleAction.executeWork(deviceConfig.getDeviceNo(), taskNo);
//            }
//        }
//    }
 
}