自动化立体仓库 - WMS系统
zhou zhou
2025-12-30 0eab67f624c2b3349002860b408942265a076b9e
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.zy.asrs.task.core.ReturnT;
import com.zy.asrs.task.handler.InventoryReserveExpireHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
/**
 * 预留库存过期定时任务调度器
 * 定期检查并处理过期的预留库存
 */
@Slf4j
@Component
public class InventoryReserveScheduler {
 
    @Autowired
    private InventoryReserveExpireHandler inventoryReserveExpireHandler;
 
    /**
     * 每分钟执行一次,检查过期的预留库存
     */
    @Scheduled(cron = "0 * * * * ?")
    public void checkExpiredReserve() {
        try {
            ReturnT<String> result = inventoryReserveExpireHandler.start();
            if (!result.isSuccess()) {
                log.error("预留库存过期处理失败: {}", result.getMsg());
            }
        } catch (Exception e) {
            log.error("预留库存过期定时任务异常", e);
        }
    }
 
}