This commit is contained in:
2026-08-07 18:03:56 +08:00
parent 645c483649
commit 1a76602872
15 changed files with 273 additions and 6 deletions
@@ -59,9 +59,25 @@ public class CartonMeasurementService {
}
public CartonMeasurementResult upsert(long tenantId, long operatorId, CartonMeasurementCommand command) {
return upsert(tenantId, operatorId, null, command);
}
public CartonMeasurementResult upsertForInbound(long tenantId, long operatorId, long inboundId,
CartonMeasurementCommand command) {
if (inboundId <= 0) {
throw new BizException(ResultCode.BAD_REQUEST, "入库单ID必须大于0");
}
return upsert(tenantId, operatorId, inboundId, command);
}
private CartonMeasurementResult upsert(long tenantId, long operatorId, Long expectedInboundId,
CartonMeasurementCommand command) {
validateCommand(command);
String boxCode = command.boxCode().trim();
CartonLabelBindingResolver.Binding binding = requireBinding(tenantId, boxCode);
if (expectedInboundId != null && binding.inboundId() != expectedInboundId) {
throw new BizException(ResultCode.NOT_FOUND, "箱号不属于当前入库单");
}
InboundOrderEntity inbound = requireDeviceWritableInbound(tenantId, binding.inboundId());
MeasurementImageClient.UploadResult uploaded = uploadImage(
tenantId, operatorId, inbound.getId(), command.image());