fix: localize overseas inventory ledger

This commit is contained in:
2026-09-04 17:46:15 +08:00
parent bc6629d400
commit 39ade43a72
6 changed files with 58 additions and 9 deletions
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { formatOverseasDateTime, lastMileOrderReference, toLastMileOrderListItem } from './lastMilePresentation'
import { formatOverseasDateTime, inventoryBusinessTypeLabel, lastMileOrderReference, toLastMileOrderListItem } from './lastMilePresentation'
describe('last-mile order presentation adapter', () => {
it('formats overseas timestamps with zero-padded seconds', () => {
@@ -11,6 +11,26 @@ describe('last-mile order presentation adapter', () => {
expect(formatOverseasDateTime('not-a-date')).toBe('not-a-date')
})
it.each([
['IN_TRANSIT', '在途入账'],
['STOCK_IN', '入库'],
['STOCK_IN_TRANSIT_RELEASE', '在途库存转入'],
['HOLD', '库存暂扣'],
['RELEASE', '解除暂扣'],
['ALLOCATE', '库存分配'],
['UNALLOCATE', '取消分配'],
['PICK', '拣货'],
['SHIP', '出库'],
['ADJUST', '库存调整'],
['STOCKTAKE_ADJUST', '盘点调整'],
['PALLET_ASSEMBLE', '组托'],
['PALLET_DISASSEMBLE', '拆托'],
['PALLET_SWAP', '换托'],
['PALLET_UNBIND', '解托'],
])('maps inventory business type %s to %s', (code, label) => {
expect(inventoryBusinessTypeLabel(code)).toBe(label)
})
it('maps backend codes, associations and long ids without inventing data', () => {
const row = toLastMileOrderListItem({
id: '190000000000000099', customerId: '190000000000000001', orderNo: 'LL-001', orderType: 'ONE_CLICK_DROPSHIP', currentStatus: 'PENDING_ASSIGNMENT',