提交
This commit is contained in:
+32
-3
@@ -138,14 +138,14 @@ class PdaPalletOperationServiceTest {
|
||||
new PalletOperationRequests.PalletExpectation("SOURCE", 1),
|
||||
new PalletOperationRequests.PalletExpectation("TARGET", 2), List.of("BOX-1"), "rebind");
|
||||
assertThrows(ResponseStatusException.class, () -> ReflectionTestUtils.invokeMethod(service,
|
||||
"bindReturnRelabelPallet", identity(), app, List.of(item), source, target, request));
|
||||
"bindReturnRelabelPallet", identity(), app, List.of(item), source, target, request, false));
|
||||
verifyNoInteractions(physical);
|
||||
var binding = new com.baiyue.lastleg.relabel.pda.entity.PdaRelabelHistory();
|
||||
binding.setDetailJson("{\"round\":\"INITIAL\",\"cartonMarks\":[\"BOX-1\"]}");
|
||||
when(workHistory.selectList(any())).thenReturn(List.of(binding));
|
||||
task.setReviewedAt(LocalDateTime.of(2026, 10, 12, 12, 0));
|
||||
assertThrows(ResponseStatusException.class, () -> ReflectionTestUtils.invokeMethod(service,
|
||||
"bindReturnRelabelPallet", identity(), app, List.of(item), source, target, request));
|
||||
"bindReturnRelabelPallet", identity(), app, List.of(item), source, target, request, false));
|
||||
task.setReviewedAt(null);
|
||||
when(physical.resolveLocation(88L, 1020L)).thenReturn(
|
||||
new PalletPhysicalGateway.LocationReference(1020L, "SOURCE-LOC", "STORAGE", "ACTIVE"));
|
||||
@@ -155,7 +155,7 @@ class PdaPalletOperationServiceTest {
|
||||
when(physical.resolve("TARGET")).thenReturn(target);
|
||||
var result = (com.baiyue.lastleg.palletops.dto.PalletOperationResponses.Operation)
|
||||
ReflectionTestUtils.invokeMethod(service, "bindReturnRelabelPallet", identity(), app,
|
||||
List.of(item), source, target, request);
|
||||
List.of(item), source, target, request, false);
|
||||
assertEquals("TARGET", box.getPalletCode());
|
||||
assertEquals(0, result.pallets().get(0).totalPackages());
|
||||
assertEquals(2, result.pallets().get(1).totalPackages());
|
||||
@@ -584,6 +584,35 @@ class PdaPalletOperationServiceTest {
|
||||
assertThrows(ResponseStatusException.class, () -> service.createRelabelPallet(identity(), new PalletOperationRequests.NewRelabelPallet("RL-1", "different")));
|
||||
}
|
||||
|
||||
@Test void wholeRelabelCanRetainOriginalPalletWithoutMovingStockAndPartialCannot() {
|
||||
var tasks = mock(com.baiyue.lastleg.relabel.pda.mapper.PdaRelabelTaskMapper.class);
|
||||
var histories = mock(com.baiyue.lastleg.relabel.pda.mapper.PdaRelabelHistoryMapper.class);
|
||||
ReflectionTestUtils.setField(service,"relabelWorkTasks",tasks); ReflectionTestUtils.setField(service,"relabelWorkHistory",histories);
|
||||
var app = new RelabelApplication();app.setId(600L);app.setCustomerId("100");app.setRelabelNo("RL-1");
|
||||
app.setOverseasWarehouseId("88");app.setStatus("READY_FOR_OUTBOUND");app.setFulfillmentStatus("WAIT_PRE_DISPATCH");
|
||||
when(relabelApplications.findAnyByRelabelNo("RL-1")).thenReturn(app);
|
||||
when(relabelApplications.lockAnyByRelabelNo("RL-1")).thenReturn(app);
|
||||
var task = new com.baiyue.lastleg.relabel.pda.entity.PdaRelabelTask();task.setId(900L);task.setStatus("COMPLETED");
|
||||
when(tasks.find("100",600L)).thenReturn(task);
|
||||
var item = relabelItem(701L,"CARTON-A",100L);
|
||||
when(relabelItems.selectList(any())).thenReturn(List.of(item));
|
||||
when(relabelApplications.selectById(600L)).thenReturn(app);
|
||||
when(physical.resolve("SOURCE")).thenReturn(pallet(10L,"SOURCE",88L,0));
|
||||
when(physical.resolveLocation(88L,1010L)).thenReturn(new PalletPhysicalGateway.LocationReference(1010L,"LOC-1010","STORAGE","ACTIVE"));
|
||||
var position = position(100L,10L,"SOURCE",1,0);when(positions.selectById(100L)).thenReturn(position);
|
||||
var row = row(100L,10L,0,0);row.setHoldPackages(1L);
|
||||
when(mapper.lockPosition("88",100L)).thenReturn(row);when(mapper.content("88",10L)).thenReturn(List.of(row));
|
||||
when(mapper.palletPackages("88",10L)).thenReturn(1L);
|
||||
var request = new PalletOperationRequests.RelabelDisassemble("retain-1","RL-1",
|
||||
new PalletOperationRequests.PalletExpectation("SOURCE",0),new PalletOperationRequests.PalletExpectation("SOURCE",0),List.of("CARTON-A"),"整托贴标");
|
||||
var result = service.relabelDisassemble(identity(),request);
|
||||
assertEquals("COMPLETED",result.status()); assertEquals(1,result.pallets().size());
|
||||
verify(positions,never()).updateById(any(InventoryPosition.class)); verifyNoInteractions(relabelPalletMutations,ledgers);
|
||||
verify(histories).insert(any(com.baiyue.lastleg.relabel.pda.entity.PdaRelabelHistory.class));
|
||||
when(mapper.palletPackages("88",10L)).thenReturn(2L);
|
||||
assertTrue(assertThrows(ResponseStatusException.class,() -> service.relabelDisassemble(identity(),request)).getReason().contains("部分贴标"));
|
||||
}
|
||||
|
||||
private static PdaWarehouseIdentity identity() { return new PdaWarehouseIdentity("7", "picker", 88L); }
|
||||
private static PalletPhysicalGateway.PalletReference pallet(long id, String code, long warehouse, int version) {
|
||||
return new PalletPhysicalGateway.PalletReference(id, code, warehouse, 1000L + id,
|
||||
|
||||
Reference in New Issue
Block a user