feat(selfop): prefer list SKU quantities with targeted detail fallback

This commit is contained in:
2026-10-14 08:15:16 +08:00
parent 4ae158c93e
commit c640fa2d0d
14 changed files with 220 additions and 31 deletions
@@ -131,7 +131,7 @@ class LingxingInternalControllerTest {
void authenticatedReadReturnsOnlyOutboundSummary() throws Exception {
when(client.queryPage(any(), any())).thenReturn(new PageResult(
List.of(new OrderSummary("TEST-OUT-001", "TEST-SRC-001", "TEST-CUSTOMER", "TEST-WH", 100,
"2026-10-01 08:00:00", "2026-10-02 08:00:00")),
"2026-10-01 08:00:00", "2026-10-02 08:00:00", null)),
1L, 1, 1, 1, 1, 1, 200, Instant.parse("2026-10-12T00:00:00Z"), null));
mvc.perform(post(PATH).header("X-Internal-Service-Token", token).header("X-Lingxing-Egress-Context", CONTEXT)
.contentType(MediaType.APPLICATION_JSON).content(BODY))
@@ -81,6 +81,17 @@ class LingxingWmsClientTest {
assertThat(result.observedAt()).isEqualTo(NOW);
assertThat(result.pages()).isEqualTo(1);
}
@Test void listProductsPreserveDecimalsZeroAndMissingQuantity() {
response.set(page("current","size",1,1,1,1,ORDER.strip().replace("}","""
,"productList":[{"productSku":"SKU","qty":2.123456},{"productSku":"ZERO","qty":0},
{"productSku":"UNKNOWN"},{"qty":4}]}""")));
var products=client().queryPage(query(1,1),context()).records().get(0).productList();
assertThat(products).hasSize(4);
assertThat(products.get(0).qty()).isEqualByComparingTo("2.123456");
assertThat(products.get(1).qty()).isEqualByComparingTo("0");
assertThat(products.get(2).qty()).isNull();assertThat(products.get(3).productSku()).isNull();
assertThat(calls.get()).isEqualTo(1);
}
@Test void cancelledLocateOmitsTimeAndStatusAndRejectsFuzzyMatch() throws Exception {
response.set(page("current", "size", 1, 1, 1, 1, ORDER.replace("100", "99").replace("2026-10-01 01:00:00", "")));
var observer = org.mockito.Mockito.mock(LingxingQuantityCapture.class);