WEB/src/api/storage.inventory/inventory.ts
2026-05-04 00:34:56 +08:00

148 lines
3.6 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'
const v = "1.0"
export function getInventoryList(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.inventory.list',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
export function quickPutaway(data: { receiving_id: number; id?: number }): Promise<any> {
const body: Record<string, any> = { ...data }
if (body.receiving_id === undefined && body.id != null) {
body.receiving_id = Number(body.id)
}
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.inventory.quickPutaway',
v,
timestamp: new Date().getTime()
},
data: body,
isSystemApi: true
} as any)
}
/** 收货单与入库单匹配入库:按商品维度匹配,需传收货单与入库单 ID 列表 */
export function matchPutaway(data: {
receiving_ids: number[]
entry_order_ids: number[]
}): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.inventory.matchPutaway',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
// 非本项目接口,不使用
export function transferByProduct(data: {
space_id: number
stock_id: number
target_space_id: number
quantity: number
}): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.inventory.transferByProduct',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
// 非本项目接口,不使用
export function transferLocation(data:any) {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.inventory.transferLocation',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
/**
* 出入库记录列表查询
* 支持where条件、分页、排序、批次分组切换。
* 默认按库位合并数量(合并模式),group_by_batch=true时返回每条明细(明细模式)
*/
export function getTransactionList(data: {
/** 统一where条件对象,可用字段:transaction_type(INBOUND/OUTBOUND)、stock_id、space_id、store_id、order_type(SCRK/MATCH)、order_no、inventory_type(ZP/CC/JS/XS/ZT/DJ/FP)、operator_name、created_at(支持between) */
where?: Record<string, any>
/** 分页参数,默认page=1, pageSize=20 */
pagination?: {
page?: number
pageSize?: number
}
/** 排序参数,默认sortField='created_at', sortOrder='DESC' */
sort?: {
sortField?: string
sortOrder?: string
}
/** 是否按批次查询,默认false。false=合并模式(按库位+商品聚合),true=明细模式(逐条返回) */
group_by_batch?: boolean
}): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.transaction.list',
v,
timestamp: new Date().getTime()
},
data,
isSystemApi: true
} as any)
}
export function getExpiryList(data: any): Promise<any> {
return request({
url: '/system',
method: 'post',
params: {
method: 'storage.expiry.list',
v,
timestamp: new Date().getTime()
},
data
})
}
// export function transaction(data:any) {
// return request({
// url: '/system',
// method: 'post',
// params: {
// method: 'storage.inventory.transaction',
// v,
// timestamp: new Date().getTime()
// },
// data,
// isSystemApi: true
// } as any)
// }