/** * 库存管理相关API */ import { get, post } from '@/utils/request'; export interface InventoryQueryParams { page?: number; pageSize?: number; deviceId?: string; shopId?: number; productId?: number; lowStock?: boolean; } export interface InventoryListResponse { list: any[]; total: number; page: number; pageSize: number; } /** * 获取设备库存统计列表 */ export async function getDeviceInventoryStats(params: InventoryQueryParams = {}): Promise { return get('/inventory/device-stats', params); } /** * 获取库存列表 */ export async function getInventoryList(params: InventoryQueryParams = {}): Promise { return get('/inventory/list', params); } /** * 查询设备库存详情 */ export async function getDeviceInventory(deviceId: string): Promise { return get(`/inventory/device/${deviceId}`); } /** * 获取低库存列表 */ export async function getLowStockList(): Promise { return get('/inventory/low-stock'); } /** * 获取库存统计数据 */ export async function getInventoryStatistics(): Promise { return get('/inventory/statistics'); } /** * 获取库存变动日志 */ export async function getInventoryLogs(params: any = {}): Promise { return get('/inventory/logs', params); } /** * 获取上货记录列表 */ export async function getStockRecords(params: any = {}): Promise { return get('/inventory/records', params); } /** * 增加库存(上货) */ export async function increaseStock(data: { deviceId: string; productId: number; productCode: string; productName: string; quantity: number; shelfNum?: number; position?: string; activityId?: string; }): Promise { return post('/inventory/increase', data); } /** * 补货员盘点修正库存(调用补货员专用接口,无需admin权限) */ export async function adjustStock(data: { deviceId: string; productId: number; newStock: number; remark?: string; }): Promise { return post('/replenisher/stock/adjust', data); }