Commit 26a1bab1 by wusiyi

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

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