提交
This commit is contained in:
1 parent
6d9354a194
commit
aff71d296b
2759 files changed
+860425
-13211
No files matched your search
@@ -9,9 +9,12 @@ import {
|
||||
planApi,
|
||||
transportApi,
|
||||
freightApi,
|
||||
inboundOrderApi,
|
||||
outboundOrderApi,
|
||||
type FreightSettlementBrief,
|
||||
type Plan,
|
||||
type PlanProduct,
|
||||
type PlIoOrder,
|
||||
type Transport,
|
||||
type TransportInventoryLink,
|
||||
type TransportSiteLink
|
||||
@@ -132,6 +135,24 @@ export function usePlPlanViewDetail() {
|
||||
const contractSnapshot = ref<ContractVO | null>(null)
|
||||
const dibangRows = ref<PlPlanTransportDibangRow[]>([])
|
||||
const siteRows = ref<PlPlanTransportSiteRow[]>([])
|
||||
const ioOrder = ref<PlIoOrder | null>(null)
|
||||
|
||||
async function loadIoOrder(data: Plan) {
|
||||
ioOrder.value = null
|
||||
if (data.planType !== 'inbound' && data.planType !== 'outbound') return
|
||||
// 未安排运输时尚无入库/出库单;已作废计划仍可能有历史单据
|
||||
if (data.transportStatus !== 'arranged' && data.followStatus !== 'cancelled') {
|
||||
return
|
||||
}
|
||||
const api = data.planType === 'inbound' ? inboundOrderApi : outboundOrderApi
|
||||
try {
|
||||
const res = await api.getByPlan(data.id)
|
||||
const order = pickBxData<PlIoOrder | null>(res)
|
||||
ioOrder.value = order && typeof order === 'object' && 'id' in order ? order : null
|
||||
} catch {
|
||||
ioOrder.value = null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadSiteRows(planId: string, data: Plan) {
|
||||
siteRows.value = []
|
||||
@@ -140,9 +161,29 @@ export function usePlPlanViewDetail() {
|
||||
}
|
||||
try {
|
||||
const infoRes = await planApi.getArrangeInfo(planId)
|
||||
const info = pickBxData<{ siteRecords?: TransportSiteLink[] }>(infoRes)
|
||||
const info = pickBxData<{ siteRecords?: TransportSiteLink[]; ioOrder?: { orderId: string; orderNo: string; siteUrl?: string; siteAccessToken?: string; kind?: string } }>(infoRes)
|
||||
const links = info?.siteRecords || []
|
||||
siteRows.value = links.map(link => ({ link }))
|
||||
if (links.length) {
|
||||
siteRows.value = links.map(link => ({ link }))
|
||||
return
|
||||
}
|
||||
// 新链路:从入库/出库单合成一条现场链接行
|
||||
if (info?.ioOrder?.siteUrl) {
|
||||
const kind = info.ioOrder.kind || data.planType
|
||||
siteRows.value = [
|
||||
{
|
||||
link: {
|
||||
planProductId: '',
|
||||
productName: info.ioOrder.orderNo,
|
||||
siteLinkId: info.ioOrder.orderId,
|
||||
planNo: data.planNo || '',
|
||||
businessType: kind === 'inbound' ? '入库' : '出库',
|
||||
siteAccessToken: info.ioOrder.siteAccessToken,
|
||||
siteUrl: info.ioOrder.siteUrl
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
} catch {
|
||||
siteRows.value = []
|
||||
}
|
||||
@@ -192,6 +233,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
siteRows.value = []
|
||||
ioOrder.value = null
|
||||
try {
|
||||
const res = await planApi.get(planId)
|
||||
const data = pickBxData<Plan>(res)
|
||||
@@ -255,7 +297,11 @@ export function usePlPlanViewDetail() {
|
||||
}
|
||||
|
||||
if (data) {
|
||||
await Promise.all([loadSiteRows(planId, data), loadDibangRows(planId, data)])
|
||||
await Promise.all([
|
||||
loadSiteRows(planId, data),
|
||||
loadDibangRows(planId, data),
|
||||
loadIoOrder(data)
|
||||
])
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
@@ -271,6 +317,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot.value = null
|
||||
dibangRows.value = []
|
||||
siteRows.value = []
|
||||
ioOrder.value = null
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -283,6 +330,7 @@ export function usePlPlanViewDetail() {
|
||||
contractSnapshot,
|
||||
dibangRows,
|
||||
siteRows,
|
||||
ioOrder,
|
||||
loadDetail,
|
||||
resetDetail
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user