仓库过滤查询

This commit is contained in:
秦鸿展
2026-02-10 15:12:36 +08:00
parent 507cbf0f1e
commit 49ba1cc8fd
@@ -56,9 +56,15 @@ public class MaterialInventoryApplicationService {
if (topOrganizationId != null && topOrganizationId != 1){
materialInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
// 前端有传warehouseId则优先使用传参;未传时才使用“用户关联仓库”作为默认值
if (materialInventoryDO.getWarehouseId() == null) {
AssociationWarehouseCacheDO associationWarehouseCacheDO =
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (associationWarehouseCacheDO != null) {
materialInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
}
return materialInventoryDomainService.queryList(materialInventoryDO);
}
@@ -337,9 +343,15 @@ public class MaterialInventoryApplicationService {
if (topOrganizationId != null && topOrganizationId != 1){
materialInventoryDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
AssociationWarehouseCacheDO associationWarehouseCacheDO = SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
// 前端有传warehouseId则优先使用传参;未传时才使用“用户关联仓库”作为默认值
if (materialInventoryDO.getWarehouseId() == null) {
AssociationWarehouseCacheDO associationWarehouseCacheDO =
SystemServiceCacheUtil.getAssociationWarehouseCache(loginUser.getUserid());
if (associationWarehouseCacheDO != null) {
materialInventoryDO.setWarehouseId(associationWarehouseCacheDO.getWarehouseId());
}
}
}
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryList(materialInventoryDO);
if (CollectionUtils.isNotEmpty(materialInventoryPOS)){
return materialInventoryPOS.stream().map(MaterialInventoryPO::getAllocationQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);