Files
wace_rps/frontend/lib/api/salesSale.ts
T
hjjeong a0f6e0fa26 판매관리 그리드 V1 컬럼 8개 보강 + cu01_cnt 실데이터 + wace 1:1 검증 문서·자동 검증 SQL
- getList SQL: attach_file_info LATERAL JOIN으로 cu01_cnt(주문서첨부) 실데이터 (contract_mgmt.objid 기반, doc_type IN FTC_ORDER/ORDER)
- SaleListRow 타입: product_type_name/nation_name/receipt_date/customer_request/manager_name/payment_type_name/cu01_cnt 보강
- GRID_COLUMNS 8개 추가: 제품구분/국내해외/접수일/고객사요청사항/주문서첨부/출하방법/담당자/인도조건 (wace 36/36 일치)
- docs/migration/sales/03-sale-verify.md: wace ↔ RPS 매핑 / 갭 처리
- scripts/verify-sale.sql: BEGIN/ROLLBACK 2개 시나리오 (그리드 V1 / 판매상태 wace 로직)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 09:38:57 +09:00

156 lines
4.4 KiB
TypeScript

import { apiClient } from "./client";
export interface SaleListFilter {
orderType?: string;
poNo?: string;
customer_objid?: string;
productType?: string;
nation?: string;
search_partObjId?: string;
serialNo?: string;
shippingStatus?: string;
orderDateFrom?: string;
orderDateTo?: string;
shippingDateFrom?: string;
shippingDateTo?: string;
salesStatus?: string;
salesDeadlineFrom?: string;
salesDeadlineTo?: string;
}
export interface SaleListRow {
project_no: string;
contract_no: string | null;
order_type: string | null;
order_date: string | null;
po_no: string | null;
request_date: string | null;
customer_objid: string | null;
customer: string | null;
product_type: string | null;
contract_item_objid: string;
seq: number;
part_objid: string | null;
product_no: string | null;
product_name: string | null;
order_quantity: string | null;
sales_quantity: number | null;
remaining_quantity: number | null;
sale_no: number | null;
sales_unit_price: number | null;
sales_supply_price: number | null;
sales_vat: number | null;
sales_total_amount: number | null;
sales_currency: string | null;
sales_exchange_rate: number | null;
shipping_date: string | null;
shipping_method: string | null;
shipping_order_status: string | null;
manager_user_id: string | null;
incoterms: string | null;
has_split_shipment: boolean | null;
order_status: string | null;
sales_status: string;
production_status: string | null;
payment_type: string | null;
payment_type_name: string | null;
nation: string | null;
nation_name: string | null;
product_type_name: string | null;
receipt_date: string | null;
customer_request: string | null;
manager_name: string | null;
cu01_cnt: number | null;
serial_no: string | null;
}
export interface RevenueListRow {
project_no: string;
contract_no: string | null;
order_type: string | null;
order_date: string | null;
po_no: string | null;
customer_objid: string | null;
customer: string | null;
product_type: string | null;
nation: string | null;
log_id: number;
target_objid: string;
parent_sale_no: number | null;
sales_quantity: number | null;
sales_unit_price: number | null;
sales_supply_price: number | null;
sales_vat: number | null;
sales_total_amount: number | null;
sales_currency: string | null;
sales_exchange_rate: number | null;
shipping_date: string | null;
shipping_method: string | null;
serial_no: string | null;
split_serial_no: string | null;
sales_deadline_date: string | null;
tax_type: string | null;
tax_invoice_date: string | null;
export_decl_no: string | null;
loading_date: string | null;
sales_slip_date: string | null;
sales_slip_menu_sq: number | null;
remark: string | null;
}
export interface SaleRegisterBody {
project_no: string;
shipping_order_status?: string;
serial_no?: string;
sales_quantity?: number;
sales_unit_price?: number;
sales_supply_price?: number;
sales_vat?: number;
sales_total_amount?: number;
sales_currency?: string;
sales_exchange_rate?: number;
shipping_date?: string;
shipping_method?: string;
manager_user_id?: string;
incoterms?: string;
has_split_shipment?: boolean;
}
export interface DeadlineInfoBody {
log_id?: number;
parent_sale_no: number;
target_objid: string;
sales_deadline_date?: string;
tax_type?: string;
tax_invoice_date?: string;
export_decl_no?: string;
loading_date?: string;
sales_slip_date?: string;
sales_slip_menu_sq?: number;
remark?: string;
}
export const salesSaleApi = {
async saleList(filter: SaleListFilter = {}) {
const res = await apiClient.get("/sales/sale/list", { params: filter });
return (res.data?.data ?? []) as SaleListRow[];
},
async registerSale(body: SaleRegisterBody) {
return (await apiClient.post("/sales/sale", body)).data?.data;
},
async deleteSale(projectNo: string) {
return (await apiClient.delete(`/sales/sale/${projectNo}`)).data;
},
async revenueList(filter: SaleListFilter = {}) {
const res = await apiClient.get("/sales/revenue/list", { params: filter });
return (res.data?.data ?? []) as RevenueListRow[];
},
async saveDeadlineInfo(body: DeadlineInfoBody) {
return (await apiClient.post("/sales/revenue/deadline-info", body)).data?.data;
},
async confirmSalesDeadline(logIds: number[]) {
return (await apiClient.post("/sales/revenue/deadline-confirm", { logIds })).data;
},
};