import request from '@/utils/http'
|
|
export function buildWarehouseStockPageParams(params = {}) {
|
const matnrCode = typeof params.matnrCode === 'string' ? params.matnrCode.trim() : params.matnrCode
|
const maktx = typeof params.maktx === 'string' ? params.maktx.trim() : params.maktx
|
const batch = typeof params.batch === 'string' ? params.batch.trim() : params.batch
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...(params.aggType !== undefined ? { aggType: params.aggType } : {}),
|
...(matnrCode ? { matnrCode } : {}),
|
...(maktx ? { maktx } : {}),
|
...(batch ? { batch } : {}),
|
...Object.fromEntries(
|
Object.entries(params).filter(
|
([key, value]) =>
|
!['current', 'pageSize', 'size', 'aggType', 'matnrCode', 'maktx', 'batch'].includes(key) &&
|
value !== undefined &&
|
value !== ''
|
)
|
)
|
}
|
}
|
|
export function buildWarehouseStockInfoParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...(params.aggType !== undefined ? { aggType: params.aggType } : {}),
|
...(params.stock !== undefined ? { stock: params.stock } : {})
|
}
|
}
|
|
export function buildWarehouseStockHistoriesParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...(params.aggType !== undefined ? { aggType: params.aggType } : {}),
|
...(params.stock !== undefined ? { stock: params.stock } : {})
|
}
|
}
|
|
export function fetchWarehouseStockPage(params = {}) {
|
return request.post({ url: '/warehouse/stock/page', params: buildWarehouseStockPageParams(params) })
|
}
|
|
export function fetchWarehouseStockInfoPage(params = {}) {
|
return request.post({ url: '/warehouse/stock/info', params: buildWarehouseStockInfoParams(params) })
|
}
|
|
export function fetchWarehouseStockHistoriesPage(params = {}) {
|
return request.post({
|
url: '/warehouse/stock/histories/page',
|
params: buildWarehouseStockHistoriesParams(params)
|
})
|
}
|
|
export function fetchEnabledFields() {
|
return request.get({ url: '/fields/enable/list' })
|
}
|