From 81517945f6181132a135ee84cf606848e08d6602 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Tue, 22 Sep 2026 14:26:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OpenApiInboundMeasurementController.java | 2 +- .../service/InboundMeasurementService.java | 27 ++++++++++++++++--- .../MojiaMeasurementOpenApiService.java | 2 +- .../db/mojia-sku-sync-permissions.sql | 2 +- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/firstleg/src/main/java/com/baiyue/firstleg/controller/OpenApiInboundMeasurementController.java b/firstleg/src/main/java/com/baiyue/firstleg/controller/OpenApiInboundMeasurementController.java index 25e74b866..9c4dfde6c 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/controller/OpenApiInboundMeasurementController.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/controller/OpenApiInboundMeasurementController.java @@ -43,7 +43,7 @@ public class OpenApiInboundMeasurementController { private MojiaMeasurementOpenApiService mojiaService; @Operation(summary = "墨家设备按箱码上传单箱测量结果", - description = "首轮联调使用固定 X-App-Key;JSON 中 picture 为 JPEG Data URL,boxCode 原样取自设备条码;带 # 的箱唛继续走箱唛测量,不带 # 的 SKU 进入一件代发 SKU 同步收件;weightKg 为 kg") + description = "首轮联调使用固定 X-App-Key;JSON 中 picture 为 JPEG Data URL,boxCode 原样取自设备条码;带 # 的箱唛继续走箱唛测量,不带 # 的 SKU 进入SKU同步收件;weightKg 为 kg") @PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE) public ApiResponse receiveMojia( @RequestHeader("X-App-Key") String appKey, diff --git a/firstleg/src/main/java/com/baiyue/firstleg/service/InboundMeasurementService.java b/firstleg/src/main/java/com/baiyue/firstleg/service/InboundMeasurementService.java index 77031d5c7..3f14c3322 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/service/InboundMeasurementService.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/service/InboundMeasurementService.java @@ -26,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import org.springframework.beans.factory.annotation.Value; import feign.FeignException; +import org.springframework.dao.DataAccessException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,7 +100,7 @@ public class InboundMeasurementService { ? List.of() : repository.listItems(tenantId, measurement.getId()); List weights = repository.listWeights(tenantId, inbound.getId()); List allocationSlots = - palletAllocations.list(tenantId, inbound.getId()); + loadAllocationSlotsForDetail(tenantId, inbound.getId()); Map allocationsByWeight = allocationSlots.stream() .filter(item -> item.getWeightResultId() != null) @@ -605,8 +606,28 @@ public class InboundMeasurementService { } private boolean customerFeeConfirmed(long tenantId, long inboundId) { - var latestFee = pricingRepository.findLatestFee(tenantId, inboundId); - return latestFee != null && latestFee.getCustomerConfirmedAt() != null; + try { + var latestFee = pricingRepository.findLatestFee(tenantId, inboundId); + return latestFee != null && latestFee.getCustomerConfirmedAt() != null; + } catch (DataAccessException exception) { + // Fee confirmation is an edit-lock hint only; it must not prevent opening the review page. + LOGGER.warn("读取入库费用确认状态失败,继续返回测量详情: tenantId={}, inboundId={}", + tenantId, inboundId, exception); + return false; + } + } + + private List loadAllocationSlotsForDetail( + long tenantId, long inboundId) { + try { + return palletAllocations.list(tenantId, inboundId); + } catch (DataAccessException exception) { + // The location guide is supplementary evidence. A missing/old allocation table must not + // turn a measurement review read into an opaque 500 response. + LOGGER.warn("读取入库库位分配快照失败,继续返回测量详情: tenantId={}, inboundId={}", + tenantId, inboundId, exception); + return List.of(); + } } private static InboundMeasurementResponses.PalletLocationGuide toPalletLocationGuide( diff --git a/firstleg/src/main/java/com/baiyue/firstleg/service/MojiaMeasurementOpenApiService.java b/firstleg/src/main/java/com/baiyue/firstleg/service/MojiaMeasurementOpenApiService.java index 182667e98..63527dbd1 100644 --- a/firstleg/src/main/java/com/baiyue/firstleg/service/MojiaMeasurementOpenApiService.java +++ b/firstleg/src/main/java/com/baiyue/firstleg/service/MojiaMeasurementOpenApiService.java @@ -81,7 +81,7 @@ public class MojiaMeasurementOpenApiService { } long machineWarehouseId = requireMachineWarehouse(app, request.machineNo()); // 墨家同一个 boxCode 字段同时承载箱唛和 SKU:带 # 的继续走既有箱唛链路, - // 不带 # 的只进入一件代发 SKU 同步收件,不得误走箱码匹配。 + // 不带 # 的只进入SKU同步收件,不得误走箱码匹配。 if (!request.boxCode().contains("#")) { return saveSkuPending(app, request, image); } diff --git a/iam/src/main/resources/db/mojia-sku-sync-permissions.sql b/iam/src/main/resources/db/mojia-sku-sync-permissions.sql index 1ab3ea7ee..5a6bb62b8 100644 --- a/iam/src/main/resources/db/mojia-sku-sync-permissions.sql +++ b/iam/src/main/resources/db/mojia-sku-sync-permissions.sql @@ -1,4 +1,4 @@ --- 墨家一件代发 SKU 同步页面及操作权限。 +-- 墨家SKU同步页面及操作权限。 USE baiyue_iam; SET NAMES utf8mb4;