This commit is contained in:
2026-08-07 17:14:40 +08:00
parent f4c3a95772
commit 91f31d9567
20 changed files with 354 additions and 7 deletions
@@ -68,7 +68,7 @@ public class CartonMeasurementService {
UpsertOutcome outcome;
try {
outcome = transactionTemplate.execute(status -> persist(
tenantId, operatorId, binding, inbound, boxCode, command, uploaded.fileId()));
tenantId, operatorId, binding, boxCode, command, uploaded.fileId()));
} catch (RuntimeException exception) {
cleanupImage(tenantId, operatorId, inbound.getId(), uploaded.fileId(), "回传落库失败补偿");
throw exception;
@@ -111,9 +111,8 @@ public class CartonMeasurementService {
if (!repository.updateMeasurement(measurement)) {
throw concurrentModification();
}
// 提交审核后仍允许平台人工修正代表箱数,入库单快照必须随当前批次同步。
// 提交审核后仍允许平台人工修正代表箱数,但订单原始总箱数不可被测量汇总覆盖。
if ("MEASURE_PENDING".equals(inbound.getProcessStatus())) {
inbound.setTotalPackageCount(measurement.getTotalPackageCount());
inbound.setActualVolumeCbm(measurement.getTotalVolumeCbm());
inbound.setVolumeWeightKg(measurement.getVolumeWeightKg());
if (!repository.updateInbound(inbound)) {
@@ -125,8 +124,15 @@ public class CartonMeasurementService {
private UpsertOutcome persist(long tenantId, long operatorId,
CartonLabelBindingResolver.Binding binding,
InboundOrderEntity inbound, String boxCode,
String boxCode,
CartonMeasurementCommand command, long imageFileId) {
InboundOrderEntity inbound = repository.lockInbound(tenantId, binding.inboundId());
if (inbound == null) {
throw new BizException(ResultCode.NOT_FOUND, "入库单不存在");
}
if (!DEVICE_WRITABLE_STATUSES.contains(inbound.getProcessStatus())) {
throw new BizException(ResultCode.CONFLICT, "测量已提交,设备不能新增或覆盖数据");
}
InboundMeasurementItemEntity item = repository.findItemByBoxCode(tenantId, boxCode);
boolean created = item == null;
InboundMeasurementEntity measurement;