feat(wms): 添加按时间范围查询已绑定钢卷ID功能

- 在 IWmsDeliveryWaybillDetailService 接口中新增 getBoundCoilIdsByTimeRange 方法
- 在控制器中添加 startTime 和 endTime 参数支持时间范围查询
- 实现服务层方法根据时间段筛选已绑定的钢卷ID列表
- 使用 LambdaQueryWrapper 构建时间范围查询条件
- 对查询结果进行空值检查和去重处理
- 保持原有无时间范围查询的兼容性逻辑
This commit is contained in:
2026-04-03 13:48:54 +08:00
parent e6d63ef4f7
commit 47198a0d01
3 changed files with 45 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package com.klp.controller;
import java.util.List;
import java.util.Arrays;
import java.util.Date;
import com.klp.domain.vo.WmsMaterialCoilBindVo;
import lombok.RequiredArgsConstructor;
@@ -115,8 +116,17 @@ public class WmsDeliveryWaybillDetailController extends BaseController {
* 查询已发货绑定的钢卷列表
*/
@GetMapping("/boundCoilList")
public TableDataInfo<WmsMaterialCoilBindVo> boundCoilList(WmsMaterialCoilBo bo, PageQuery pageQuery) {
List<Long> boundCoilIds = iWmsDeliveryWaybillDetailService.getBoundCoilIds();
public TableDataInfo<WmsMaterialCoilBindVo> boundCoilList(
WmsMaterialCoilBo bo,
PageQuery pageQuery,
@RequestParam(required = false) Date startTime,
@RequestParam(required = false) Date endTime) {
List<Long> boundCoilIds;
if (startTime != null || endTime != null) {
boundCoilIds = iWmsDeliveryWaybillDetailService.getBoundCoilIdsByTimeRange(startTime, endTime);
} else {
boundCoilIds = iWmsDeliveryWaybillDetailService.getBoundCoilIds();
}
if (boundCoilIds == null || boundCoilIds.isEmpty()) {
return new TableDataInfo<>();
}

View File

@@ -7,6 +7,7 @@ import com.klp.common.core.page.TableDataInfo;
import com.klp.common.core.domain.PageQuery;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
@@ -56,4 +57,9 @@ public interface IWmsDeliveryWaybillDetailService {
* 查询所有已绑定的钢卷ID列表
*/
List<Long> getBoundCoilIds();
/**
* 根据时间段查询已绑定的钢卷ID列表
*/
List<Long> getBoundCoilIdsByTimeRange(Date startTime, Date endTime);
}

View File

@@ -21,9 +21,7 @@ import com.klp.domain.vo.WmsDeliveryWaybillDetailVo;
import com.klp.domain.vo.WmsCoilBindInfoVo;
import com.klp.service.IWmsDeliveryWaybillDetailService;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -224,5 +222,31 @@ public class WmsDeliveryWaybillDetailServiceImpl implements IWmsDeliveryWaybillD
List<WmsDeliveryWaybillDetail> list = baseMapper.selectList(lqw);
return list.stream().map(WmsDeliveryWaybillDetail::getCoilId).distinct().collect(Collectors.toList());
}
@Override
public List<Long> getBoundCoilIdsByTimeRange(Date startTime, Date endTime) {
LambdaQueryWrapper<WmsDeliveryWaybill> waybillWrapper = Wrappers.lambdaQuery();
waybillWrapper.eq(WmsDeliveryWaybill::getDelFlag, 0);
if (startTime != null) {
waybillWrapper.ge(WmsDeliveryWaybill::getDeliveryTime, startTime);
}
if (endTime != null) {
waybillWrapper.le(WmsDeliveryWaybill::getDeliveryTime, endTime);
}
List<WmsDeliveryWaybill> waybills = wmsDeliveryWaybillMapper.selectList(waybillWrapper);
if (waybills == null || waybills.isEmpty()) {
return Collections.emptyList();
}
List<Long> waybillIds = waybills.stream().map(WmsDeliveryWaybill::getWaybillId).collect(Collectors.toList());
LambdaQueryWrapper<WmsDeliveryWaybillDetail> detailWrapper = Wrappers.lambdaQuery();
detailWrapper.in(WmsDeliveryWaybillDetail::getWaybillId, waybillIds);
detailWrapper.isNotNull(WmsDeliveryWaybillDetail::getCoilId);
detailWrapper.eq(WmsDeliveryWaybillDetail::getDelFlag, 0);
detailWrapper.select(WmsDeliveryWaybillDetail::getCoilId);
List<WmsDeliveryWaybillDetail> list = baseMapper.selectList(detailWrapper);
return list.stream().map(WmsDeliveryWaybillDetail::getCoilId).distinct().collect(Collectors.toList());
}
}