From 3292f2c5970a93f3c9803c3fe7a2f600f93ec7f3 Mon Sep 17 00:00:00 2001 From: liuyihe <2513762445@qq.com> Date: Tue, 4 Aug 2026 17:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E6=9C=9F=E5=86=85=E5=AE=B9=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/sql/2026-08-04-二期入库新增表字段-MySQL8一键执行.sql | 1 + .../baiyue/firstleg/entity/InboundPalletAllocationEntity.java | 1 + .../repository/InboundPalletAllocationRepository.java | 4 +++- .../service/MeasurementLocationOccupationService.java | 4 ++-- firstleg/src/main/resources/db/phase2-inbound-schema.sql | 1 + .../service/MeasurementLocationOccupationServiceTest.java | 3 ++- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/deploy/sql/2026-08-04-二期入库新增表字段-MySQL8一键执行.sql b/deploy/sql/2026-08-04-二期入库新增表字段-MySQL8一键执行.sql index 061c9d846..5d329f401 100644 --- a/deploy/sql/2026-08-04-二期入库新增表字段-MySQL8一键执行.sql +++ b/deploy/sql/2026-08-04-二期入库新增表字段-MySQL8一键执行.sql @@ -515,6 +515,7 @@ CREATE TABLE IF NOT EXISTS fl_inbound_pallet_allocation ( inbound_id BIGINT UNSIGNED NOT NULL COMMENT '入库单ID', allocation_no INT UNSIGNED NOT NULL COMMENT '入库单内分配序号', warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '仓库服务仓库ID', + warehouse_resource_tenant_id BIGINT UNSIGNED NOT NULL COMMENT '仓储资源所属租户ID', pallet_id BIGINT UNSIGNED NOT NULL COMMENT '仓库服务托盘ID', pallet_code VARCHAR(50) NOT NULL COMMENT '托盘编码快照', pallet_capacity_cbm DECIMAL(18,4) NOT NULL COMMENT '托盘可用容积快照', diff --git a/firstleg/src/main/java/com/baiyue/firstleg/entity/InboundPalletAllocationEntity.java b/firstleg/src/main/java/com/baiyue/firstleg/entity/InboundPalletAllocationEntity.java index e96a536f2..e6b6e1940 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/entity/InboundPalletAllocationEntity.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/entity/InboundPalletAllocationEntity.java @@ -20,6 +20,7 @@ public class InboundPalletAllocationEntity { private Long inboundId; private Integer allocationNo; private Long warehouseId; + private Long warehouseResourceTenantId; private Long palletId; private String palletCode; private BigDecimal palletCapacityCbm; diff --git a/firstleg/src/main/java/com/baiyue/firstleg/repository/InboundPalletAllocationRepository.java b/firstleg/src/main/java/com/baiyue/firstleg/repository/InboundPalletAllocationRepository.java index b36ddf06c..c8eb71967 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/repository/InboundPalletAllocationRepository.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/repository/InboundPalletAllocationRepository.java @@ -22,7 +22,8 @@ public class InboundPalletAllocationRepository { } @Transactional - public void replace(long tenantId, long inboundId, long warehouseId, BigDecimal capacity, + public void replace(long tenantId, long inboundId, long warehouseId, long warehouseResourceTenantId, + BigDecimal capacity, BatchResult result) { Map reservationNos = mapper.selectList(new LambdaQueryWrapper() .eq(InboundPalletAllocationEntity::getTenantId, tenantId) @@ -39,6 +40,7 @@ public class InboundPalletAllocationRepository { value.setInboundId(inboundId); value.setAllocationNo(source.allocationNo()); value.setWarehouseId(warehouseId); + value.setWarehouseResourceTenantId(warehouseResourceTenantId); value.setPalletId(source.palletId()); value.setPalletCode(source.palletCode()); value.setPalletCapacityCbm(capacity); diff --git a/firstleg/src/main/java/com/baiyue/firstleg/service/MeasurementLocationOccupationService.java b/firstleg/src/main/java/com/baiyue/firstleg/service/MeasurementLocationOccupationService.java index 0e7d718be..7e6c6232f 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/service/MeasurementLocationOccupationService.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/service/MeasurementLocationOccupationService.java @@ -49,14 +49,14 @@ public class MeasurementLocationOccupationService { properties.getDefaultPalletCapacityCbm(), "STANDARD", LocalDateTime.now().plus(properties.getReservationTtl()), true))), "测量完成后库位预占失败"); - allocations.replace(tenantId, inboundId, warehouseId, + allocations.replace(tenantId, inboundId, warehouseId, resourceTenantId, properties.getDefaultPalletCapacityCbm(), reserved); try { WarehousePalletLocationClient.BatchResult occupied = requireSuccess(call(() -> warehouse.confirm( internalToken, new WarehousePalletLocationClient.ConfirmRequest(resourceTenantId, warehouseId, SOURCE_SERVICE, inboundId, operatorId, volume, properties.getDefaultPalletCapacityCbm()))), "测量完成后库位占用失败"); - allocations.replace(tenantId, inboundId, warehouseId, + allocations.replace(tenantId, inboundId, warehouseId, resourceTenantId, properties.getDefaultPalletCapacityCbm(), occupied); } catch (RuntimeException failure) { try { diff --git a/firstleg/src/main/resources/db/phase2-inbound-schema.sql b/firstleg/src/main/resources/db/phase2-inbound-schema.sql index c0c6db9cd..b341765cc 100644 --- a/firstleg/src/main/resources/db/phase2-inbound-schema.sql +++ b/firstleg/src/main/resources/db/phase2-inbound-schema.sql @@ -423,6 +423,7 @@ CREATE TABLE IF NOT EXISTS fl_inbound_pallet_allocation ( inbound_id BIGINT UNSIGNED NOT NULL COMMENT '入库单ID', allocation_no INT UNSIGNED NOT NULL COMMENT '入库单内分配序号', warehouse_id BIGINT UNSIGNED NOT NULL COMMENT '仓库服务仓库ID', + warehouse_resource_tenant_id BIGINT UNSIGNED NOT NULL COMMENT '仓储资源所属租户ID', pallet_id BIGINT UNSIGNED NOT NULL COMMENT '仓库服务托盘ID', pallet_code VARCHAR(50) NOT NULL COMMENT '托盘编码快照', pallet_capacity_cbm DECIMAL(18,4) NOT NULL COMMENT '托盘可用容积快照', diff --git a/firstleg/src/test/java/com/baiyue/firstleg/service/MeasurementLocationOccupationServiceTest.java b/firstleg/src/test/java/com/baiyue/firstleg/service/MeasurementLocationOccupationServiceTest.java index dbf75af6b..37840ad8b 100644 --- a/firstleg/src/test/java/com/baiyue/firstleg/service/MeasurementLocationOccupationServiceTest.java +++ b/firstleg/src/test/java/com/baiyue/firstleg/service/MeasurementLocationOccupationServiceTest.java @@ -62,6 +62,7 @@ class MeasurementLocationOccupationServiceTest { org.mockito.ArgumentMatchers.eq(BUSINESS_TENANT), org.mockito.ArgumentMatchers.eq(INBOUND), org.mockito.ArgumentMatchers.eq(WAREHOUSE), + org.mockito.ArgumentMatchers.eq(RESOURCE_TENANT), org.mockito.ArgumentMatchers.eq(new BigDecimal("1.200000")), org.mockito.ArgumentMatchers.any()); } @@ -108,7 +109,7 @@ class MeasurementLocationOccupationServiceTest { verify(warehouse).release(org.mockito.ArgumentMatchers.eq("internal-token"), release.capture()); assertThat(release.getValue().tenantId()).isEqualTo(RESOURCE_TENANT); assertThat(release.getValue().businessId()).isEqualTo(INBOUND); - verify(allocations).replace(BUSINESS_TENANT, INBOUND, WAREHOUSE, + verify(allocations).replace(BUSINESS_TENANT, INBOUND, WAREHOUSE, RESOURCE_TENANT, new BigDecimal("1.200000"), batch("RESERVED")); }