41 lines
1.1 KiB
TypeScript
41 lines
1.1 KiB
TypeScript
|
|
import type { PageParam, PageResult } from '@/http/types'
|
|||
|
|
import { http } from '@/http/http'
|
|||
|
|
|
|||
|
|
/** 产品库存信息 */
|
|||
|
|
export interface Stock {
|
|||
|
|
id?: number
|
|||
|
|
productId?: number
|
|||
|
|
productName?: string
|
|||
|
|
unitName?: string
|
|||
|
|
categoryName?: string
|
|||
|
|
warehouseId?: number
|
|||
|
|
warehouseName?: string
|
|||
|
|
count?: number
|
|||
|
|
unitPrice?: number
|
|||
|
|
stockValue?: number
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** 获取产品库存分页列表 */
|
|||
|
|
export function getStockPage(params: PageParam) {
|
|||
|
|
return http.get<PageResult<Stock>>('/erp/stock/page', params)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** 获取产品库存详情 */
|
|||
|
|
export function getStock(id: number) {
|
|||
|
|
return http.get<Stock>(`/erp/stock/get?id=${id}`)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** 获取产品库存详情(通过产品ID和仓库ID) */
|
|||
|
|
export function getStock2(productId: number, warehouseId: number) {
|
|||
|
|
return http.get<Stock>('/erp/stock/get', { productId, warehouseId })
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** 获取产品库存数量 */
|
|||
|
|
export function getStockCount(productId: number, warehouseId?: number) {
|
|||
|
|
const params: Record<string, any> = { productId }
|
|||
|
|
if (warehouseId) {
|
|||
|
|
params.warehouseId = warehouseId
|
|||
|
|
}
|
|||
|
|
return http.get<number>('/erp/stock/get-count', params)
|
|||
|
|
}
|