Files
KCGL/inventory-web/src/api/inbound/stock.ts
yueli 8c10bb0903 feat: 盘点合并列表 — 服务端JOIN+DB分页,消除99999全量加载
## stock.py
- 新增 GET /draft/merged-list: UNION ALL三表+LEFT JOIN draft
  数据库级 LIMIT/OFFSET 分页,不再加载全量到Python内存
- 参数: session_id, keyword, status_filter, page, pageSize
- 返回: list, total, total_scanned (已扫去重数)

## stock.ts
- 新增 getDraftMergedList() API函数

## stocktake/index.vue
- fetchInventoryList: 改用merged-list单次调用替代99999全量+find()
- resumeSession: limit 99999→1 先检查存在,再limit 500加载
2026-07-16 13:08:29 +08:00

108 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import request from '@/utils/request'
// 获取全量库存
// 修改前: url: '/api/v1/inbound/stock/all'
// 修改后: url: '/v1/inbound/stock/all'
export function getAllStock() {
return request({
url: '/v1/inbound/stock/all',
method: 'get'
})
}
// 分页库存列表(服务端分页,支持关键字搜索)
export function getStockList(params: { page?: number; pageSize?: number; keyword?: string }) {
return request({
url: '/v1/inbound/stock/list',
method: 'get',
params
})
}
// 打印出库选单
// 修改后: 去掉开头的 /api
export function printSelectionList(items: any[]) {
return request({
url: '/v1/inbound/stock/print/selection',
method: 'post',
data: { items }
})
}
// 打印盘点报告
// 修改后: 去掉开头的 /api
export function printStocktakeReport(data: any) {
return request({
url: '/v1/inbound/stock/print/stocktake',
method: 'post',
data
})
}
// 保存 BOM 结构
export function saveBom(data: { parent_id: number; children: any[] }) {
return request({
url: '/v1/bom',
method: 'post',
data
})
}
// 获取基础物料列表
export function getMaterialBaseList(params?: any) {
return request({
url: '/v1/bom/base/list',
method: 'get',
params
})
}
// 获取 BOM 父件列表
export function getBomParents() {
return request({
url: '/v1/bom/parents',
method: 'get'
})
}
// 获取指定BOM详情
export function getBom(parentId: number) {
return request({
url: `/v1/bom/${parentId}`,
method: 'get'
})
}
// 盘点物资合并列表(服务端 JOIN draft + stock替代前端全量加载+find
export function getDraftMergedList(params: {
session_id: string
keyword?: string
status_filter?: string
page?: number
pageSize?: number
}) {
return request({
url: '/v1/inbound/stock/draft/merged-list',
method: 'get',
params
})
}
// 获取应盘物资清单(盘点基数)
export function getAllStocktakeItems(params?: { keyword?: string; session_id?: string }) {
return request({
url: '/v1/inbound/stock/stocktake/all-items',
method: 'get',
params
})
}
// 更新盘点实盘数(手动修改)
export function updateStocktakeQuantity(data: { stock_id: number; source_table: string; quantity: number }) {
return request({
url: '/v1/inbound/stock/stocktake/update-quantity',
method: 'post',
data
})
}