6b029e20f9
- DDL: quotation_request_master(14 cols) + quotation_request_detail(15 cols) 운영 → RPS 타입 차이: numeric objid → varchar(64), detail.part_objid bigint(part_mng FK) - 데이터: 운영 sample master 4건 / detail 4건 (sales_request_part 미존재 → NULL fallback) - 백엔드 listQuotationRequest — wace salesMng.xml:5248-5349 매퍼 1:1 (vendor → client_mng JOIN, attach_file_info QUOTATION_RECEIVED 카운트) - listVendorOptions(client_mng) 신규 — 발주서 vendor 옵션이 supply_mng 와 분리됨 - listPurchaseRequest.has_quotation_request 분기 활성화 - quote-request page.tsx UI 문자열 내부 참조 제거, vendor 옵션 client_mng 로 교체
98 lines
3.2 KiB
TypeScript
98 lines
3.2 KiB
TypeScript
// ============================================================
|
|
// 구매관리 — 7개 메뉴 그리드 API.
|
|
// 백엔드: /api/purchase/{menu-path}, /api/purchase/options/{suppliers|users|projects}
|
|
// ============================================================
|
|
|
|
import { apiClient } from "./client";
|
|
|
|
export interface PurchaseListFilter {
|
|
year?: string;
|
|
customer_objid?: string;
|
|
customer_cd?: string;
|
|
project_no?: string;
|
|
part_no?: string;
|
|
part_name?: string;
|
|
part_spec?: string;
|
|
partner_objid?: string;
|
|
purchase_order_no?: string;
|
|
proposal_no?: string;
|
|
search_status?: string;
|
|
writer?: string;
|
|
request_user?: string;
|
|
purchase_type?: string;
|
|
part_type?: string;
|
|
product_cd?: string;
|
|
paid_type?: string;
|
|
mail_send_yn?: string;
|
|
delivery_status?: string;
|
|
close_status?: string;
|
|
sales_mng_user_id?: string;
|
|
regdate_start?: string;
|
|
regdate_end?: string;
|
|
receipt_date_start?: string;
|
|
receipt_date_end?: string;
|
|
delivery_start_date?: string;
|
|
delivery_end_date?: string;
|
|
reg_start_date?: string;
|
|
reg_end_date?: string;
|
|
page?: number;
|
|
page_size?: number;
|
|
}
|
|
|
|
export interface PurchaseListResponse<T = any> {
|
|
rows: T[];
|
|
totalCount: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
export interface OptionItem {
|
|
code: string;
|
|
label: string;
|
|
}
|
|
|
|
async function getList<T = any>(path: string, filter: PurchaseListFilter): Promise<PurchaseListResponse<T>> {
|
|
const res = await apiClient.get(`/purchase/${path}`, { params: filter });
|
|
return res.data?.data as PurchaseListResponse<T>;
|
|
}
|
|
|
|
export const purchaseApi = {
|
|
// 그리드 7종
|
|
listPurchaseRequest: (f: PurchaseListFilter = {}) => getList("purchase-request", f),
|
|
listQuotationRequest: (f: PurchaseListFilter = {}) => getList("quotation-request", f),
|
|
listProposal: (f: PurchaseListFilter = {}) => getList("proposal", f),
|
|
listInbound: (f: PurchaseListFilter = {}) => getList("inbound", f),
|
|
listInboundByItem: (f: PurchaseListFilter = {}) => getList("inbound-by-item", f),
|
|
listInboundByDate: (f: PurchaseListFilter = {}) => getList("inbound-by-date", f),
|
|
listProjectStatus: (f: PurchaseListFilter = {}) => getList("project-status", f),
|
|
|
|
// 공통 옵션
|
|
async listSuppliers(): Promise<OptionItem[]> {
|
|
const r = await apiClient.get("/purchase/options/suppliers");
|
|
return (r.data?.data ?? []) as OptionItem[];
|
|
},
|
|
// 견적요청서 / 발주서 vendor (wace client_mng 매칭)
|
|
async listVendors(): Promise<OptionItem[]> {
|
|
const r = await apiClient.get("/purchase/options/vendors");
|
|
return (r.data?.data ?? []) as OptionItem[];
|
|
},
|
|
async listUsers(): Promise<OptionItem[]> {
|
|
const r = await apiClient.get("/purchase/options/users");
|
|
return (r.data?.data ?? []) as OptionItem[];
|
|
},
|
|
async listProjects(): Promise<OptionItem[]> {
|
|
const r = await apiClient.get("/purchase/options/projects");
|
|
return (r.data?.data ?? []) as OptionItem[];
|
|
},
|
|
};
|
|
|
|
/** 년도 옵션 — wace 운영판 동일 (현재년도 ±4) */
|
|
export function getYearOptions(): OptionItem[] {
|
|
const y = new Date().getFullYear();
|
|
const out: OptionItem[] = [];
|
|
for (let i = y + 4; i >= y - 4; i--) {
|
|
out.push({ code: String(i), label: String(i) });
|
|
}
|
|
return out;
|
|
}
|