package com.zy.asrs.task; import com.zy.asrs.entity.WrkMast; import com.zy.asrs.service.InboundCameraCaptureService; import com.zy.asrs.service.WrkMastService; 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 InboundCameraCaptureScheduler { @Autowired private WrkMastService wrkMastService; @Autowired private InboundCameraCaptureService inboundCameraCaptureService; @Scheduled(cron = "0/3 * * * * ? ") private void execute() { List wrkMasts = wrkMastService.selectPendingInboundCameraCapture(); if (wrkMasts == null || wrkMasts.isEmpty()) { return; } for (WrkMast wrkMast : wrkMasts) { try { inboundCameraCaptureService.processPendingCapture(wrkMast); } catch (Exception e) { log.warn("入库抓拍定时任务异常:workNo={}", wrkMast == null ? null : wrkMast.getWrkNo(), e); } } } }