| | |
| | | import type { PageParam, PageResult } from '@vben/request'; |
| | | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | export namespace ErpPurchaseStatisticsApi { |
| | |
| | | time: string; // 时间 |
| | | price: number; // 采购金额 |
| | | } |
| | | |
| | | /** 采购价格分析(按物料聚合已审核采购订单) */ |
| | | export interface PurchasePriceAnalysis { |
| | | productId?: number; |
| | | productBarCode?: string; |
| | | productName?: string; |
| | | /** 采购量(订单明细数量合计) */ |
| | | totalQuantity?: number; |
| | | /** 加权均价 = Σ(单价×数量) / Σ数量 */ |
| | | avgPrice?: number; |
| | | minPrice?: number; |
| | | maxPrice?: number; |
| | | latestPrice?: number; |
| | | previousPrice?: number; |
| | | /** 价格变动率(%) */ |
| | | priceChangeRate?: number; |
| | | } |
| | | } |
| | | |
| | | /** 获得采购统计 */ |
| | |
| | | ErpPurchaseStatisticsApi.PurchaseTimeSummaryRespVO[] |
| | | >('/erp/purchase-statistics/time-summary'); |
| | | } |
| | | |
| | | /** 采购价格分析(按物料聚合已审核采购订单,用于采购成本分析) */ |
| | | export function getPurchasePriceAnalysis( |
| | | params: PageParam & { orderTime?: string[]; productId?: number }, |
| | | ) { |
| | | return requestClient.get< |
| | | PageResult<ErpPurchaseStatisticsApi.PurchasePriceAnalysis> |
| | | >('/erp/purchase-statistics/price', { params }); |
| | | } |