129 lines
3.0 KiB
TypeScript
129 lines
3.0 KiB
TypeScript
import dbRequest from '@/utils/http/db'
|
|
import type { InventoryRecord } from '@/api/db/inventory'
|
|
import type { Plan } from '@/api/db/plans'
|
|
|
|
export interface WeighingRecord {
|
|
id: string
|
|
vehicleNo: string
|
|
planNo?: string
|
|
productId?: string
|
|
cargoName: string
|
|
specification?: string
|
|
businessType: '入库' | '出库'
|
|
batchNo?: string
|
|
supplier: string
|
|
consignee: string
|
|
grossWeight: number
|
|
grossWeightTime: string
|
|
tareWeight: number
|
|
tareWeightTime: string
|
|
deduction?: number
|
|
netWeight: number
|
|
plannedQuantity?: number
|
|
executedQuantity?: number
|
|
purchasePlanId?: string
|
|
inboundOutboundId?: string
|
|
weighingPoint?: string
|
|
remarks?: string
|
|
currentQuantity?: number
|
|
isVoided: number
|
|
createdAt: string
|
|
createBy?: string
|
|
createByName?: string
|
|
inventoryDate?: string
|
|
}
|
|
|
|
export interface WeighingCreate {
|
|
vehicleNo: string
|
|
planNo?: string
|
|
productId: string
|
|
businessType: '入库' | '出库'
|
|
batchNo?: string
|
|
supplier: string
|
|
consignee: string
|
|
grossWeight: number
|
|
grossWeightTime: string
|
|
tareWeight: number
|
|
tareWeightTime: string
|
|
deduction?: number
|
|
netWeight: number
|
|
plannedQuantity?: number
|
|
executedQuantity?: number
|
|
purchasePlanId?: string
|
|
inboundOutboundId?: string
|
|
weighingPoint?: string
|
|
remarks?: string
|
|
currentQuantity?: number
|
|
}
|
|
|
|
export interface WeighingUpdate {
|
|
vehicleNo?: string
|
|
planNo?: string
|
|
productId?: string
|
|
cargoName?: string
|
|
specification?: string
|
|
businessType?: '入库' | '出库'
|
|
batchNo?: string
|
|
supplier?: string
|
|
consignee?: string
|
|
grossWeight?: number
|
|
grossWeightTime?: string
|
|
tareWeight?: number
|
|
tareWeightTime?: string
|
|
deduction?: number
|
|
netWeight?: number
|
|
plannedQuantity?: number
|
|
executedQuantity?: number
|
|
purchasePlanId?: string
|
|
inboundOutboundId?: string
|
|
weighingPoint?: string
|
|
remarks?: string
|
|
currentQuantity?: number
|
|
isVoided?: number
|
|
}
|
|
|
|
export interface WeighingRelatedData {
|
|
plan: Plan | null
|
|
inventory: InventoryRecord | null
|
|
}
|
|
|
|
export interface WeighingListParams {
|
|
q?: string
|
|
dateFrom?: string
|
|
dateTo?: string
|
|
planNo?: string
|
|
batchNo?: string
|
|
vehicleNo?: string
|
|
cargoName?: string
|
|
supplier?: string
|
|
consignee?: string
|
|
businessType?: '入库' | '出库'
|
|
}
|
|
|
|
export const weighingApi = {
|
|
list(params?: WeighingListParams) {
|
|
return dbRequest.get<WeighingRecord[]>('/weighing', { params })
|
|
},
|
|
export(data: Record<string, any>) {
|
|
return dbRequest.post<Blob>('/weighing/export', data, { responseType: 'blob' })
|
|
},
|
|
get(id: string) {
|
|
return dbRequest.get<WeighingRecord>(`/weighing/${id}`)
|
|
},
|
|
getRelated(id: string) {
|
|
return dbRequest.get<WeighingRelatedData>(`/weighing/${id}/related`)
|
|
},
|
|
create(payload: WeighingCreate) {
|
|
return dbRequest.post<WeighingRecord>('/weighing', payload)
|
|
},
|
|
update(id: string, payload: WeighingUpdate) {
|
|
return dbRequest.patch<WeighingRecord>(`/weighing/${id}`, payload)
|
|
},
|
|
void(id: string) {
|
|
return dbRequest.post<void>(`/weighing/${id}/void`)
|
|
},
|
|
delete(id: string) {
|
|
return dbRequest.delete<void>(`/weighing/${id}`)
|
|
}
|
|
}
|