inventory.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * 库存管理相关API
  3. */
  4. import { get, post } from '@/utils/request';
  5. export interface InventoryQueryParams {
  6. page?: number;
  7. pageSize?: number;
  8. deviceId?: string;
  9. shopId?: number;
  10. productId?: number;
  11. lowStock?: boolean;
  12. }
  13. export interface InventoryListResponse {
  14. list: any[];
  15. total: number;
  16. page: number;
  17. pageSize: number;
  18. }
  19. /**
  20. * 获取设备库存统计列表
  21. */
  22. export async function getDeviceInventoryStats(params: InventoryQueryParams = {}): Promise<InventoryListResponse> {
  23. return get('/inventory/device-stats', params);
  24. }
  25. /**
  26. * 获取库存列表
  27. */
  28. export async function getInventoryList(params: InventoryQueryParams = {}): Promise<InventoryListResponse> {
  29. return get('/inventory/list', params);
  30. }
  31. /**
  32. * 查询设备库存详情
  33. */
  34. export async function getDeviceInventory(deviceId: string): Promise<any> {
  35. return get(`/inventory/device/${deviceId}`);
  36. }
  37. /**
  38. * 获取低库存列表
  39. */
  40. export async function getLowStockList(): Promise<any> {
  41. return get('/inventory/low-stock');
  42. }
  43. /**
  44. * 获取库存统计数据
  45. */
  46. export async function getInventoryStatistics(): Promise<any> {
  47. return get('/inventory/statistics');
  48. }
  49. /**
  50. * 获取库存变动日志
  51. */
  52. export async function getInventoryLogs(params: any = {}): Promise<any> {
  53. return get('/inventory/logs', params);
  54. }
  55. /**
  56. * 获取上货记录列表
  57. */
  58. export async function getStockRecords(params: any = {}): Promise<any> {
  59. return get('/inventory/records', params);
  60. }
  61. /**
  62. * 增加库存(上货)
  63. */
  64. export async function increaseStock(data: {
  65. deviceId: string;
  66. productId: number;
  67. productCode: string;
  68. productName: string;
  69. quantity: number;
  70. shelfNum?: number;
  71. position?: string;
  72. activityId?: string;
  73. }): Promise<any> {
  74. return post('/inventory/increase', data);
  75. }
  76. /**
  77. * 补货员盘点修正库存(调用补货员专用接口,无需admin权限)
  78. */
  79. export async function adjustStock(data: {
  80. deviceId: string;
  81. productId: number;
  82. newStock: number;
  83. remark?: string;
  84. }): Promise<any> {
  85. return post('/replenisher/stock/adjust', data);
  86. }