fix(wms): 解决已发货钢卷占用实际库区的问题
- 添加了对已发货钢卷的状态检查,防止其占用实际库区 - 实现了已发货钢卷释放旧库区的功能 - 优化了库区状态更新逻辑,增加了对-1标识的判断 - 在钢卷占用库区时添加了发货状态验证 refactor(da): 优化酸轧OEE月度任务初始化方式 - 将@PostConstruct替换为ApplicationRunner接口实现 - 添加@Async注解实现异步执行,避免阻塞项目启动 - 重构了启动时OEE汇总计算的执行时机和方式
This commit is contained in:
@@ -7,10 +7,13 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -32,7 +35,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class AcidOeeMonthTask {
|
||||
public class AcidOeeMonthTask implements ApplicationRunner {
|
||||
|
||||
/** Redis 缓存 key 模板:当月 OEE 汇总(酸轧线) */
|
||||
private static final String SUMMARY_KEY_PATTERN = "oee:report:month:summary:%s:SY";
|
||||
@@ -48,10 +51,13 @@ public class AcidOeeMonthTask {
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 项目启动完成后立即计算一次当月酸轧 OEE 汇总并写入 Redis。
|
||||
* 项目启动完成后计算一次当月酸轧 OEE 汇总并写入 Redis。
|
||||
* 使用 ApplicationRunner 在 Spring Boot 启动完成后执行。
|
||||
* 使用 @Async 异步执行,不阻塞项目启动。
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
@Async
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
try {
|
||||
computeCurrentMonth("startup");
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user