diff --git a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java index 312a5f074..21c834773 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/domain/materialInventory/repository/todo/MaterialInventoryDO.java @@ -256,6 +256,8 @@ public class MaterialInventoryDO extends MaterialBaseDO { /** 为 true 时 SQL 排除库存数量为 0(含 null 视为 0) */ private Boolean excludeZeroInventoryQuantity; + /** 为 true 时 SQL 排除可用数量为 0(含 null 视为 0),出库选库存可用 */ + private Boolean excludeZeroAllocationQuantity; private String expiryDateStr; private String productionDateStr; private String updateTimeStr; diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java index fd5bb71cf..944626b17 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/dto/materialInventory/MaterialInventoryDTO.java @@ -188,6 +188,9 @@ public class MaterialInventoryDTO extends MaterialBaseDTO { /** 为 true 时排除库存数量为 0 的行(出库分配选库存用);库存查询页不传或 false */ @ApiModelProperty(value = "是否排除库存数量为0", example = "false") private Boolean excludeZeroInventoryQuantity; + /** 为 true 时排除可用数量为 0 的行(库存数量>0 但可用数量=0 表示已被冻结/占用完,无法出库);不传或 false 不过滤 */ + @ApiModelProperty(value = "是否排除可用数量为0", example = "false") + private Boolean excludeZeroAllocationQuantity; private String expiryDate; private String productionDate; /** 进货日期(yyyy-MM-dd,单日精确查询) */ diff --git a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java index 519994447..ff774c2bb 100644 --- a/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java +++ b/mhd_wms/src/main/java/com/mhd/wms/interfaces/facadeApi/materialInventory/MaterialInventoryApi.java @@ -53,11 +53,17 @@ public class MaterialInventoryApi extends BaseController { /** * 分页查询物料库存列表 */ - @ApiOperation(value = "查询物料库存列表", notes = "库存查询页不传 excludeZeroInventoryQuantity 可查出数量为0;出库分配页传 excludeZeroInventoryQuantity=true 排除库存数量为0;导出复用本接口:传 isExport=true 标识导出请求(导出显示:商品饮用有效期expiryDate/物料分类materialClassifyName/进货日期purchaseDate,所有查询维度均返回)") + @ApiOperation(value = "查询物料库存列表", notes = "两个隐藏0库存开关(均不传或 false 不过滤,保持原行为):" + + "excludeZeroInventoryQuantity=true 排除库存数量为0(盘点-库存选择页\"隐藏数量为0的物料\");" + + "excludeZeroAllocationQuantity=true 排除可用数量为0(出库选库存,可用数量=0 表示已被冻结/占用完无法出库);" + + "物料编号筛选传 materialCode(精确匹配),仓库筛选传 warehouseId(下拉);" + + "库存查询页不传开关可查出数量为0;导出复用本接口:传 isExport=true 标识导出请求" + + "(导出显示:商品饮用有效期expiryDate/物料分类materialClassifyName/进货日期purchaseDate,所有查询维度均返回)") @GetMapping("/list") public TableDataInfo list(MaterialInventoryDTO materialInventoryDTO, @RequestParam(value = "customerName", required = false) String customerName, @RequestParam(value = "excludeZeroInventoryQuantity", required = false) Boolean excludeZeroInventoryQuantity, + @RequestParam(value = "excludeZeroAllocationQuantity", required = false) Boolean excludeZeroAllocationQuantity, @RequestParam(value = "expiryDateStart", required = false) String expiryDateStart, @RequestParam(value = "expiryDateEnd", required = false) String expiryDateEnd, @RequestParam(value = "purchaseDateStart", required = false) String purchaseDateStart, @@ -69,6 +75,9 @@ public class MaterialInventoryApi extends BaseController { if (Boolean.TRUE.equals(excludeZeroInventoryQuantity)) { materialInventoryDTO.setExcludeZeroInventoryQuantity(true); } + if (Boolean.TRUE.equals(excludeZeroAllocationQuantity)) { + materialInventoryDTO.setExcludeZeroAllocationQuantity(true); + } // 出库分配前端传的是客户名称 customerName,这里通过名称查询货主ID,使用精确匹配(不模糊匹配) String shipperName = null; // 保存查询到的货主名称 if (StringUtils.isNotBlank(customerName) && materialInventoryDTO.getShipperId() == null) { @@ -176,8 +185,10 @@ public class MaterialInventoryApi extends BaseController { // materialDetailId 是新接口专用参数(出库单明细ID),库存 DTO 的同名字段语义是「上架单明细ID」, // 泄入原查询会生成错误的 a.material_detail_id 条件导致查空,进原查询前显式清除 materialInventoryDTO.setMaterialDetailId(null); - // assignableList 非导出场景,isExport 传 null - return list(materialInventoryDTO, customerName, excludeZeroInventoryQuantity, expiryDateStart, expiryDateEnd, null, null, orderByExpiryDate, null); + // assignableList 非导出场景,isExport 传 null;excludeZeroAllocationQuantity 已随 DTO 绑定,透传保持开关生效 + return list(materialInventoryDTO, customerName, excludeZeroInventoryQuantity, + materialInventoryDTO.getExcludeZeroAllocationQuantity(), + expiryDateStart, expiryDateEnd, null, null, orderByExpiryDate, null); } @ApiOperation("查询物料库存列表不分页;queryRule=hz 时按货主+物料分组(同一物料在不同货主各占一行)") diff --git a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml index 783b033bb..18cdfa24f 100644 --- a/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml +++ b/mhd_wms/src/main/resources/mapper/materialInventory/MaterialInventoryMapper.xml @@ -217,6 +217,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and COALESCE(a.inventory_quantity, 0) > 0 + + and COALESCE(a.allocation_quantity, 0) > 0 + and a.create_by_name like concat('%', #{createByName}, '%') @@ -378,6 +381,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and COALESCE(mi.inventory_quantity, 0) > 0 + + and COALESCE(mi.allocation_quantity, 0) > 0 + and mi.create_by_name like concat('%', #{createByName}, '%')