1
This commit is contained in:
parent
a9ba68e0fd
commit
806f53d1d6
@ -171,6 +171,7 @@ export type EntryOrderDetail = {
|
|||||||
entry_order_code?: string
|
entry_order_code?: string
|
||||||
purchase_order_code?: string
|
purchase_order_code?: string
|
||||||
store_name?: string
|
store_name?: string
|
||||||
|
store_remask?: string
|
||||||
order_status?: string
|
order_status?: string
|
||||||
items?: EntryDetailItem[]
|
items?: EntryDetailItem[]
|
||||||
receivingBindings?: EntryOrderReceivingBinding[]
|
receivingBindings?: EntryOrderReceivingBinding[]
|
||||||
@ -185,6 +186,8 @@ export type GetEntryDetailResponse = {
|
|||||||
entryOrder?: EntryOrderDetail
|
entryOrder?: EntryOrderDetail
|
||||||
data?: {
|
data?: {
|
||||||
entryOrder?: EntryOrderDetail
|
entryOrder?: EntryOrderDetail
|
||||||
|
items?: EntryDetailItem[]
|
||||||
|
receivingBindings?: EntryOrderReceivingBinding[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -87,6 +87,7 @@ import {
|
|||||||
commit,
|
commit,
|
||||||
getEntryDetail,
|
getEntryDetail,
|
||||||
type EntryDetailItem,
|
type EntryDetailItem,
|
||||||
|
type EntryDetailItemBarcode,
|
||||||
} from '@/api/storage.entry/entry'
|
} from '@/api/storage.entry/entry'
|
||||||
import DirectInboundImportDialog, {
|
import DirectInboundImportDialog, {
|
||||||
type DirectInboundImportRow,
|
type DirectInboundImportRow,
|
||||||
@ -218,17 +219,46 @@ async function loadEntryDetail() {
|
|||||||
const entryOrder = res.data.entryOrder
|
const entryOrder = res.data.entryOrder
|
||||||
entryOrderStatus.value = entryOrder.order_status || ''
|
entryOrderStatus.value = entryOrder.order_status || ''
|
||||||
entryOrderCode.value = entryOrder.entry_order_code || ''
|
entryOrderCode.value = entryOrder.entry_order_code || ''
|
||||||
const items = entryOrder.items || []
|
|
||||||
|
|
||||||
tableData.value = items.map((item: EntryDetailItem) => ({
|
// items 与 entryOrder 同级,在 res.data 下
|
||||||
...item,
|
const rawItems: any[] = res.data.items || []
|
||||||
direct_inbound_quantity: item.direct_inbound_quantity ?? 0,
|
const items: EntryDetailItem[] = rawItems.map((item: any) => {
|
||||||
remaining_quantity: item.remaining_quantity ?? item.count ?? 0,
|
const stock = item.stock || {}
|
||||||
entry_order_code: entryOrder.entry_order_code || '',
|
const barcodes: EntryDetailItemBarcode[] = (stock.barcodes || []).map((b: any) => ({
|
||||||
purchase_order_code: entryOrder.purchase_order_code || '',
|
id: b.id,
|
||||||
store_name: entryOrder.store_name || '',
|
barcode: b.barcode,
|
||||||
}))
|
}))
|
||||||
|
const imageUrls: string[] = Array.isArray(stock.image_url) ? stock.image_url : []
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
stock_id: item.stock_id ?? stock.id,
|
||||||
|
external_item_code: item.external_item_code ?? '',
|
||||||
|
external_item_id: item.external_item_id,
|
||||||
|
warehouse_item_code: stock.item_code || '',
|
||||||
|
warehouse_item_name: stock.item_name || '',
|
||||||
|
warehouse_item_spec: stock.sku_property || '',
|
||||||
|
count: item.planned ?? item.count ?? 0,
|
||||||
|
received_quantity: item.completed ?? item.received_quantity ?? 0,
|
||||||
|
confirm_quantity: item.confirm_quantity ?? 0,
|
||||||
|
warehouse_quantity: stock.quantity ?? null,
|
||||||
|
warehouse_locked_quantity: stock.locked_quantity ?? null,
|
||||||
|
warehouse_is_batch_mgmt: stock.is_batch_mgmt ?? null,
|
||||||
|
warehouse_is_shelf_life_mgmt: stock.is_shelf_life_mgmt ?? null,
|
||||||
|
warehouse_image_url: imageUrls.length > 0 ? imageUrls[0] : '',
|
||||||
|
warehouse_is_images: stock.is_images ?? null,
|
||||||
|
barcodes,
|
||||||
|
direct_inbound_quantity: item.direct_inbound_quantity ?? 0,
|
||||||
|
remaining_quantity: item.remaining_quantity ?? ((item.planned ?? item.count ?? 0) - (item.completed ?? item.received_quantity ?? 0)),
|
||||||
|
pending_total: item.pending_total ?? 0,
|
||||||
|
bindings: item.bindings || [],
|
||||||
|
direct_logs: item.direct_logs || [],
|
||||||
|
entry_order_code: entryOrder.entry_order_code || '',
|
||||||
|
purchase_order_code: entryOrder.purchase_order_code || '',
|
||||||
|
store_name: entryOrder.store_remask || entryOrder.store_name || '',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tableData.value = items
|
||||||
directSummary.value = buildDirectSummary(items)
|
directSummary.value = buildDirectSummary(items)
|
||||||
pagination.total = tableData.value.length
|
pagination.total = tableData.value.length
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -483,16 +483,20 @@ async function fetchEntryPrintData(row: any, _index: number): Promise<Record<str
|
|||||||
}
|
}
|
||||||
const entryOrder = res.data.entryOrder as Record<string, unknown>
|
const entryOrder = res.data.entryOrder as Record<string, unknown>
|
||||||
const result: Record<string, unknown> = { ...entryOrder }
|
const result: Record<string, unknown> = { ...entryOrder }
|
||||||
// 表格渲染使用 details 字段,将 items 映射过去
|
|
||||||
if (Array.isArray(entryOrder.items)) {
|
// items 与 entryOrder 同级,在 res.data 下
|
||||||
result.details = (entryOrder.items as any[]).map((item: any, idx: number) => ({
|
const items: any[] = res.data.items || []
|
||||||
|
result.details = items.map((item: any, idx: number) => {
|
||||||
|
const stock = item.stock || {}
|
||||||
|
return {
|
||||||
...item,
|
...item,
|
||||||
|
...stock,
|
||||||
// 条码:取 barcodes 数组第一条的 barcode
|
// 条码:取 barcodes 数组第一条的 barcode
|
||||||
barcode: item.barcode ?? item.barcodes?.[0]?.barcode ?? '',
|
barcode: item.barcode ?? stock.barcodes?.[0]?.barcode ?? '',
|
||||||
// 序号
|
// 序号
|
||||||
seq_no: idx + 1,
|
seq_no: idx + 1,
|
||||||
}))
|
}
|
||||||
}
|
})
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user