优化
This commit is contained in:
@@ -79,6 +79,37 @@ class PdaPickSettlementServiceTest {
|
||||
verify(splits).convergePartialPlanItem(21L, 9L, "operator");
|
||||
}
|
||||
|
||||
@Test
|
||||
void distributesOnePickedCartonAcrossRepeatedMeasurementRowsOfTheSameInboundDetail() {
|
||||
LoadingPickItemEntity item = item(11L, 21L, 31L, 41L, 1, 1, "PICKED");
|
||||
resolved(List.of(item));
|
||||
when(splits.lockParent(31L)).thenReturn(parent(2));
|
||||
when(splits.lockLatestApprovedItemsForInbound(10001L, 31L)).thenReturn(List.of(
|
||||
new MeasurementItemRow(51L, 61L, 41L, 1),
|
||||
new MeasurementItemRow(52L, 61L, 41L, 1)));
|
||||
when(allocations.lockConfirmed(10001L, 31L)).thenAnswer(invocation ->
|
||||
List.of(allocation(1L, 1, 501L, 2)));
|
||||
when(warehouse.settle(eq("internal-token"), any())).thenReturn(ApiResponse.success(
|
||||
new WarehousePalletLocationClient.SettlementResult(List.of(), List.of(transfer(1, 501L, 1)))));
|
||||
writes(1, 1);
|
||||
when(splits.insertSplitItem(anyLong(), eq(10001L), anyLong(), eq(31L), anyLong(), anyInt(),
|
||||
eq(41L), eq(61L), eq(52L), eq(1))).thenReturn(1);
|
||||
when(splits.cloneMeasurementItem(eq(10001L), eq(61L), eq(52L), anyLong(),
|
||||
anyLong(), anyLong(), anyInt(), eq(1))).thenReturn(1);
|
||||
when(splits.updateMeasurementItemForLoaded(10001L, 52L, 0)).thenReturn(1);
|
||||
|
||||
service.settle(1L, 9L, "operator");
|
||||
|
||||
verify(splits).updateMeasurementItemForLoaded(10001L, 51L, 1);
|
||||
verify(splits).updateMeasurementItemForLoaded(10001L, 52L, 0);
|
||||
verify(splits).cloneMeasurementItem(eq(10001L), eq(61L), eq(52L), anyLong(),
|
||||
anyLong(), anyLong(), anyInt(), eq(1));
|
||||
verify(orderSplits).split(eq("internal-token"), eq(9L),
|
||||
org.mockito.ArgumentMatchers.argThat(request -> request.lines().size() == 1
|
||||
&& request.lines().get(0).sourceDetailId() == 41L
|
||||
&& request.lines().get(0).packageCount() == 2));
|
||||
}
|
||||
|
||||
@Test
|
||||
void reusesWarehouseSettlementTargetWhenRetryingAfterLocalRollback() {
|
||||
LoadingPickItemEntity item = item(11L, 21L, 31L, 41L, 3, 1, "PARTIAL");
|
||||
|
||||
Reference in New Issue
Block a user