引入WMS仓储主数据与关系管理全流程能力
后端实现基于EF Core的库区/库位/容器/物料/关系/历史等模型、服务与RESTful接口,支持多数据库Provider。前端新增类型、API与聚合页面,支持主数据及容器位置/物料关系的增删改查、绑定/解绑、装料/卸料、历史追溯。完善权限、菜单与文档,平台具备完整WMS能力。
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
import http from './http'
|
||||
import type {
|
||||
WarehouseArea, Storage, Container, Material,
|
||||
ContainerLocation, ContainerMaterial, ContainerLocationHistory, ContainerMaterialHistory,
|
||||
MasterDataPayload, StoragePayload, MaterialPayload, ContainerLocationPayload, ContainerMaterialPayload
|
||||
} from '@/types/wms'
|
||||
|
||||
function q(params?: Record<string, unknown>) {
|
||||
return { params }
|
||||
}
|
||||
|
||||
export async function listAreas(keyword?: string) {
|
||||
const { data } = await http.get<WarehouseArea[]>('/wms/areas', q({ q: keyword }))
|
||||
return data
|
||||
}
|
||||
export async function saveArea(payload: MasterDataPayload) {
|
||||
const { data } = payload.id
|
||||
? await http.put<WarehouseArea>(`/wms/areas/${payload.id}`, payload)
|
||||
: await http.post<WarehouseArea>('/wms/areas', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteArea(id: string, version?: number) {
|
||||
await http.delete(`/wms/areas/${id}`, q({ version }))
|
||||
}
|
||||
|
||||
export async function listStorages(keyword?: string) {
|
||||
const { data } = await http.get<Storage[]>('/wms/storages', q({ q: keyword }))
|
||||
return data
|
||||
}
|
||||
export async function saveStorage(payload: StoragePayload) {
|
||||
const { data } = payload.id
|
||||
? await http.put<Storage>(`/wms/storages/${payload.id}`, payload)
|
||||
: await http.post<Storage>('/wms/storages', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteStorage(id: string, version?: number) {
|
||||
await http.delete(`/wms/storages/${id}`, q({ version }))
|
||||
}
|
||||
|
||||
export async function listContainers(keyword?: string) {
|
||||
const { data } = await http.get<Container[]>('/wms/containers', q({ q: keyword }))
|
||||
return data
|
||||
}
|
||||
export async function saveContainer(payload: MasterDataPayload) {
|
||||
const { data } = payload.id
|
||||
? await http.put<Container>(`/wms/containers/${payload.id}`, payload)
|
||||
: await http.post<Container>('/wms/containers', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteContainer(id: string, version?: number) {
|
||||
await http.delete(`/wms/containers/${id}`, q({ version }))
|
||||
}
|
||||
|
||||
export async function listMaterials(keyword?: string) {
|
||||
const { data } = await http.get<Material[]>('/wms/materials', q({ q: keyword }))
|
||||
return data
|
||||
}
|
||||
export async function saveMaterial(payload: MaterialPayload) {
|
||||
const { data } = payload.id
|
||||
? await http.put<Material>(`/wms/materials/${payload.id}`, payload)
|
||||
: await http.post<Material>('/wms/materials', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteMaterial(id: string, version?: number) {
|
||||
await http.delete(`/wms/materials/${id}`, q({ version }))
|
||||
}
|
||||
|
||||
export async function listContainerLocations(params?: { locationType?: string; q?: string }) {
|
||||
const { data } = await http.get<ContainerLocation[]>('/wms/container-locations', q(params))
|
||||
return data
|
||||
}
|
||||
export async function saveContainerLocation(payload: ContainerLocationPayload) {
|
||||
const { data } = await http.post<ContainerLocation>('/wms/container-locations', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteContainerLocation(containerId: string, reason?: string) {
|
||||
await http.delete(`/wms/container-locations/${containerId}`, q({ reason }))
|
||||
}
|
||||
|
||||
export async function listContainerMaterials(keyword?: string) {
|
||||
const { data } = await http.get<ContainerMaterial[]>('/wms/container-materials', q({ q: keyword }))
|
||||
return data
|
||||
}
|
||||
export async function saveContainerMaterial(payload: ContainerMaterialPayload) {
|
||||
const { data } = payload.id
|
||||
? await http.put<ContainerMaterial>(`/wms/container-materials/${payload.id}`, payload)
|
||||
: await http.post<ContainerMaterial>('/wms/container-materials', payload)
|
||||
return data
|
||||
}
|
||||
export async function deleteContainerMaterial(id: string, reason?: string) {
|
||||
await http.delete(`/wms/container-materials/${id}`, q({ reason }))
|
||||
}
|
||||
|
||||
export async function listContainerLocationHistory(containerId?: string) {
|
||||
const { data } = await http.get<ContainerLocationHistory[]>('/wms/container-location-history', q({ containerId }))
|
||||
return data
|
||||
}
|
||||
export async function listContainerMaterialHistory(containerId?: string, materialId?: string) {
|
||||
const { data } = await http.get<ContainerMaterialHistory[]>('/wms/container-material-history', q({ containerId, materialId }))
|
||||
return data
|
||||
}
|
||||
Reference in New Issue
Block a user