fix(stocktake): enforce session_id in resume, make missing generation idempotent, update UI to show SN, and fix excel time offset

This commit is contained in:
DXC
2026-04-03 09:42:51 +08:00
parent 43e1d0aa55
commit 0d8f697df4
3 changed files with 28 additions and 9 deletions

View File

@ -74,7 +74,7 @@ export function getBom(parentId: number) {
}
// 获取应盘物资清单(盘点基数)
export function getAllStocktakeItems(params?: { keyword?: string }) {
export function getAllStocktakeItems(params?: { keyword?: string; session_id?: string }) {
return request({
url: '/v1/inbound/stock/stocktake/all-items',
method: 'get',

View File

@ -167,8 +167,8 @@
<span class="value">{{ currentItem.sku }}</span>
</div>
<div class="info-row">
<span class="label">批号:</span>
<span class="value">{{ currentItem.batch_no || '-' }}</span>
<span class="label">序列号(SN):</span>
<span class="value">{{ currentItem.sn || currentItem.batch_no || '-' }}</span>
</div>
</div>
@ -429,6 +429,7 @@ interface StockItem {
standard: string
sku: string
batch_no: string
sn?: string // ★ 序列号
serial_number?: string
uuid: string
bar_code: string
@ -484,6 +485,7 @@ const listLoading = ref(false)
const listData = ref<any[]>([])
const listStatusFilter = ref<'all' | 'counted' | 'uncounted'>('all')
const allStockItems = ref<any[]>([]) // 全量应盘物资(盘点基数)
const totalStockCount = ref(0) // ★ 全量应盘物资总数不受limit限制
const allScannedDrafts = ref<any[]>([]) // 全量草稿记录(脱离分页和过滤)
const listTotalFiltered = ref(0) // 过滤后的总数
@ -493,9 +495,12 @@ const currentSessionId = ref<string>('')
// 获取应盘物资清单(盘点基数)
const fetchAllStockItems = async () => {
try {
const res: any = await getAllStocktakeItems()
// ★ 必须传递 session_id用于隔离会话
const res: any = await getAllStocktakeItems({ session_id: currentSessionId.value })
if (res && res.code === 200) {
allStockItems.value = res.data.items || []
// ★ 使用返回的 total 获取真实总数,而不是受限的数组长度
totalStockCount.value = res.data.total || allStockItems.value.length
}
} catch (e) {
console.error('获取应盘物资清单失败', e)