feat(material): 优化钢卷物料导出功能
- 添加Excel字典格式注解支持数据类型转换 - 新增钢卷ID字段用于数据关联 - 增加操作完成时间字段显示 - 实现根据操作ID查询钢卷待办动作完成时间 - 添加钢卷ID到数据库查询映射 - 重构导出查询逻辑支持操作完成时间获取
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -474,6 +474,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
END AS itemTypeDesc,
|
||||
-- 物品ID
|
||||
mc.item_id AS itemId,
|
||||
-- 钢卷ID
|
||||
mc.coil_id AS coilId,
|
||||
-- 数据类型
|
||||
mc.data_type AS dataType,
|
||||
-- 逻辑库区
|
||||
|
||||
Reference in New Issue
Block a user