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);
|
}
|
}
|
}
|