库存分配跟库存查询区分

This commit is contained in:
秦鸿展
2026-05-11 16:02:51 +08:00
parent e7202f100d
commit 62da999f94
4 changed files with 16 additions and 2 deletions
@@ -244,4 +244,7 @@ public class MaterialInventoryDO extends MaterialBaseDO {
@ApiModelProperty("LOT编号")
@Excel(name = "LOT编号")
private String lotNumber;
/** 为 true 时 SQL 排除库存数量为 0(含 null 视为 0) */
private Boolean excludeZeroInventoryQuantity;
}
@@ -185,4 +185,8 @@ public class MaterialInventoryDTO extends MaterialBaseDTO {
@Excel(name = "冻结数量大于0条件")
private String greaterThanFreezeQuantity;
/** 为 true 时排除库存数量为 0 的行(出库分配选库存用);库存查询页不传或 false */
@ApiModelProperty(value = "是否排除库存数量为0", example = "false")
private Boolean excludeZeroInventoryQuantity;
}
@@ -48,11 +48,15 @@ public class MaterialInventoryApi extends BaseController {
/**
* 分页查询物料库存列表
*/
@ApiOperation("查询物料库存列表")
@ApiOperation(value = "查询物料库存列表", notes = "库存查询页不传 excludeZeroInventoryQuantity 可查出数量为0;出库分配页传 excludeZeroInventoryQuantity=true 排除库存数量为0")
@GetMapping("/list")
public TableDataInfo list(MaterialInventoryDTO materialInventoryDTO,
@RequestParam(value = "customerName", required = false) String customerName)
@RequestParam(value = "customerName", required = false) String customerName,
@RequestParam(value = "excludeZeroInventoryQuantity", required = false) Boolean excludeZeroInventoryQuantity)
{
if (Boolean.TRUE.equals(excludeZeroInventoryQuantity)) {
materialInventoryDTO.setExcludeZeroInventoryQuantity(true);
}
// 出库分配前端传的是客户名称 customerName,这里通过名称查询货主ID,使用精确匹配(不模糊匹配)
String shipperName = null; // 保存查询到的货主名称
if (StringUtils.isNotBlank(customerName) && materialInventoryDTO.getShipperId() == null) {