fix: resolve cross-plan pallet allocations
This commit is contained in:
+38
@@ -334,6 +334,44 @@ class InboundPlanServiceTest {
|
||||
verify(orderMapper).findDetailOrder("100", 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void detailResolvesCrossPlanMergedPalletWithoutChangingOwnedPalletList() {
|
||||
InboundPlan currentPlan = existingPlan("100", 1L, "IP-CURRENT");
|
||||
InboundPlan ownerPlan = existingPlan("100", 2L, "IP-OWNER");
|
||||
InboundPlanPallet ownedPallet = new InboundPlanPallet();
|
||||
ownedPallet.setId(301L);
|
||||
ownedPallet.setPlanId(currentPlan.getId());
|
||||
ownedPallet.setPalletNo("DRYU2309389-101-005");
|
||||
ownedPallet.setSequenceNo(1);
|
||||
ownedPallet.setActualPackageCount(0);
|
||||
InboundPlanPallet mergedPallet = new InboundPlanPallet();
|
||||
mergedPallet.setId(302L);
|
||||
mergedPallet.setPlanId(ownerPlan.getId());
|
||||
mergedPallet.setPalletNo("DRYU2309389-101-006");
|
||||
InboundPlanPalletAllocation allocation = new InboundPlanPalletAllocation();
|
||||
allocation.setLineId(201L);
|
||||
allocation.setPalletId(302L);
|
||||
allocation.setPlannedPackageCount(150);
|
||||
allocation.setCountedPackageCount(150);
|
||||
allocation.setPickedPackageCount(150);
|
||||
allocation.setVersion(0);
|
||||
|
||||
when(planMapper.selectOne(any())).thenReturn(currentPlan);
|
||||
when(palletMapper.selectList(any())).thenReturn(List.of(ownedPallet));
|
||||
when(allocationMapper.selectList(any())).thenReturn(List.of(allocation));
|
||||
when(palletMapper.selectBatchIds(any())).thenReturn(List.of(mergedPallet));
|
||||
when(planMapper.selectBatchIds(any())).thenReturn(List.of(ownerPlan));
|
||||
|
||||
var result = service.detailByPlanNo("100", "IP-CURRENT");
|
||||
|
||||
assertEquals(List.of("DRYU2309389-101-005"),
|
||||
result.pallets().stream().map(pallet -> pallet.palletNo()).toList());
|
||||
assertEquals("DRYU2309389-101-006", result.allocations().get(0).palletNo());
|
||||
assertEquals("IP-OWNER", result.allocations().get(0).palletOwnerPlanNo());
|
||||
assertEquals(false, result.allocations().get(0).palletOwnedByCurrentPlan());
|
||||
assertEquals(150, result.allocations().get(0).pickedPackageCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
void detailFailsClosedWhenReceivingWarehouseFactIsMissing() {
|
||||
InboundPlan plan = existingPlan("100", 1L, "LIP-1");
|
||||
|
||||
Reference in New Issue
Block a user