fix: show cross-plan merged pallet ownership

This commit is contained in:
2026-09-11 16:11:31 +08:00
parent 6d26634b1b
commit 3ea1e279c6
4 changed files with 16 additions and 4 deletions
@@ -38,15 +38,16 @@ const feeColumns: DataTableColumn[] = [{ key: 'index', label: '序号', width: 7
const palletColumns: DataTableColumn[] = [
{ key: 'inboundCode', prop: 'inboundCode', label: '入仓码', minWidth: 150 },
{ key: 'palletNo', prop: 'palletNo', label: '托盘号', minWidth: 150 },
{ key: 'palletOwner', prop: 'palletOwner', label: '托盘所属计划', minWidth: 190 },
{ key: 'packageCount', prop: 'packageCount', label: '对应箱数', width: 110, align: 'right' },
]
const palletRows = computed(() => (detail.value?.allocations || []).map((allocation, index) => {
const line = detail.value?.lines.find(item => item.id === allocation.lineId)
const pallet = detail.value?.pallets.find(item => item.id === allocation.palletId)
return {
id: `${allocation.lineId}-${allocation.palletId}-${index}`,
inboundCode: text(line?.inboundCode),
palletNo: text(pallet?.palletNo),
palletNo: text(allocation.palletNo),
palletOwner: allocation.palletOwnedByCurrentPlan ? `${allocation.palletOwnerPlanNo}(本计划)` : `${allocation.palletOwnerPlanNo}(跨计划合托)`,
packageCount: Number(allocation.pickedPackageCount ?? allocation.countedPackageCount ?? allocation.plannedPackageCount ?? 0),
}
}))
@@ -50,6 +50,17 @@ describe('overseas warehouse mounted real API pages', () => {
expect(rows[1]).toMatchObject({ warehouse: '—', fbaWarehouse: 'ONT8', destinationWarehouseName: 'ONT8目的仓' })
})
it('mounts inbound detail with business references and independent receiving and FBA warehouse references', async () => { routing.route.params = { orderId: 'IP-1' }; routing.route.query = { customerId: '10001' }; const wrapper = mount(InboundOrderDetailView, { global: { plugins: [ElementPlus] } }); await flushPromises(); expect(getInboundPlan).toHaveBeenCalledWith('IP-1', '10001'); expect(wrapper.text()).toContain('IP-1'); expect(wrapper.text()).toContain('IN-1'); expect(wrapper.text()).not.toContain('9007199254740995'); expect(wrapper.text()).toContain('FL-WH-20260911-000001'); expect(wrapper.text()).toContain('客户甲'); expect(wrapper.text()).toContain('一件代发'); expect(wrapper.text()).toContain('2026-09-11 10:00'); expect(wrapper.text()).toContain('页面验收'); expect(wrapper.text()).toContain('US-LAX-01 · 洛杉矶接柜仓'); expect(wrapper.text()).toContain('ABE3'); expect(wrapper.text()).not.toContain('ABE3目的仓') })
it('shows the real pallet and owner plan for a cross-plan merged allocation', async () => {
vi.mocked(getInboundPlan).mockResolvedValueOnce({ id: '101', planNo: 'IP-CURRENT', customerId: '10001', sourceOrderId: '1', overseasWarehouseCode: 'US-LAX-01', overseasWarehouseName: '洛杉矶接柜仓', status: 'PICKING', lineCount: 1, palletCount: 1, totalVolumeCbm: 2, lines: [{ id: '201', orderId: '1', inboundCode: 'EXXHK2609100014', fbaWarehouseCode: 'ACY2', requiredPackageCount: 150, plannedPalletCount: 1 }], pallets: [{ id: '301', palletNo: 'DRYU2309389-101-005', sequenceNo: 1, actualPackageCount: 0 }], allocations: [{ lineId: '201', palletId: '302', palletNo: 'DRYU2309389-101-006', palletOwnerPlanNo: 'IP-OWNER', palletOwnedByCurrentPlan: false, plannedPackageCount: 150, countedPackageCount: 150, pickedPackageCount: 150, status: 'PICKED', version: 0 }] })
routing.route.params = { orderId: 'IP-CURRENT' }; routing.route.query = { customerId: '10001' }
const wrapper = mount(InboundOrderDetailView, { global: { plugins: [ElementPlus] } })
await flushPromises()
const rows = wrapper.findComponent(DataTable).props('data') as Array<{ palletNo: string; palletOwner: string; packageCount: number }>
expect(rows).toEqual([expect.objectContaining({ palletNo: 'DRYU2309389-101-006', palletOwner: 'IP-OWNER(跨计划合托)', packageCount: 150 })])
expect(wrapper.text()).not.toContain('DRYU2309389-101-005(跨计划合托)')
})
it('shows an empty receiving warehouse when either frozen field is missing without falling back to destination data', async () => {
vi.mocked(getInboundPlan).mockResolvedValueOnce({ id: '1', planNo: 'IP-2', customerId: '10001', sourceOrderId: '2', overseasWarehouseCode: null, overseasWarehouseName: '不充整接柜仓', status: 'PENDING_ASSIGNMENT', lineCount: 1, palletCount: 0, totalVolumeCbm: 0, lines: [{ id: '3', orderId: '2', inboundCode: 'IN-2', fbaWarehouseCode: 'ABE3', destinationWarehouseCode: 'ABE3', destinationWarehouseName: 'ABE3目的仓', requiredPackageCount: 1, plannedPalletCount: 0 }], pallets: [], allocations: [] })
routing.route.params = { orderId: 'IP-2' }; routing.route.query = { customerId: '10001' }