优化
This commit is contained in:
@@ -524,6 +524,27 @@ class InboundMeasurementServiceTest {
|
||||
verify(repository, never()).deleteWeight(anyLong(), anyLong(), anyLong(), anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
void detailCountsSameCartonMultiSkuGroupOnlyOnceForDropship() {
|
||||
InboundOrderEntity inbound = inbound("MEASURING");
|
||||
inbound.setFulfillmentType("ONE_CLICK_DROPSHIP");
|
||||
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
|
||||
when(repository.listWeights(1L, 10L)).thenReturn(List.of());
|
||||
when(orderCargoClient.listForCartonLabels("internal-token", 1L, 80L)).thenReturn(
|
||||
ApiResponse.success(List.of(
|
||||
new OrderCargoClient.CargoLabelBinding(
|
||||
80001L, 80L, 1, "SKU A", "SKU-A", 20, 5,
|
||||
new BigDecimal("40"), new BigDecimal("30"), new BigDecimal("20"), null, "MIX-1"),
|
||||
new OrderCargoClient.CargoLabelBinding(
|
||||
80002L, 80L, 2, "SKU B", "SKU-B", 20, 3,
|
||||
new BigDecimal("40"), new BigDecimal("30"), new BigDecimal("20"), null, "MIX-1"))));
|
||||
|
||||
InboundMeasurementResponses.Detail result = service.detail(1L, 10L);
|
||||
|
||||
assertThat(result.latestDeclaration().totalPackageCount()).isEqualTo(20);
|
||||
assertThat(result.latestDeclaration().items()).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void creatingWeightResultNormalizesProviderConfidenceAtBusinessBoundary() {
|
||||
InboundOrderEntity inbound = inbound("WAIT_MEASURE");
|
||||
@@ -1215,6 +1236,44 @@ class InboundMeasurementServiceTest {
|
||||
assertThat(inbound.getProcessStatus()).isEqualTo("MEASURE_PENDING");
|
||||
}
|
||||
|
||||
@Test
|
||||
void submitValidatesDropshipMultiSkuCartonsByPhysicalCartonCount() {
|
||||
InboundOrderEntity inbound = inbound("MEASURING");
|
||||
inbound.setFulfillmentType("ONE_CLICK_DROPSHIP");
|
||||
inbound.setPalletCount(1);
|
||||
InboundMeasurementEntity measurement = new InboundMeasurementEntity();
|
||||
measurement.setId(30L);
|
||||
measurement.setStatus("RECEIVED");
|
||||
measurement.setVersion(6);
|
||||
measurement.setTotalPackageCount(20);
|
||||
InboundMeasurementItemEntity item = new InboundMeasurementItemEntity();
|
||||
item.setPackageCount(20);
|
||||
InboundWeightResultEntity weight = weight(20L, "197.000", "KG", "CONFIRMED", 1);
|
||||
weight.setGrossWeightKg(new BigDecimal("197.000"));
|
||||
weight.setNetWeightKg(new BigDecimal("181.000"));
|
||||
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
|
||||
when(repository.findMeasurement(1L, 10L, 30L)).thenReturn(measurement);
|
||||
when(repository.listItems(1L, 30L)).thenReturn(List.of(item));
|
||||
when(repository.listWeights(1L, 10L)).thenReturn(List.of(weight));
|
||||
when(repository.updateMeasurement(measurement)).thenReturn(true);
|
||||
when(repository.updateInbound(inbound)).thenReturn(true);
|
||||
when(orderCargoClient.listForCartonLabels("internal-token", 1L, 80L)).thenReturn(
|
||||
ApiResponse.success(List.of(
|
||||
new OrderCargoClient.CargoLabelBinding(
|
||||
80001L, 80L, 1, "SKU A", "SKU-A", 20, 5,
|
||||
new BigDecimal("40"), new BigDecimal("30"), new BigDecimal("20"), null, "MIX-1"),
|
||||
new OrderCargoClient.CargoLabelBinding(
|
||||
80002L, 80L, 2, "SKU B", "SKU-B", 20, 3,
|
||||
new BigDecimal("40"), new BigDecimal("30"), new BigDecimal("20"), null, "MIX-1"))));
|
||||
|
||||
service.submit(1L, 10L, 9L,
|
||||
new InboundMeasurementRequests.SubmitRequest(30L, 6));
|
||||
|
||||
assertThat(inbound.getTotalPackageCount()).isEqualTo(20);
|
||||
assertThat(inbound.getProcessStatus()).isEqualTo("MEASURE_PENDING");
|
||||
assertThat(measurement.getStatus()).isEqualTo("SUBMITTED");
|
||||
}
|
||||
|
||||
@Test
|
||||
void submitRejectsWhenNoWeightImageHasBeenConfirmed() {
|
||||
InboundOrderEntity inbound = inbound("MEASURING");
|
||||
|
||||
Reference in New Issue
Block a user