贴标申请,仓储转运
This commit is contained in:
+18
@@ -82,6 +82,24 @@ class PdaRelabelServiceTest {
|
||||
lenient().when(tasks.updateWithVersion(any(), anyInt())).thenReturn(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
void candidatesUseCustomerNameOnlyFromMatchingCustomerOrder() {
|
||||
var orders = org.mockito.Mockito.mock(com.baiyue.lastleg.mapper.LastlegOrderMapper.class);
|
||||
var directory = org.mockito.Mockito.mock(com.baiyue.lastleg.fleet.customer.FleetCustomerDirectory.class);
|
||||
ReflectionTestUtils.setField(service, "customerDirectory", directory);
|
||||
ReflectionTestUtils.setField(service, "tailOrders", orders);
|
||||
application.setLastlegOrderId(20L);
|
||||
var order = new com.baiyue.lastleg.entity.LastlegOrder();
|
||||
order.setId(20L); order.setCustomerId("100"); order.setCustomerName("测试客户");
|
||||
when(applications.selectList(any())).thenReturn(List.of(application));
|
||||
when(orders.selectBatchIds(any())).thenReturn(List.of(order));
|
||||
assertEquals("测试客户", service.candidates("7", 900L).get(0).customerName());
|
||||
order.setCustomerId("OTHER");
|
||||
when(directory.find("100")).thenReturn(new com.baiyue.lastleg.fleet.customer.FleetCustomerDirectory.Customer("100", "C100", "所属公司", null, null));
|
||||
assertEquals("所属公司", service.candidates("7", 900L).get(0).customerName());
|
||||
verify(orders, org.mockito.Mockito.times(2)).selectBatchIds(List.of(20L));
|
||||
}
|
||||
|
||||
@Test
|
||||
void claimUsesFrozenWarehouseAndAdvancesExistingApplicationStateMachine() {
|
||||
when(applications.lockAnyByRelabelNo("FBR-1")).thenReturn(application);
|
||||
|
||||
+15
@@ -54,6 +54,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.ArgumentMatchers.isNull;
|
||||
@@ -643,6 +644,18 @@ class RelabelApplicationServiceTest {
|
||||
assertEquals(6L, move.getValue().packages());
|
||||
}
|
||||
|
||||
@Test
|
||||
void pdaCompletionSettlesBeforeCustomerConfirmationAndDoesNotSettleTwice() {
|
||||
var app = confirmationApplication("TRUCK", false);
|
||||
when(applications.lockNo("10001", "FBR-1")).thenReturn(app);
|
||||
when(orders.selectById(21L)).thenReturn(order(21L, "10001", "LMO-1", "WAIT_RELABEL"));
|
||||
service.settlePdaCompletion("10001", "FBR-1", "picker");
|
||||
service.settlePdaCompletion("10001", "FBR-1", "picker");
|
||||
verify(walletCommands).publish(eq("SETTLE"), eq(10001L), eq("RELABEL_ORDER"), eq("FBR-1"), isNull(), anyString(), eq(2L));
|
||||
assertEquals("SETTLE_PENDING", app.getWalletStatus());
|
||||
assertNull(app.getCustomerConfirmedAt());
|
||||
}
|
||||
|
||||
@Test
|
||||
void truckCustomerConfirmationIsIdempotentAndWaitsForPreDispatch() {
|
||||
RelabelApplication application = confirmationApplication("TRUCK", false);
|
||||
@@ -662,6 +675,7 @@ class RelabelApplicationServiceTest {
|
||||
assertEquals("CONFIRMED", review.getValue().getReviewDecision());
|
||||
assertEquals("WAIT_OUTBOUND", linked.getCurrentStatus());
|
||||
assertNull(application.getOutboundOrderNo());
|
||||
verify(walletCommands, never()).publish(eq("FREEZE"), anyLong(), anyString(), anyString(), any(), anyString(), anyLong());
|
||||
verify(outboundOrders, never()).insert(any(OutboundOrder.class));
|
||||
|
||||
service.confirmCompletion("10001", "FBR-1", "customer-1",
|
||||
@@ -838,6 +852,7 @@ class RelabelApplicationServiceTest {
|
||||
RelabelApplication application = application(11L, "FBR-1", "10001", "key-1", "hash",
|
||||
RelabelApplicationService.CUSTOMER_CONFIRM_PENDING);
|
||||
application.setLastlegOrderId(21L);
|
||||
application.setOverseasWarehouseId("900");
|
||||
application.setDeliveryMethod(deliveryMethod);
|
||||
application.setPrintShippingLabel(printShippingLabel);
|
||||
return application;
|
||||
|
||||
Reference in New Issue
Block a user