自动化立体仓库 - WMS系统
zwl
4 天以前 29443551704a4f81cfc20ed9b75de5393b8b0944
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
package com.zy.asrs.task;
 
import com.core.common.R;
import com.zy.api.service.WcsApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
import java.util.Objects;
 
@Slf4j
@Component
public class WcsDeviceStatusScheduler {
 
    @Autowired
    private WcsApiService wcsApiService;
 
    @Value("${wcs.status-sync.enabled:true}")
    private Boolean enabled;
 
//    @Scheduled(
//            initialDelayString = "${wcs.status-sync.initial-delay:10000}",
//            fixedDelayString = "${wcs.status-sync.fixed-delay:5000}"
//    )
    private void execute() {
        if (!Boolean.TRUE.equals(enabled)) {
            return;
        }
        R result = wcsApiService.syncDeviceStatusFromWcs();
        if (!Objects.equals(result.get("code"), 200)) {
            log.warn("轮询同步WCS设备状态失败, result={}", result);
        }
    }
}