feat(material): 优化钢卷物料导出功能

- 添加Excel字典格式注解支持数据类型转换
- 新增钢卷ID字段用于数据关联
- 增加操作完成时间字段显示
- 实现根据操作ID查询钢卷待办动作完成时间
- 添加钢卷ID到数据库查询映射
- 重构导出查询逻辑支持操作完成时间获取
This commit is contained in:
2026-03-20 17:39:41 +08:00
parent 195df97521
commit 0da1386a5d
4 changed files with 50 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ package com.klp.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.klp.common.annotation.Excel;
import com.klp.common.annotation.ExcelDictFormat;
import lombok.Data;
import java.math.BigDecimal;
@@ -173,7 +174,8 @@ public class WmsMaterialCoilAllExportVo {
private Date updateTime;
// 数据类型
@Excel(name = "数据类型", readConverterExp = "0=历史,1=当前")
@ExcelProperty(value = "数据类型")
@ExcelDictFormat(readConverterExp = "0=历史,1=现存")
private Integer dataType;
// 调制度
@@ -188,6 +190,7 @@ public class WmsMaterialCoilAllExportVo {
private String businessPurpose;
// 是否与订单相关 readConverterExp
@Excel(name = "是否与订单相关", readConverterExp = "0=否,1=是")
@ExcelProperty(value = "是否与订单相关")
@ExcelDictFormat(readConverterExp = "0=否,1=是")
private Integer isRelatedToOrder;
}

View File

@@ -184,4 +184,15 @@ public class WmsMaterialCoilExportVo {
// 是否与订单相关 readConverterExp
private Integer isRelatedToOrder;
/**
* 钢卷ID 此处不展示在报表只是方便set值
*/
private Long coilId;
/**
* 操作完成时间根据actionIds查询wms_coil_pending_action表获取
*/
@ExcelProperty(value = "操作完成时间")
private Date actionCompleteTime;
}

View File

@@ -2421,10 +2421,42 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
*/
@Override
public List<WmsMaterialCoilExportVo> queryExportList(WmsMaterialCoilBo bo) {
Map<Long, Date> coilIdCompleteTimeMap = new HashMap<>();
if ((bo.getCoilIds() == null || bo.getCoilIds().isEmpty())
&& bo.getActionIds() != null && !bo.getActionIds().isEmpty()) {
String[] actionIdArr = bo.getActionIds().split(",");
List<Long> actionIdList = Arrays.stream(actionIdArr)
.map(String::trim)
.filter(s -> !s.isEmpty())
.map(Long::parseLong)
.collect(Collectors.toList());
LambdaQueryWrapper<WmsCoilPendingAction> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(WmsCoilPendingAction::getActionId, actionIdList);
List<WmsCoilPendingAction> actions = coilPendingActionMapper.selectList(queryWrapper);
if (actions != null && !actions.isEmpty()) {
for (WmsCoilPendingAction action : actions) {
coilIdCompleteTimeMap.put(action.getCoilId(), action.getCompleteTime());
}
bo.setCoilIds(actions.stream()
.map(a -> String.valueOf(a.getCoilId()))
.collect(Collectors.joining(",")));
}
}
QueryWrapper<WmsMaterialCoil> lqw = buildQueryWrapperPlus(bo);
List<WmsMaterialCoilExportVo> wmsMaterialCoilExportVos = baseMapper.selectExportList(lqw);
// 遍历数据,根据状态替换日期字段,并处理空值兜底
wmsMaterialCoilExportVos.stream().forEach(vo -> {
// 设置action完成时间
if (coilIdCompleteTimeMap.containsKey(vo.getCoilId())) {
vo.setActionCompleteTime(coilIdCompleteTimeMap.get(vo.getCoilId()));
}
// 判断查询条件中的status是否为1已发货
if (bo.getStatus() != null && bo.getStatus() == 1) {
Date finalDate = null;