Commit 26a1bab1 by wusiyi

fix: 修复单件打单扫码数据丢失问题 #1001806

parent c8d0655b
......@@ -642,7 +642,8 @@ watch(
if (item?.data) {
renderItemBox(true)
} else {
if (boxIndex.value === podBoxIndex.value) {
// 0 号箱为单件,不在播种墙列表中,不应清空当前单件数据
if (boxIndex.value === podBoxIndex.value && boxIndex.value !== 0) {
podOrderDetailsData.value = {}
boxIndex.value = null
}
......@@ -1155,37 +1156,44 @@ const initOrderDetailBox = async (type: 'scan' | 'manual' = 'manual') => {
}
return item
})
const currentBox = boxIndex.value
const currentBoxItem = currentBox
? boxList.find((item) => item.box === currentBox && item.data)
: undefined
const fallbackItem = boxList.find((item) => item.data)
const targetItem = currentBoxItem || fallbackItem
podOrderDetailsData.value = targetItem?.data || undefined
boxIndex.value = targetItem?.box || null
// 当 boxIndex.value 为 0 时,不更新列表数据,防止单件数据丢失
if (boxIndex.value !== 0) {
const currentBox = boxIndex.value
const currentBoxItem = currentBox
? boxList.find((item) => item.box === currentBox && item.data)
: undefined
const fallbackItem = boxList.find((item) => item.data)
const targetItem = currentBoxItem || fallbackItem
podOrderDetailsData.value = targetItem?.data || undefined
boxIndex.value = targetItem?.box || null
podOrderDetailsData.value?.productList?.forEach((el) => {
if (!el.previewImgs) {
if (el.productMark === 'custom_normal' || el.productMark === 'normal') {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
? JSON.parse(el.imageAry)
: [{ url: el.variantImage }]
podOrderDetailsData.value?.productList?.forEach((el) => {
if (!el.previewImgs) {
if (
el.productMark === 'custom_normal' ||
el.productMark === 'normal'
) {
el.previewImgs = [{ url: el.variantImage || '' }]
} else {
el.previewImgs = el.imageAry
? JSON.parse(el.imageAry)
: [{ url: el.variantImage }]
}
}
})
if (type !== 'scan') {
coverImage.value =
podOrderDetailsData.value?.productList?.[0]?.previewImgs?.[0].url ||
''
}
})
if (type !== 'scan') {
coverImage.value =
podOrderDetailsData.value?.productList?.[0]?.previewImgs?.[0].url || ''
}
if (
podOrderDetailsData.value &&
podOrderDetailsData.value.pickingNumber ===
podOrderDetailsData.value.purchaseNumber
) {
podOrderDetailsData.value.printResult = 'notPrintSuccess'
if (
podOrderDetailsData.value &&
podOrderDetailsData.value.pickingNumber ===
podOrderDetailsData.value.purchaseNumber
) {
podOrderDetailsData.value.printResult = 'notPrintSuccess'
}
}
const pickFinished = boxList.filter((item) => {
return item.data?.productList?.every((product) => product.power)
......@@ -1417,6 +1425,7 @@ const print = (data: OrderData, forcePrint = false, callback?: () => void) => {
} else {
;(podOrderDetailsData.value as OrderData).printResult = 'printFail'
}
return
}
const factoryNo = userStore.user?.factory.id
if (!factoryNo) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment