diff --git a/mobile-h5/src/api/dashboardApi.ts b/mobile-h5/src/api/dashboardApi.ts index eef13c83a..8da6ce1a9 100644 --- a/mobile-h5/src/api/dashboardApi.ts +++ b/mobile-h5/src/api/dashboardApi.ts @@ -1,4 +1,4 @@ -import api from '@/utils/http' +import db from '@/utils/http/db' // ==================== 仪表盘 API ==================== @@ -15,30 +15,26 @@ export interface DashboardPartnerCargoStat { } export const dashboardApi = { - // 获取今日入库量按货物统计 getInboundByCargo: async (): Promise => { - return api.get({ + return db.get({ url: '/dashboard/inbound/by-cargo' }) }, - // 获取今日入库量按往来单位+货物统计 getInboundByPartnerCargo: async (): Promise => { - return api.get({ + return db.get({ url: '/dashboard/inbound/by-partner-cargo' }) }, - // 获取今日出库量按货物统计 getOutboundByCargo: async (): Promise => { - return api.get({ + return db.get({ url: '/dashboard/outbound/by-cargo' }) }, - // 获取今日出库量按往来单位+货物统计 getOutboundByPartnerCargo: async (): Promise => { - return api.get({ + return db.get({ url: '/dashboard/outbound/by-partner-cargo' }) } diff --git a/mobile-h5/src/api/inventoryApi.ts b/mobile-h5/src/api/inventoryApi.ts index 66e8bca9a..0c4fc438d 100644 --- a/mobile-h5/src/api/inventoryApi.ts +++ b/mobile-h5/src/api/inventoryApi.ts @@ -1,59 +1,63 @@ -import api from '@/utils/http' +import db from '@/utils/http/db' import type { Plan } from './plansApi' import type { WeighingRecord } from './weighingApi' // ==================== 出入库管理 API ==================== export interface InventoryRecord { - id: number + 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?: number + purchasePlanId?: string isDeleted: number createdAt: string - grossWeight?: number // 毛重(kg)- 汇总自关联地磅单 - tareWeight?: number // 皮重(kg)- 汇总自关联地磅单 - deduction?: number // 扣杂(kg)- 汇总自关联地磅单 - netWeight?: number // 净重(kg)- 汇总自关联地磅单 - grossWeightTime?: string // 毛重时间 - 来自关联地磅单 - tareWeightTime?: string // 皮重时间 - 来自关联地磅单 - hasWeighingSlip?: boolean // 是否已有关联的地磅单 + grossWeight?: number + tareWeight?: number + deduction?: number + netWeight?: number + grossWeightTime?: string + tareWeightTime?: string + hasWeighingSlip?: boolean } export interface InventoryCreate { date: string partnerCompany: string businessType: '入库' | '出库' - product: string + productId: string quantity: number planNo?: string batchNo?: string vehicleNo: string status?: string remarks?: string - purchasePlanId?: number + 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?: number + purchasePlanId?: string } export interface InventoryRelatedData { @@ -69,44 +73,43 @@ export const inventoryApi = { status?: string businessType?: '入库' | '出库' }): Promise => { - return api.get({ + return db.get({ url: '/inventory', params, - timeout: 60000 // 列表可能数据较多,60 秒超时避免被取消 + timeout: 60000 }) }, - get: async (id: number): Promise => { - return api.get({ + get: async (id: string): Promise => { + return db.get({ url: `/inventory/${id}` }) }, - getRelated: async (id: number): Promise => { - return api.get({ + getRelated: async (id: string): Promise => { + return db.get({ url: `/inventory/${id}/related` }) }, create: async (payload: InventoryCreate): Promise => { - return api.post({ + return db.post({ url: '/inventory', data: payload }) }, - update: async (id: number, payload: InventoryUpdate): Promise => { - return api.patch({ + update: async (id: string, payload: InventoryUpdate): Promise => { + return db.patch({ url: `/inventory/${id}`, data: payload }) }, - delete: async (id: number): Promise => { - return api.del({ + delete: async (id: string): Promise => { + return db.del({ url: `/inventory/${id}` }) }, - createLinkForPlan: async (purchasePlanId: number, remarks?: string): Promise => { - return api.post({ + createLinkForPlan: async (purchasePlanId: string, remarks?: string): Promise => { + return db.post({ url: '/inventory/create-link-for-plan', data: { purchasePlanId, remarks } }) } } - diff --git a/mobile-h5/src/api/plansApi.ts b/mobile-h5/src/api/plansApi.ts index e89822529..4d6e0b4fa 100644 --- a/mobile-h5/src/api/plansApi.ts +++ b/mobile-h5/src/api/plansApi.ts @@ -1,16 +1,17 @@ -import api from '@/utils/http' +import db from '@/utils/http/db' import type { InventoryRecord } from './inventoryApi' import type { WeighingRecord } from './weighingApi' // ==================== 计划管理 API ==================== export interface Plan { - id: number + id: string planNo?: string planDate: string startDate?: string endDate?: string businessType: '入库' | '出库' + productId?: string product: string specification?: string plannedQuantity: number @@ -19,12 +20,15 @@ export interface Plan { remarks?: string executionStatus?: string executedAt?: string - lastWeighingSlipId?: number + lastWeighingSlipId?: string executedQuantity?: number isDeleted: number createdAt: string /** 生成链接交三方填写时对应的出入库单 id */ - fillLinkInventoryId?: number + fillLinkInventoryId?: string + autoGenerateEnabled?: number + autoGenerateEndMonth?: string + autoGenerateLastMonth?: string } export interface PlanCreate { @@ -33,8 +37,7 @@ export interface PlanCreate { startDate?: string endDate?: string businessType: '入库' | '出库' - product: string - specification?: string + productId: string plannedQuantity: number vehicleNo?: string customerName?: string @@ -48,6 +51,7 @@ export interface PlanUpdate { startDate?: string endDate?: string businessType?: '入库' | '出库' + productId?: string product?: string specification?: string plannedQuantity?: number @@ -56,7 +60,7 @@ export interface PlanUpdate { remarks?: string executionStatus?: string executedAt?: string - lastWeighingSlipId?: number + lastWeighingSlipId?: string executedQuantity?: number } @@ -80,42 +84,41 @@ export const planApi = { createdFrom?: string createdTo?: string }): Promise => { - return api.get({ + return db.get({ url: '/plans', params }) }, - get: async (id: number): Promise => { - return api.get({ + get: async (id: string): Promise => { + return db.get({ url: `/plans/${id}` }) }, - getRelated: async (id: number): Promise => { - return api.get({ + getRelated: async (id: string): Promise => { + return db.get({ url: `/plans/${id}/related` }) }, - getThirdPartyPage: async (id: number): Promise => { - return api.get({ + getThirdPartyPage: async (id: string): Promise => { + return db.get({ url: `/plans/${id}/third-party-page` }) }, create: async (payload: PlanCreate): Promise => { - return api.post({ + return db.post({ url: '/plans', data: payload }) }, - update: async (id: number, payload: PlanUpdate): Promise => { - return api.patch({ + update: async (id: string, payload: PlanUpdate): Promise => { + return db.patch({ url: `/plans/${id}`, data: payload }) }, - delete: async (id: number): Promise => { - return api.del({ + delete: async (id: string): Promise => { + return db.del({ url: `/plans/${id}` }) } } - diff --git a/mobile-h5/src/api/weighingApi.ts b/mobile-h5/src/api/weighingApi.ts index b64ecdb08..3122eeb12 100644 --- a/mobile-h5/src/api/weighingApi.ts +++ b/mobile-h5/src/api/weighingApi.ts @@ -1,14 +1,16 @@ -import api from '@/utils/http' +import db from '@/utils/http/db' import type { Plan } from './plansApi' import type { InventoryRecord } from './inventoryApi' // ==================== 地磅单管理 API ==================== export interface WeighingRecord { - id: number + id: string vehicleNo: string planNo?: string + productId?: string cargoName: string + specification?: string businessType: '入库' | '出库' batchNo?: string supplier: string @@ -21,20 +23,20 @@ export interface WeighingRecord { netWeight: number plannedQuantity?: number executedQuantity?: number - purchasePlanId?: number - inboundOutboundId?: number + purchasePlanId?: string + inboundOutboundId?: string weighingPoint?: string remarks?: string currentQuantity?: number isVoided: number createdAt: string - inventoryDate?: string // 出入库单日期 + inventoryDate?: string } export interface WeighingCreate { vehicleNo: string planNo?: string - cargoName: string + productId: string businessType: '入库' | '出库' batchNo?: string supplier: string @@ -47,8 +49,8 @@ export interface WeighingCreate { netWeight: number plannedQuantity?: number executedQuantity?: number - purchasePlanId?: number - inboundOutboundId?: number + purchasePlanId?: string + inboundOutboundId?: string weighingPoint?: string remarks?: string currentQuantity?: number @@ -57,7 +59,9 @@ export interface WeighingCreate { export interface WeighingUpdate { vehicleNo?: string planNo?: string + productId?: string cargoName?: string + specification?: string businessType?: '入库' | '出库' batchNo?: string supplier?: string @@ -70,8 +74,8 @@ export interface WeighingUpdate { netWeight?: number plannedQuantity?: number executedQuantity?: number - purchasePlanId?: number - inboundOutboundId?: number + purchasePlanId?: string + inboundOutboundId?: string weighingPoint?: string remarks?: string currentQuantity?: number @@ -91,42 +95,41 @@ export const weighingApi = { cargoName?: string businessType?: '入库' | '出库' }): Promise => { - return api.get({ + return db.get({ url: '/weighing', params }) }, - get: async (id: number): Promise => { - return api.get({ + get: async (id: string): Promise => { + return db.get({ url: `/weighing/${id}` }) }, - getRelated: async (id: number): Promise => { - return api.get({ + getRelated: async (id: string): Promise => { + return db.get({ url: `/weighing/${id}/related` }) }, create: async (payload: WeighingCreate): Promise => { - return api.post({ + return db.post({ url: '/weighing', data: payload }) }, - update: async (id: number, payload: WeighingUpdate): Promise => { - return api.patch({ + update: async (id: string, payload: WeighingUpdate): Promise => { + return db.patch({ url: `/weighing/${id}`, data: payload }) }, - void: async (id: number): Promise => { - return api.post({ + void: async (id: string): Promise => { + return db.post({ url: `/weighing/${id}/void` }) }, - delete: async (id: number): Promise => { - return api.del({ + delete: async (id: string): Promise => { + return db.del({ url: `/weighing/${id}` }) } } -