Merge branch 'main' of http://39.117.244.52:3000/kjs/ERP-node into feature/v2-unified-renewal
This commit is contained in:
commit
e5faff2853
|
|
@ -3936,9 +3936,10 @@ export class TableManagementService {
|
||||||
`컬럼 입력타입 정보 조회: ${tableName}, company: ${companyCode}`
|
`컬럼 입력타입 정보 조회: ${tableName}, company: ${companyCode}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// table_type_columns에서 입력타입 정보 조회 (company_code 필터링)
|
// table_type_columns에서 입력타입 정보 조회
|
||||||
|
// 회사별 설정 우선, 없으면 기본 설정(*) fallback
|
||||||
const rawInputTypes = await query<any>(
|
const rawInputTypes = await query<any>(
|
||||||
`SELECT
|
`SELECT DISTINCT ON (ttc.column_name)
|
||||||
ttc.column_name as "columnName",
|
ttc.column_name as "columnName",
|
||||||
COALESCE(cl.column_label, ttc.column_name) as "displayName",
|
COALESCE(cl.column_label, ttc.column_name) as "displayName",
|
||||||
ttc.input_type as "inputType",
|
ttc.input_type as "inputType",
|
||||||
|
|
@ -3952,8 +3953,10 @@ export class TableManagementService {
|
||||||
LEFT JOIN information_schema.columns ic
|
LEFT JOIN information_schema.columns ic
|
||||||
ON ttc.table_name = ic.table_name AND ttc.column_name = ic.column_name
|
ON ttc.table_name = ic.table_name AND ttc.column_name = ic.column_name
|
||||||
WHERE ttc.table_name = $1
|
WHERE ttc.table_name = $1
|
||||||
AND ttc.company_code = $2
|
AND ttc.company_code IN ($2, '*')
|
||||||
ORDER BY ttc.display_order, ttc.column_name`,
|
ORDER BY ttc.column_name,
|
||||||
|
CASE WHEN ttc.company_code = $2 THEN 0 ELSE 1 END,
|
||||||
|
ttc.display_order`,
|
||||||
[tableName, companyCode]
|
[tableName, companyCode]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -3967,17 +3970,20 @@ export class TableManagementService {
|
||||||
const mappingTableExists = tableExistsResult[0]?.table_exists === true;
|
const mappingTableExists = tableExistsResult[0]?.table_exists === true;
|
||||||
|
|
||||||
// 카테고리 컬럼의 경우, 매핑된 메뉴 목록 조회
|
// 카테고리 컬럼의 경우, 매핑된 메뉴 목록 조회
|
||||||
|
// 회사별 설정 우선, 없으면 기본 설정(*) fallback
|
||||||
let categoryMappings: Map<string, number[]> = new Map();
|
let categoryMappings: Map<string, number[]> = new Map();
|
||||||
if (mappingTableExists) {
|
if (mappingTableExists) {
|
||||||
logger.info("카테고리 매핑 조회 시작", { tableName, companyCode });
|
logger.info("카테고리 매핑 조회 시작", { tableName, companyCode });
|
||||||
|
|
||||||
const mappings = await query<any>(
|
const mappings = await query<any>(
|
||||||
`SELECT
|
`SELECT DISTINCT ON (logical_column_name, menu_objid)
|
||||||
logical_column_name as "columnName",
|
logical_column_name as "columnName",
|
||||||
menu_objid as "menuObjid"
|
menu_objid as "menuObjid"
|
||||||
FROM category_column_mapping
|
FROM category_column_mapping
|
||||||
WHERE table_name = $1
|
WHERE table_name = $1
|
||||||
AND company_code = $2`,
|
AND company_code IN ($2, '*')
|
||||||
|
ORDER BY logical_column_name, menu_objid,
|
||||||
|
CASE WHEN company_code = $2 THEN 0 ELSE 1 END`,
|
||||||
[tableName, companyCode]
|
[tableName, companyCode]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5977,6 +5977,69 @@ export class ButtonActionExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ✅ allComponents가 있으면 기존 필수 항목 검증 수행
|
||||||
|
if (context.allComponents && context.allComponents.length > 0) {
|
||||||
|
console.log("🔍 [handleQuickInsert] 필수 항목 검증 시작:", {
|
||||||
|
hasAllComponents: !!context.allComponents,
|
||||||
|
allComponentsLength: context.allComponents?.length || 0,
|
||||||
|
});
|
||||||
|
const requiredValidation = this.validateRequiredFields(context);
|
||||||
|
if (!requiredValidation.isValid) {
|
||||||
|
console.log("❌ [handleQuickInsert] 필수 항목 누락:", requiredValidation.missingFields);
|
||||||
|
toast.error(`필수 항목을 입력해주세요: ${requiredValidation.missingFields.join(", ")}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log("✅ [handleQuickInsert] 필수 항목 검증 통과");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ quickInsert 전용 검증: component 타입 매핑에서 값이 비어있는지 확인
|
||||||
|
const mappingsForValidation = quickInsertConfig.columnMappings || [];
|
||||||
|
const missingMappingFields: string[] = [];
|
||||||
|
|
||||||
|
for (const mapping of mappingsForValidation) {
|
||||||
|
// component 타입 매핑은 필수 입력으로 간주
|
||||||
|
if (mapping.sourceType === "component" && mapping.sourceComponentId) {
|
||||||
|
let value: any = undefined;
|
||||||
|
|
||||||
|
// 값 가져오기 (formData에서)
|
||||||
|
if (mapping.sourceColumnName) {
|
||||||
|
value = context.formData?.[mapping.sourceColumnName];
|
||||||
|
}
|
||||||
|
if (value === undefined || value === null) {
|
||||||
|
value = context.formData?.[mapping.sourceComponentId];
|
||||||
|
}
|
||||||
|
// allComponents에서 컴포넌트 찾아서 columnName으로 시도
|
||||||
|
if ((value === undefined || value === null) && context.allComponents) {
|
||||||
|
const comp = context.allComponents.find((c: any) => c.id === mapping.sourceComponentId);
|
||||||
|
if (comp?.columnName) {
|
||||||
|
value = context.formData?.[comp.columnName];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// targetColumn으로 폴백
|
||||||
|
if ((value === undefined || value === null) && mapping.targetColumn) {
|
||||||
|
value = context.formData?.[mapping.targetColumn];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 값이 비어있으면 필수 누락으로 처리
|
||||||
|
if (value === undefined || value === null || (typeof value === "string" && value.trim() === "")) {
|
||||||
|
console.log("❌ [handleQuickInsert] component 매핑 값 누락:", {
|
||||||
|
targetColumn: mapping.targetColumn,
|
||||||
|
sourceComponentId: mapping.sourceComponentId,
|
||||||
|
sourceColumnName: mapping.sourceColumnName,
|
||||||
|
value,
|
||||||
|
});
|
||||||
|
missingMappingFields.push(mapping.targetColumn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missingMappingFields.length > 0) {
|
||||||
|
console.log("❌ [handleQuickInsert] 필수 입력 항목 누락:", missingMappingFields);
|
||||||
|
toast.error(`다음 항목을 입력해주세요: ${missingMappingFields.join(", ")}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
console.log("✅ [handleQuickInsert] quickInsert 매핑 검증 통과");
|
||||||
|
|
||||||
const { formData, splitPanelContext, userId, userName, companyCode } = context;
|
const { formData, splitPanelContext, userId, userName, companyCode } = context;
|
||||||
|
|
||||||
console.log("⚡ Quick Insert 상세 정보:", {
|
console.log("⚡ Quick Insert 상세 정보:", {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue