feat(warning): 添加产线类型字段支持告警功能
- 在 WmsMaterialWarning 实体中新增 actionType 字段 - 在 WmsMaterialWarningBo 和 WmsMaterialWarningVo 中添加 actionType 属性 - 更新 WmsMaterialWarningMapper.xml 映射文件以包含 actionType 字段 - 在 WmsMaterialWarningServiceImpl 中注入 WmsCoilPendingActionMapper - 实现告警查询时根据产线类型过滤的功能 - 在告警插入前查询并设置对应的产线类型信息 - 完善告警服务中的厚度和长度检查逻辑
This commit is contained in:
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.core.service.ConfigService;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.mapper.WmsCoilPendingActionMapper;
|
||||
import com.klp.mapper.WmsMaterialCoilMapper;
|
||||
import com.klp.service.IWmsMaterialCoilService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -18,6 +19,7 @@ import com.klp.domain.bo.WmsMaterialWarningBo;
|
||||
import com.klp.domain.vo.WmsMaterialWarningVo;
|
||||
import com.klp.domain.WmsMaterialCoil;
|
||||
import com.klp.domain.WmsMaterialWarning;
|
||||
import com.klp.domain.WmsCoilPendingAction;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
import com.klp.mapper.WmsMaterialWarningMapper;
|
||||
import com.klp.service.IWmsMaterialWarningService;
|
||||
@@ -43,6 +45,7 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
|
||||
private final WmsMaterialWarningMapper baseMapper;
|
||||
private final ConfigService configService;
|
||||
private final WmsCoilPendingActionMapper wmsCoilPendingActionMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,6 +94,7 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
}
|
||||
}
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getWarningType()), WmsMaterialWarning::getWarningType, bo.getWarningType());
|
||||
lqw.eq(bo.getActionType() !=null, WmsMaterialWarning::getActionType, bo.getActionType());
|
||||
lqw.eq(bo.getTheoreticalVal() != null, WmsMaterialWarning::getTheoreticalVal, bo.getTheoreticalVal());
|
||||
lqw.eq(bo.getActualVal() != null, WmsMaterialWarning::getActualVal, bo.getActualVal());
|
||||
lqw.eq(bo.getAllowDeviation() != null, WmsMaterialWarning::getAllowDeviation, bo.getAllowDeviation());
|
||||
@@ -179,8 +183,24 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
// ========== 厚度检查 ==========
|
||||
checkThickness(coil, bo, warnings);
|
||||
|
||||
// 批量插入
|
||||
// 批量插入(查询产线类型并设置)
|
||||
if (!warnings.isEmpty()) {
|
||||
Integer actionType = null;
|
||||
if (bo != null && bo.getActionId() != null) {
|
||||
try {
|
||||
WmsCoilPendingAction action = wmsCoilPendingActionMapper.selectById(bo.getActionId());
|
||||
if (action != null) {
|
||||
actionType = action.getActionType();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("查询产线类型失败, actionId={}", bo.getActionId(), e);
|
||||
}
|
||||
}
|
||||
if (actionType != null) {
|
||||
for (WmsMaterialWarning w : warnings) {
|
||||
w.setActionType(actionType);
|
||||
}
|
||||
}
|
||||
try {
|
||||
baseMapper.insertBatch(warnings);
|
||||
log.info("批量插入钢卷告警记录成功, coilId={}, 告警数={}", coil.getCoilId(), warnings.size());
|
||||
|
||||
Reference in New Issue
Block a user