Files
zkxw/web-admin/src/api/material-stock-check.ts
T
2026-06-14 17:20:52 +08:00

162 lines
3.4 KiB
TypeScript

import request from '@/utils/http'
type PageList<T> = {
list: T[]
total: number
page: number
pageSize: number
totalPages: number
}
export type MaterialStockCheck = {
id: string
title: string
checkTime: string
status: string
statusLabel: string
completeTime?: string
remark?: string
batchLineCount: number
unusedLineCount: number
createBy: string
createByName?: string
createTime: string
updateTime: string
}
export type MaterialStockCheckBatchLine = {
id: string
materialCode: string
materialName: string
specModel: string
unit: string
stockInNo: string
stockInDate: string
expireDate: string
catalogNo: string
batchNo: string
manufacturer: string
unitPrice: number
amount: number
remainingQty: number
remainingAmount?: number
remark?: string
}
export type MaterialStockCheckUnusedLine = {
id?: string
usageId?: string
batchId?: string
materialCode?: string
materialName: string
specModel?: string
unit?: string
stockInNo?: string
stockInDate?: string
expireDate?: string
catalogNo?: string
batchNo?: string
manufacturer?: string
unitPrice?: number | null
remainingAmount?: number | null
holder?: string
unusedQty: number
remark?: string
batchPickId?: string
fromBatch?: boolean
}
export type MaterialStockCheckRequisition = {
id: string
materialId: string
materialCode: string
materialName: string
specModel: string
batchId: string
stockInNo: string
stockInDate: string
expireDate: string
catalogNo: string
batchNo: string
manufacturer: string
unitPrice: number
unit: string
requisitionQty: number
taskConsumedQty: number
receiver: string
receiverName: string
purpose: string
useTime: string
requisitionStatus: string
createByName: string
}
export type MaterialStockCheckDetail = MaterialStockCheck & {
batchLines: MaterialStockCheckBatchLine[]
unusedLines: MaterialStockCheckUnusedLine[]
}
export function fetchMaterialStockCheckList(params?: {
page?: number
pageSize?: number
keyword?: string
status?: string
startTime?: string
endTime?: string
}) {
return request.get<PageList<MaterialStockCheck>>({
url: '/web/admin/material-stock-checks',
params
})
}
export function fetchCreateMaterialStockCheck(data: {
title: string
checkTime?: string
remark?: string
}) {
return request.post<{ id: string; batchLineCount: number }>({
url: '/web/admin/material-stock-checks',
data
})
}
export function fetchMaterialStockCheckDetail(id: string) {
return request.get<MaterialStockCheckDetail>({
url: `/web/admin/material-stock-checks/${id}`
})
}
export function fetchSaveMaterialStockCheckUnusedLines(
id: string,
items: MaterialStockCheckUnusedLine[]
) {
return request.put<{ count: number }>({
url: `/web/admin/material-stock-checks/${id}/unused-lines`,
data: { items }
})
}
export function fetchCompleteMaterialStockCheck(id: string) {
return request.post<void>({
url: `/web/admin/material-stock-checks/${id}/complete`
})
}
export function fetchCancelMaterialStockCheck(id: string) {
return request.post<void>({
url: `/web/admin/material-stock-checks/${id}/cancel`
})
}
export function fetchMaterialStockCheckRequisitions(params?: {
page?: number
pageSize?: number
keyword?: string
}) {
return request.get<PageList<MaterialStockCheckRequisition>>({
url: '/web/admin/material-stock-check-requisitions',
params
})
}