Files
KCGL/inventory-web/src/api/outbound.ts

63 lines
1.4 KiB
TypeScript
Raw Normal View History

import request from '@/utils/request'
export interface OutboundSubmitData {
sku: string
source_table: string
stock_id: number
barcode: string
outbound_type: string
quantity: number
consumer_name: string
signature_path: string // 上传后返回的图片路径
remark?: string
}
export interface ScanResult {
id: number
sku: string
name: string
spec_model: string
source_table: string // 'stock_buy' | 'stock_product' ...
stock_quantity: number
available_quantity: number
batch_number?: string
warehouse_location?: string
barcode?: string
}
/**
* 根据条码获取库存物品详情
* @param barcode 扫描到的条码
*/
export function getStockByBarcode(barcode: string) {
return request<any, ScanResult>({
// ★★★ [修改] 去掉开头的 /api,Axios 会自动拼接 baseURL
url: '/v1/outbound/scan',
method: 'get',
params: { barcode }
})
}
/**
* 提交出库单
*/
export function submitOutbound(data: OutboundSubmitData) {
return request({
// ★★★ [修改] 去掉开头的 /api
url: '/v1/outbound',
method: 'post',
data
})
}
/**
* 获取出库记录列表
*/
export function getOutboundList(params: any) {
return request({
// ★★★ [修改] 去掉开头的 /api
url: '/v1/outbound',
method: 'get',
params
})
}