front/src/api/operation/index.ts
2026-06-04 19:15:28 +08:00

66 lines
2.1 KiB
TypeScript

import { axiosInstance } from '@/api/rbac'
import { assertBusinessOk, omsUrl, parseListPayload, unwrapData } from '@/api/oms/common'
export async function inboundCreate(body: {
waybillNo: string
weight?: number
length?: number
width?: number
height?: number
salesProductId?: number
destinationCountry?: string
warehouseId?: number
}) {
const res = await axiosInstance.post(omsUrl('/operation/inbound/create'), body)
assertBusinessOk(res.data)
return unwrapData(res.data)
}
export async function inboundRecentList(params?: { limit?: number; warehouseId?: number }) {
const res = await axiosInstance.get(omsUrl('/operation/inbound/recent-list'), { params })
return parseListPayload(res.data)
}
export async function outboundCreate(body: {
waybillNo: string
weight?: number
length?: number
width?: number
height?: number
salesProductId?: number
destinationCountry?: string
serviceChannelId?: number
warehouseId?: number
}) {
const res = await axiosInstance.post(omsUrl('/operation/outbound/create'), body)
assertBusinessOk(res.data)
return unwrapData(res.data)
}
export async function outboundRecentList(params?: { limit?: number; warehouseId?: number }) {
const res = await axiosInstance.get(omsUrl('/operation/outbound/recent-list'), { params })
return parseListPayload(res.data)
}
export async function printLabelPrint(body: {
number: string
numberType: string
labelTemplateId?: number
templateType?: string
}) {
const res = await axiosInstance.post(omsUrl('/operation/print-label/print'), body)
assertBusinessOk(res.data)
return unwrapData(res.data)
}
export async function printLabelRecentList(params?: { limit?: number; labelTemplateId?: number }) {
const res = await axiosInstance.get(omsUrl('/operation/print-label/recent-list'), { params })
return parseListPayload(res.data)
}
export async function printLabelTemplateList(params?: { templateType?: string }) {
const res = await axiosInstance.get(omsUrl('/operation/print-label/template-list'), { params })
const { items } = parseListPayload(res.data)
return items
}