feat(wms): 添加发货人字段并优化钢卷导出逻辑
- 在WmsMaterialCoilDeliveryExportVo中新增exportBy发货人字段 - 在数据库查询映射中添加export_by字段映射 - 优化导出逻辑,根据状态判断替换日期字段 - 添加发货时间、更新时间、创建时间的优先级处理 - 对历史数据的库区名称进行空值处理 - 完善钢卷导出列表的数据处理流程
This commit is contained in:
@@ -23,6 +23,10 @@ public class WmsMaterialCoilDeliveryExportVo extends WmsMaterialCoilExportVo {
|
||||
*/
|
||||
private Long coilId;
|
||||
|
||||
// 发货人
|
||||
@ExcelProperty(value = "发货人")
|
||||
private String exportBy;
|
||||
|
||||
// -------------------- 发货计划(plan) --------------------
|
||||
private Long planId;
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
vo.setBindPlanId(bind.getPlanId());
|
||||
vo.setBindPlanName(bind.getPlanName());
|
||||
vo.setBindPlanDate(bind.getPlanDate());
|
||||
|
||||
|
||||
// 补充设置更多的绑定信息字段
|
||||
vo.setBindLicensePlate(bind.getLicensePlate());
|
||||
vo.setBindConsigneeUnit(bind.getConsigneeUnit());
|
||||
@@ -2389,7 +2389,35 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
if (coilIds.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return baseMapper.selectDeliveryExportListByCoilIds(coilIds);
|
||||
List<WmsMaterialCoilDeliveryExportVo> wmsMaterialCoilDeliveryExportVos = baseMapper.selectDeliveryExportListByCoilIds(coilIds);
|
||||
// 遍历数据,根据状态替换日期字段,并处理空值兜底
|
||||
wmsMaterialCoilDeliveryExportVos.stream().forEach(vo -> {
|
||||
// 判断查询条件中的status是否为1(已发货)
|
||||
if (bo.getStatus() != null && bo.getStatus() == 1) {
|
||||
Date finalDate = null;
|
||||
// 1. 优先使用发货时间
|
||||
if (vo.getExportTime() != null) {
|
||||
finalDate = vo.getExportTime();
|
||||
}
|
||||
// 2. 发货时间为空时,使用更新时间兜底
|
||||
else if (vo.getUpdateTime() != null) {
|
||||
finalDate = vo.getUpdateTime();
|
||||
}
|
||||
// 3. 若更新时间也为空,保留原有createTime(避免日期字段为空)
|
||||
else {
|
||||
finalDate = vo.getCreateTime();
|
||||
}
|
||||
// 赋值最终的日期
|
||||
vo.setCreateTime(finalDate);
|
||||
}
|
||||
// 非1的情况,保持原有create_time不变
|
||||
|
||||
// 如果是dataType=0的历史数据,将实际库区设置为null
|
||||
if (vo.getDataType() != null && vo.getDataType() == 0) {
|
||||
vo.setActualWarehouseName(null);
|
||||
}
|
||||
});
|
||||
return wmsMaterialCoilDeliveryExportVos;
|
||||
}
|
||||
|
||||
private List<Long> parseCsvLongs(String csv) {
|
||||
|
||||
@@ -448,6 +448,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
SELECT
|
||||
-- 钢卷ID
|
||||
mc.coil_id AS coilId,
|
||||
-- 发货人
|
||||
mc.export_by AS exportBy,
|
||||
-- 类型(中文显示)
|
||||
CASE
|
||||
WHEN mc.item_type = 'product' THEN '成品'
|
||||
|
||||
Reference in New Issue
Block a user