summaryrefslogtreecommitdiff
path: root/lib/vendor-pool/enrichment-service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-pool/enrichment-service.ts')
-rw-r--r--lib/vendor-pool/enrichment-service.ts54
1 files changed, 2 insertions, 52 deletions
diff --git a/lib/vendor-pool/enrichment-service.ts b/lib/vendor-pool/enrichment-service.ts
index 88694227..f492f7a6 100644
--- a/lib/vendor-pool/enrichment-service.ts
+++ b/lib/vendor-pool/enrichment-service.ts
@@ -1,6 +1,5 @@
"use server";
-import { getDisciplineCodeByCode } from "@/components/common/discipline/discipline-service";
import { getMaterialGroupByCode } from "@/lib/material/material-group-service";
import { getVendorByCode } from "@/components/common/vendor/vendor-service";
import { debugLog, debugWarn, debugSuccess } from "@/lib/debug-utils";
@@ -10,10 +9,6 @@ import { debugLog, debugWarn, debugSuccess } from "@/lib/debug-utils";
* 코드 필드를 기반으로 나머지 데이터를 자동으로 채웁니다.
*/
export interface VendorPoolEnrichmentInput {
- // 설계기능 관련
- designCategoryCode?: string;
- designCategory?: string;
-
// 자재그룹 관련
materialGroupCode?: string;
materialGroupName?: string;
@@ -21,10 +16,6 @@ export interface VendorPoolEnrichmentInput {
// 협력업체 관련
vendorCode?: string;
vendorName?: string;
-
- // 계약서명주체 관련
- contractSignerCode?: string;
- contractSignerName?: string;
}
export interface VendorPoolEnrichmentResult {
@@ -44,32 +35,11 @@ export async function enrichVendorPoolData(
const warnings: string[] = [];
debugLog('[Enrichment] 시작:', {
- designCategoryCode: data.designCategoryCode,
materialGroupCode: data.materialGroupCode,
vendorCode: data.vendorCode,
- contractSignerCode: data.contractSignerCode,
});
- // 1. 설계기능코드 → 설계기능명 자동완성
- if (data.designCategoryCode && !data.designCategory) {
- debugLog('[Enrichment] 설계기능명 조회 시도:', data.designCategoryCode);
- const discipline = await getDisciplineCodeByCode(data.designCategoryCode);
- if (discipline) {
- enriched.designCategory = discipline.USR_DF_CHAR_18;
- enrichedFields.push('designCategory');
- debugSuccess('[Enrichment] 설계기능명 자동완성:', {
- code: data.designCategoryCode,
- name: discipline.USR_DF_CHAR_18,
- });
- } else {
- debugWarn('[Enrichment] 설계기능코드를 찾을 수 없음:', data.designCategoryCode);
- warnings.push(
- `설계기능코드 '${data.designCategoryCode}'에 해당하는 설계기능명을 찾을 수 없습니다.`
- );
- }
- }
-
- // 2. 자재그룹코드 → 자재그룹명 자동완성
+ // 1. 자재그룹코드 → 자재그룹명 자동완성
if (data.materialGroupCode && !data.materialGroupName) {
debugLog('[Enrichment] 자재그룹명 조회 시도:', data.materialGroupCode);
const materialGroup = await getMaterialGroupByCode(data.materialGroupCode);
@@ -88,7 +58,7 @@ export async function enrichVendorPoolData(
}
}
- // 3. 협력업체코드 → 협력업체명 자동완성
+ // 2. 협력업체코드 → 협력업체명 자동완성
if (data.vendorCode && !data.vendorName) {
debugLog('[Enrichment] 협력업체명 조회 시도:', data.vendorCode);
const vendor = await getVendorByCode(data.vendorCode);
@@ -107,25 +77,6 @@ export async function enrichVendorPoolData(
}
}
- // 4. 계약서명주체코드 → 계약서명주체명 자동완성
- if (data.contractSignerCode && !data.contractSignerName) {
- debugLog('[Enrichment] 계약서명주체명 조회 시도:', data.contractSignerCode);
- const contractSigner = await getVendorByCode(data.contractSignerCode);
- if (contractSigner) {
- enriched.contractSignerName = contractSigner.vendorName;
- enrichedFields.push('contractSignerName');
- debugSuccess('[Enrichment] 계약서명주체명 자동완성:', {
- code: data.contractSignerCode,
- name: contractSigner.vendorName,
- });
- } else {
- debugWarn('[Enrichment] 계약서명주체코드를 찾을 수 없음:', data.contractSignerCode);
- warnings.push(
- `계약서명주체코드 '${data.contractSignerCode}'에 해당하는 계약서명주체명을 찾을 수 없습니다.`
- );
- }
- }
-
debugSuccess('[Enrichment] 완료:', {
enrichedFieldsCount: enrichedFields.length,
warningsCount: warnings.length,
@@ -137,4 +88,3 @@ export async function enrichVendorPoolData(
warnings,
};
}
-