Merge branch '0.8.X' of http://49.232.154.205:10100/DeXun/klp-oa into 0.8.X
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) {
|
||||
|
||||
@@ -1167,6 +1167,13 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
throw new RuntimeException("历史钢卷不允许占用实际库区!");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 已发货的钢卷不能占用实际库区,给出提醒
|
||||
if (bo.getStatus() != null && bo.getStatus().equals(1)) {
|
||||
if (bo.getActualWarehouseId() != null && !bo.getActualWarehouseId().equals(-1L)) {
|
||||
throw new RuntimeException("已发货的钢卷不允许占用实际库区!");
|
||||
}
|
||||
}
|
||||
// 直接更新钢卷属性
|
||||
WmsMaterialCoil updateCoil = BeanUtil.toBean(bo, WmsMaterialCoil.class);
|
||||
validEntityBeforeSave(updateCoil);
|
||||
@@ -1188,8 +1195,14 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
|
||||
// 更新实际库区的启用状态
|
||||
if (flag) {
|
||||
// 只有当新的库区ID不为空且与原库区ID不同时才更新库区状态
|
||||
if (bo.getActualWarehouseId() != null && !bo.getActualWarehouseId().equals(oldCoil.getActualWarehouseId())) {
|
||||
// 已发货的钢卷不能占用实际库区,释放旧库区
|
||||
if (bo.getStatus() != null && bo.getStatus().equals(1)) {
|
||||
if (oldCoil.getActualWarehouseId() != null) {
|
||||
updateActualWarehouseEnableStatus(oldCoil.getActualWarehouseId(), null);
|
||||
}
|
||||
} else if (bo.getActualWarehouseId() != null && !bo.getActualWarehouseId().equals(-1L)
|
||||
&& !bo.getActualWarehouseId().equals(oldCoil.getActualWarehouseId())) {
|
||||
// 只有当新的库区ID不为空(且不为-1)且与原库区ID不同时才更新库区状态
|
||||
updateActualWarehouseEnableStatus(oldCoil.getActualWarehouseId(), bo.getActualWarehouseId());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user