废弃 ,换标文件上传 ,排车托盘锁粒度
This commit is contained in:
+7
-7
@@ -14,6 +14,7 @@ import com.baiyue.lastleg.dropship.entity.DropshipCarton;
|
||||
import com.baiyue.lastleg.dropship.entity.DropshipSkuInventory;
|
||||
import com.baiyue.lastleg.entity.LastlegOrder;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
|
||||
import com.baiyue.lastleg.mapper.LastlegOrderStatusHistoryMapper;
|
||||
import com.baiyue.lastleg.service.LastlegOrderNoGenerator;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -48,6 +49,7 @@ class CargoDiscardServiceTest {
|
||||
@Mock CargoDiscardInventoryMapper inventory;
|
||||
@Mock CargoDiscardInventoryAdjustmentService adjustments;
|
||||
@Mock LastlegOrderMapper orders;
|
||||
@Mock LastlegOrderStatusHistoryMapper orderHistories;
|
||||
|
||||
private CargoDiscardService service;
|
||||
private final AtomicReference<CargoDiscardApplication> storedApplication = new AtomicReference<>();
|
||||
@@ -66,6 +68,7 @@ class CargoDiscardServiceTest {
|
||||
ReflectionTestUtils.setField(service, "adjustments", adjustments);
|
||||
ReflectionTestUtils.setField(service, "orderNoGenerator", new LastlegOrderNoGenerator());
|
||||
ReflectionTestUtils.setField(service, "orders", orders);
|
||||
ReflectionTestUtils.setField(service, "orderHistories", orderHistories);
|
||||
ReflectionTestUtils.setField(service, "objectMapper", new ObjectMapper());
|
||||
ReflectionTestUtils.setField(service, "feePerPackage", new BigDecimal("5.00"));
|
||||
lenient().when(applications.insert(any(CargoDiscardApplication.class))).thenAnswer(invocation -> { storedApplication.set(invocation.getArgument(0)); return 1; });
|
||||
@@ -100,7 +103,7 @@ class CargoDiscardServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void approvalDeductsSkuInventoryAndWritesOneLedgerPerCarton() {
|
||||
void approvalPushesToPdaWithoutDeductingInventory() {
|
||||
CargoDiscardApplication application = pendingApplication();
|
||||
storedApplication.set(application);
|
||||
CargoDiscardItem item = item();
|
||||
@@ -108,15 +111,12 @@ class CargoDiscardServiceTest {
|
||||
storedLinks.add(link(item.getId(), 1L));
|
||||
storedLinks.add(link(item.getId(), 2L));
|
||||
when(applications.lockNo("100", "FH-1")).thenReturn(application);
|
||||
when(adjustments.discard(eq("100"), eq(application), any(), any(), eq("9"), any()))
|
||||
.thenReturn(new CargoDiscardInventoryAdjustmentService.AdjustmentResult(3, 2, 1));
|
||||
|
||||
var detail = service.review("100", "FH-1", "9", new CargoDiscardRequests.Review("APPROVE", "ok"));
|
||||
|
||||
assertEquals(CargoDiscardService.APPROVED, detail.summary().status());
|
||||
verify(adjustments).discard(eq("100"), eq(application), any(), any(), eq("9"), any());
|
||||
assertEquals("ok; inventoryBefore=3, discarded=2, inventoryAfter=1",
|
||||
storedHistories.get(storedHistories.size() - 1).getRemark());
|
||||
verify(adjustments, never()).discard(any(), any(), any(), any(), any(), any());
|
||||
verify(inventory, never()).deductSkuInventory(any(), anyLong(), anyInt());
|
||||
assertEquals("ok", storedHistories.get(storedHistories.size() - 1).getRemark());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+9
@@ -412,6 +412,15 @@ class DispatchServiceTest {
|
||||
verify(locks, org.mockito.Mockito.times(1)).selectList(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
void receivedPalletUsesPhysicalPalletAsDispatchLockIdentity() {
|
||||
DispatchPalletCandidate mergedInboundOrder = candidate(10L, 900L, "ONT8");
|
||||
DispatchPalletCandidate plannedOnly = candidate(11L, null, "ONT8");
|
||||
|
||||
assertEquals("RECEIVED:900", mergedInboundOrder.sourcePalletKey());
|
||||
assertEquals("PLAN:11", plannedOnly.sourcePalletKey());
|
||||
}
|
||||
|
||||
private DispatchPalletCandidate candidate(long planPalletId, Long warehousePalletId, String destination) {
|
||||
return candidate(planPalletId, warehousePalletId, destination, 12);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user