fix(wms): 修复实际库区ID查询条件处理逻辑

- 移除原有的actualWarehouseId简单相等查询条件
- 添加对actualWarehouseId为-1时的特殊处理逻辑
- 实现当actualWarehouseId为-1时查询actual_warehouse_id为空的记录
- 保持其他actualWarehouseId正常传值时的匹配逻辑
- 优化查询条件构建的代码结构
This commit is contained in:
2026-01-12 10:21:41 +08:00
parent 52421dbdc3
commit 7d4d85e9d6

View File

@@ -339,12 +339,21 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
qw.eq(bo.getWarehouseId() != null, "mc.warehouse_id", bo.getWarehouseId());
qw.eq(bo.getHasMergeSplit() != null, "mc.has_merge_split", bo.getHasMergeSplit());
qw.eq(bo.getStatus() != null, "mc.status", bo.getStatus());
qw.eq(bo.getActualWarehouseId() != null, "mc.actual_warehouse_id", bo.getActualWarehouseId());
qw.eq(StringUtils.isNotBlank(bo.getItemType()), "mc.item_type", bo.getItemType());
qw.eq(StringUtils.isNotBlank(bo.getCreateBy()), "mc.create_by", bo.getCreateBy());
qw.eq(StringUtils.isNotBlank(bo.getUpdateBy()), "mc.update_by", bo.getUpdateBy());
// 新增长度
qw.eq(bo.getLength() != null, "mc.length", bo.getLength());
// 如果actualWarehouseId不为空则根据实际库区ID进行查询 如果为-1,则查询无库区的数据
if (bo.getActualWarehouseId() != null) {
if (bo.getActualWarehouseId() == -1) {
// 当actualWarehouseId为-1时查询actual_warehouse_id为空的记录无库区
qw.isNull("mc.actual_warehouse_id");
} else {
// 正常传值时匹配具体的actualWarehouseId
qw.eq("mc.actual_warehouse_id", bo.getActualWarehouseId());
}
}
// 新增查询逻辑也就是当saleId未空时候
if (bo.getSaleId() != null) {
if (bo.getSaleId() == -1) {