修改提交

This commit is contained in:
2026-09-06 16:02:11 +08:00
parent 3ae8964fe5
commit 9d213b3843
38 changed files with 177 additions and 44 deletions
@@ -186,6 +186,28 @@ class RelabelApplicationServiceTest {
verify(orders, never()).insert(any(LastlegOrder.class));
}
@Test
void createAllowsCartonWithoutSku() {
RelabelRequests.Item withoutSku = carton(null, "BOX-NO-SKU", "FBA-NO-SKU", "ONT8");
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-NO-SKU", null,
LocalDateTime.of(2026, 9, 10, 10, 0), "Li", "13800000000", BigDecimal.ONE,
null, "key-no-sku", List.of(withoutSku));
RelabelApplication persisted = application(11L, "FBR-1", "10001", "key-no-sku", null,
RelabelApplicationService.PENDING_PROCESSING);
persisted.setLastlegOrderId(21L);
when(applications.findNo(eq("10001"), any())).thenReturn(persisted);
when(items.selectList(any())).thenReturn(List.of(item(31L, 11L, null, 1, 1)));
when(histories.selectList(any())).thenReturn(List.of());
when(orders.selectById(21L)).thenReturn(order(21L, "10001", "LMO-RELABEL-1",
RelabelApplicationService.PENDING_PROCESSING));
service.create("10001", "operator-1", request);
ArgumentCaptor<RelabelItem> saved = ArgumentCaptor.forClass(RelabelItem.class);
verify(items).insert(saved.capture());
assertEquals(null, saved.getValue().getSkuCode());
}
@Test
void sameIdempotencyKeyAndPayloadReturnsExistingApplicationWithoutWrites() {
RelabelRequests.Create request = request("key-1", 10, 6);