fix: allow measurement draft during processing
This commit is contained in:
@@ -52,7 +52,7 @@ public class InboundMeasurementService {
|
||||
/** OCR 结果无效或不完整,必须人工录入或修正。 */
|
||||
private static final String WEIGHT_NEEDS_MANUAL = "NEEDS_MANUAL";
|
||||
private static final Set<String> MEASUREMENT_DRAFT_EDITABLE_STATUSES = Set.of(
|
||||
"PREPARING", "WAIT_MEASURE", "MEASURING", "MEASURE_REJECTED");
|
||||
"PREPARING", "WAIT_MEASURE", "MEASURING", "PROCESSING", "MEASURE_REJECTED");
|
||||
private static final Set<String> WEIGHT_EDITABLE_STATUSES = Set.of(
|
||||
"PREPARING", "WAIT_MEASURE", "MEASURING", "MEASURE_REJECTED");
|
||||
/** 测量完成后的默认普通托盘类型;实际拆托和库位占用由提交编排服务执行。 */
|
||||
|
||||
@@ -43,7 +43,7 @@ public class MeasurementBatchService {
|
||||
/** 已接收第三方测量数据,待平台提交审核。 */
|
||||
static final String STATUS_RECEIVED = "RECEIVED";
|
||||
private static final Set<String> EDITABLE_INBOUND_STATUSES = Set.of(
|
||||
"PREPARING", "WAIT_MEASURE", "MEASURING", "MEASURE_REJECTED");
|
||||
"PREPARING", "WAIT_MEASURE", "MEASURING", "PROCESSING", "MEASURE_REJECTED");
|
||||
static final BigDecimal VOLUME_WEIGHT_FACTOR = new BigDecimal("167");
|
||||
private static final BigDecimal MAX_RAW_VOLUME_CBM = new BigDecimal("999999999999.999999");
|
||||
private static final BigDecimal MAX_TOTAL_VOLUME_CBM = new BigDecimal("99999999999999.9999");
|
||||
|
||||
@@ -1406,6 +1406,30 @@ class InboundMeasurementServiceTest {
|
||||
verify(orderCargoClient).detail("internal-token", 1L, 80L, 80001L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void savingDraftRemainsEditableWhileInboundIsProcessingBeforeMeasurementSubmission() {
|
||||
InboundOrderEntity inbound = inbound("PROCESSING");
|
||||
inbound.setOrderId(80L);
|
||||
InboundMeasurementEntity saved = new InboundMeasurementEntity();
|
||||
saved.setId(31L);
|
||||
saved.setVersion(0);
|
||||
saved.setStatus("DRAFT");
|
||||
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
|
||||
when(orderCargoClient.detail(eq("internal-token"), eq(1L), eq(80L), eq(80001L))).thenReturn(
|
||||
ApiResponse.success(new OrderCargoClient.CargoBinding(80001L, 80L, 1, "Test cargo",
|
||||
2, new BigDecimal("6.500"), new BigDecimal("0.0480"))));
|
||||
when(batchService.saveBatch(any())).thenReturn(saved);
|
||||
|
||||
InboundMeasurementResponses.DraftSaved result = service.saveDraft(1L, 10L, 9L,
|
||||
new InboundMeasurementRequests.SaveDraftRequest(null, 0, null,
|
||||
List.of(new InboundMeasurementRequests.ItemRequest(80001L, "001", "A", 2,
|
||||
new BigDecimal("40"), new BigDecimal("30"), new BigDecimal("20"),
|
||||
null, null, null, null, null, null))));
|
||||
|
||||
assertThat(result.measurementId()).isEqualTo(31L);
|
||||
verify(batchService).saveBatch(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void savingDraftCannotReopenSubmittedMeasurementWhileReviewIsPending() {
|
||||
InboundOrderEntity inbound = inbound("MEASURE_PENDING");
|
||||
|
||||
Reference in New Issue
Block a user