Commit e193f6ab by qinjianhui

fix: 修复取消后处理创建入库单时未对同一sku合并处理问题 #1002084

parent d2f79600
......@@ -711,7 +711,7 @@ const handleEmbryoInStockByCard = async (
})
try {
otherPurchaseData.value = []
if(type!=='embryoInStock'){
if (type !== 'embryoInStock') {
const res = await getBySkuAndUserMarkAndInboundTypeApi(
operationList.map((r) => r.operationNo as string),
)
......@@ -719,17 +719,34 @@ const handleEmbryoInStockByCard = async (
otherPurchaseData.value = res.data.map((item: InterskuList) =>
mapInterskuToProduct(item, type),
)
}else{
for(const item of operationList){
if(!item.thirdSkuCode) return
const userMark = item.thirdSkuCode.includes('JM')?null:item.thirdSkuCode.slice(0,4)
const res = await getBySkuAndUserMarkApi(firstWid, item.thirdSkuCode, userMark)
otherPurchaseData.value = otherPurchaseData.value.concat(
res.data.map((it: InterskuList) =>
mapInterskuToProduct(it, type)
)
)
}
} else {
const userMarkMap = operationList.reduce((acc, cur) => {
if (!cur.thirdSkuCode) return acc
const key = cur.thirdSkuCode.includes('JM')
? ''
: cur.thirdSkuCode.slice(0, 4)
if (!acc[key]) {
acc[key] = []
}
if (!acc[key].includes(cur.thirdSkuCode)) {
acc[key].push(cur.thirdSkuCode)
}
return acc
}, {} as Record<string, string[]>)
const results = await Promise.all(
Object.entries(userMarkMap).map(([userMark, skuSet]) =>
getBySkuAndUserMarkApi(
firstWid,
skuSet.join(','),
userMark || null,
),
),
)
otherPurchaseData.value = results.flatMap((res) =>
(res.data || []).map((it: InterskuList) =>
mapInterskuToProduct(it, type),
),
)
}
await fetchReceiptLocationList('')
const listRes = await warehouseInfoGetAll()
......
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