Commit e193f6ab by qinjianhui

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

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