This commit is contained in:
zlwu committed 2026-06-10 22:59:34 +08:00
1 parent 725774ef0c
commit c3be9d1dce
176 files changed
+41925 -6342

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import dbRequest from '@/utils/http/db'
export interface DashboardCargoStat {
label: string
planned: number
actual: number
}
export interface DashboardPartnerCargoStat {
label: string
planned: number
actual: number
}
export const dashboardApi = {
getInboundByCargo() {
return dbRequest.get<DashboardCargoStat[]>('/dashboard/inbound/by-cargo')
},
getInboundByPartnerCargo() {
return dbRequest.get<DashboardPartnerCargoStat[]>('/dashboard/inbound/by-partner-cargo')
},
getOutboundByCargo() {
return dbRequest.get<DashboardCargoStat[]>('/dashboard/outbound/by-cargo')
},
getOutboundByPartnerCargo() {
return dbRequest.get<DashboardPartnerCargoStat[]>('/dashboard/outbound/by-partner-cargo')
}
}
+123
View File
@@ -0,0 +1,123 @@
import dbRequest from '@/utils/http/db'
import type { Plan } from '@/api/db/plans'
export interface InventoryRecord {
id: string
date: string
partnerCompany: string
businessType: '入库' | '出库'
productId?: string
product: string
specification?: string
quantity: number
planNo?: string
batchNo?: string
vehicleNo: string
status?: string
remarks?: string
purchasePlanId?: string
isDeleted: number
createdAt: string
grossWeight?: number
tareWeight?: number
deduction?: number
netWeight?: number
grossWeightTime?: string
tareWeightTime?: string
hasWeighingSlip?: boolean
}
export interface InventoryCreate {
date: string
partnerCompany: string
businessType: '入库' | '出库'
productId: string
quantity: number
planNo?: string
batchNo?: string
vehicleNo: string
status?: string
remarks?: string
purchasePlanId?: string
}
export interface InventoryUpdate {
date?: string
partnerCompany?: string
businessType?: '入库' | '出库'
productId?: string
product?: string
specification?: string
quantity?: number
planNo?: string
batchNo?: string
vehicleNo?: string
status?: string
remarks?: string | null
purchasePlanId?: string
}
export interface InventoryWeighingRecord {
id: string
vehicleNo: string
planNo?: string
productId?: string
cargoName: string
specification?: string
businessType: string
batchNo?: string
supplier: string
consignee: string
grossWeight: number
grossWeightTime: string
tareWeight: number
tareWeightTime: string
deduction?: number
netWeight: number
remarks?: string
}
export interface InventoryRelatedData {
plan: Plan | null
weighing: InventoryWeighingRecord | null
}
export interface InventoryListParams {
q?: string
planNo?: string
batchNo?: string
partnerCompany?: string
product?: string
vehicleNo?: string
dateFrom?: string
dateTo?: string
status?: string
businessType?: '入库' | '出库'
}
export const inventoryApi = {
list(params?: InventoryListParams) {
return dbRequest.get<InventoryRecord[]>('/inventory', { params, timeout: 60000 })
},
get(id: string) {
return dbRequest.get<InventoryRecord>(`/inventory/${id}`)
},
getRelated(id: string) {
return dbRequest.get<InventoryRelatedData>(`/inventory/${id}/related`)
},
create(payload: InventoryCreate) {
return dbRequest.post<InventoryRecord>('/inventory', payload)
},
update(id: string, payload: InventoryUpdate) {
return dbRequest.patch<InventoryRecord>(`/inventory/${id}`, payload)
},
delete(id: string) {
return dbRequest.delete<void>(`/inventory/${id}`)
},
createLinkForPlan(purchasePlanId: string, remarks?: string) {
return dbRequest.post<InventoryRecord>('/inventory/create-link-for-plan', {
purchasePlanId,
remarks
})
}
}
+150
View File
@@ -0,0 +1,150 @@
import dbRequest from '@/utils/http/db'
export interface Plan {
id: string
planNo?: string
planDate: string
startDate?: string
endDate?: string
businessType: '入库' | '出库'
productId?: string
product: string
specification?: string
plannedQuantity: number
vehicleNo?: string
customerName?: string
remarks?: string
executionStatus?: string
executedAt?: string
lastWeighingSlipId?: string
executedQuantity?: number
isDeleted: number
createdAt: string
fillLinkInventoryId?: string
autoGenerateEnabled: number
autoGenerateEndMonth?: string
autoGenerateLastMonth?: string
}
export interface PlanCreate {
planNo?: string
planDate: string
startDate?: string
endDate?: string
businessType: '入库' | '出库'
productId: string
plannedQuantity: number
vehicleNo?: string
customerName?: string
remarks?: string
executionStatus?: string
autoGenerateEnabled?: number
autoGenerateEndMonth?: string
}
export interface PlanUpdate {
planNo?: string
planDate?: string
startDate?: string
endDate?: string
businessType?: '入库' | '出库'
productId?: string
product?: string
specification?: string
plannedQuantity?: number
vehicleNo?: string
customerName?: string
remarks?: string
executionStatus?: string
executedAt?: string
lastWeighingSlipId?: string
executedQuantity?: number
autoGenerateEnabled?: number
autoGenerateEndMonth?: string
autoGenerateLastMonth?: string
}
export interface PlanInventoryRecord {
id: string
date: string
partnerCompany: string
businessType: string
productId?: string
product: string
specification?: string
quantity: number
planNo?: string
batchNo?: string
vehicleNo: string
status?: string
remarks?: string
purchasePlanId?: string
createdAt: string
}
export interface PlanWeighingRecord {
id: string
vehicleNo: string
planNo?: string
productId?: string
cargoName: string
specification?: string
businessType: string
batchNo?: string
grossWeight: number
tareWeight: number
netWeight: number
grossWeightTime: string
tareWeightTime: string
createdAt: string
}
export interface PlanRelatedData {
inventories: PlanInventoryRecord[]
weighings: PlanWeighingRecord[]
}
export interface PlanListParams {
q?: string
planNo?: string
customerName?: string
product?: string
businessType?: '入库' | '出库'
executionStatus?: string
createdFrom?: string
createdTo?: string
startDateFrom?: string
startDateTo?: string
}
export interface AutoGenerateMonthlyResult {
createdCount: number
skippedReason?: string | null
currentMonth: string
}
export const planApi = {
list(params?: PlanListParams) {
return dbRequest.get<Plan[]>('/plans', { params })
},
get(id: string) {
return dbRequest.get<Plan>(`/plans/${id}`)
},
getRelated(id: string) {
return dbRequest.get<PlanRelatedData>(`/plans/${id}/related`)
},
create(payload: PlanCreate) {
return dbRequest.post<Plan>('/plans', payload)
},
update(id: string, payload: PlanUpdate) {
return dbRequest.patch<Plan>(`/plans/${id}`, payload)
},
delete(id: string) {
return dbRequest.delete<void>(`/plans/${id}`)
},
runAutoGenerate(force = false) {
return dbRequest.post<AutoGenerateMonthlyResult>('/plans/run-auto-generate', undefined, {
params: { force }
})
}
}
+36
View File
@@ -0,0 +1,36 @@
import type { AxiosRequestConfig } from 'axios'
import dbRequest from '@/utils/http/db'
export interface Vehicle {
id: string
vehicleNo: string
remarks?: string | null
}
export interface VehicleCreate {
vehicleNo: string
remarks?: string | null
}
export interface VehicleUpdate {
vehicleNo?: string
remarks?: string | null
}
export const vehicleApi = {
list(q?: string) {
return dbRequest.get<Vehicle[]>('/master-data/vehicles', { params: q ? { q } : undefined })
},
get(id: string) {
return dbRequest.get<Vehicle>(`/master-data/vehicles/${id}`)
},
create(payload: VehicleCreate, config?: AxiosRequestConfig) {
return dbRequest.post<Vehicle>('/master-data/vehicles', payload, config)
},
update(id: string, payload: VehicleUpdate) {
return dbRequest.patch<Vehicle>(`/master-data/vehicles/${id}`, payload)
},
delete(id: string) {
return dbRequest.delete<void>(`/master-data/vehicles/${id}`)
}
}
+123
View File
@@ -0,0 +1,123 @@
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
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 })
},
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}`)
}
}