import type { PageParam, PageResult } from '@vben/request';
|
|
import { requestClient } from '#/api/request';
|
|
export namespace SrmInquiryApi {
|
/** 询价产品行 */
|
export interface Item {
|
id?: number;
|
inquiryId?: number;
|
productId?: number;
|
productUnitId?: number;
|
productCode?: string;
|
productName?: string;
|
productSpec?: string;
|
unitName?: string;
|
quantity?: number;
|
estimatedPrice?: number;
|
selectedSupplierId?: number;
|
selectedQuoteId?: number;
|
selectedPrice?: number;
|
/** 新增/编辑询价单时随产品行一并提交的供应商报价 */
|
quotes?: ItemQuote[];
|
remark?: string;
|
sort?: number;
|
}
|
|
/** 产品行内的供应商报价 */
|
export interface ItemQuote {
|
supplierId: number;
|
price?: number;
|
taxRate?: number;
|
deliveryCycle?: number;
|
paymentTerms?: string;
|
remark?: string;
|
}
|
|
/** 参与供应商 */
|
export interface Supplier {
|
id?: number;
|
supplierId: number;
|
supplierName?: string;
|
supplierCode?: string;
|
quoteStatus?: number;
|
quoteTime?: string;
|
remark?: string;
|
}
|
|
/** 产品报价 */
|
export interface Quote {
|
id?: number;
|
inquiryId?: number;
|
inquiryItemId?: number;
|
supplierId?: number;
|
price?: number;
|
taxRate?: number;
|
deliveryCycle?: number;
|
paymentTerms?: string;
|
remark?: string;
|
isSelected?: boolean;
|
}
|
|
/** 询价转订单记录 */
|
export interface Order {
|
id?: number;
|
supplierId?: number;
|
supplierName?: string;
|
purchaseOrderId?: number;
|
purchaseOrderNo?: string;
|
}
|
|
/** 询价单 */
|
export interface Inquiry {
|
id?: number;
|
no?: string;
|
title: string;
|
status?: number;
|
inquiryDate?: string;
|
deadline?: string;
|
purchaserUserId?: number;
|
remark?: string;
|
createTime?: string;
|
items?: Item[];
|
suppliers?: Supplier[];
|
quotes?: Quote[];
|
orders?: Order[];
|
}
|
|
/** 保存报价 */
|
export interface QuoteSaveItem {
|
inquiryItemId: number;
|
supplierId: number;
|
price?: number;
|
taxRate?: number;
|
deliveryCycle?: number;
|
paymentTerms?: string;
|
remark?: string;
|
}
|
|
/** 中标选择 */
|
export interface Selection {
|
inquiryItemId: number;
|
quoteId: number;
|
}
|
|
/** 确认转订单结果 */
|
export interface ConfirmResult {
|
inquiryId: number;
|
orders: {
|
purchaseOrderId: number;
|
purchaseOrderNo: string;
|
supplierId: number;
|
supplierName: string;
|
}[];
|
}
|
}
|
|
/** 分页查询询价单 */
|
export function getInquiryPage(params: PageParam) {
|
return requestClient.get<PageResult<SrmInquiryApi.Inquiry>>(
|
'/srm/inquiry/page',
|
{ params },
|
);
|
}
|
|
/** 查询询价单详情 */
|
export function getInquiry(id: number) {
|
return requestClient.get<SrmInquiryApi.Inquiry>(
|
`/srm/inquiry/get?id=${id}`,
|
);
|
}
|
|
/** 查询询价比价视图 */
|
export function getInquiryCompare(id: number) {
|
return requestClient.get<SrmInquiryApi.Inquiry>(
|
`/srm/inquiry/compare?id=${id}`,
|
);
|
}
|
|
/** 查询询价单精简列表 */
|
export function getInquirySimpleList() {
|
return requestClient.get<SrmInquiryApi.Inquiry[]>(
|
'/srm/inquiry/simple-list',
|
);
|
}
|
|
/** 创建询价单 */
|
export function createInquiry(data: SrmInquiryApi.Inquiry) {
|
return requestClient.post<number>('/srm/inquiry/create', data);
|
}
|
|
/** 更新询价单 */
|
export function updateInquiry(data: SrmInquiryApi.Inquiry) {
|
return requestClient.put('/srm/inquiry/update', data);
|
}
|
|
/** 删除询价单 */
|
export function deleteInquiry(id: number) {
|
return requestClient.delete('/srm/inquiry/delete', { params: { id } });
|
}
|
|
/** 发布询价单 */
|
export function publishInquiry(id: number) {
|
return requestClient.put('/srm/inquiry/publish', null, { params: { id } });
|
}
|
|
/** 取消询价单 */
|
export function cancelInquiry(id: number) {
|
return requestClient.put('/srm/inquiry/cancel', null, { params: { id } });
|
}
|
|
/** 批量保存报价 */
|
export function saveQuotes(
|
inquiryId: number,
|
quotes: SrmInquiryApi.QuoteSaveItem[],
|
) {
|
return requestClient.post('/srm/inquiry/save-quotes', {
|
inquiryId,
|
quotes,
|
});
|
}
|
|
/** 确认中标并生成采购订单草稿 */
|
export function confirmInquiry(
|
id: number,
|
selections: SrmInquiryApi.Selection[],
|
) {
|
return requestClient.post<SrmInquiryApi.ConfirmResult>(
|
'/srm/inquiry/confirm',
|
{ id, selections },
|
);
|
}
|