📊 엑셀 내보내기 개선 완료
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

 개선 사항:
- 품목명에 상세 타입 정보 포함 (빠짐없이)
- 타입 컬럼 제거 (중복 방지)
- 납기일을 항상 P열에 고정
- 남는 공간을 관리항목1부터 채우기

🔧 상세 개선:
- ELBOW: 각도(90°/45°), 반경(LR/SR), 연결방식(SW/BW) 표시
- FLANGE: 풀네임 + 끝단처리 정보 포함
- 모든 카테고리에서 타입 컬럼 제거하고 품목명에 통합
- P열 납기일 고정, 관리항목으로 빈 공간 채우기
This commit is contained in:
hyungi
2025-10-16 07:08:19 +09:00
parent 5e995d1208
commit ee13e92b61

View File

@@ -217,9 +217,33 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
itemName = 'OLET'; itemName = 'OLET';
} }
} else if (fittingType === 'ELBOW') { } else if (fittingType === 'ELBOW') {
// 엘보 각도 표시 // 엘보 상세 정보 표시 (각도, 반경, 연결방식)
const angle = fittingSubtype === '90DEG' ? '90도' : fittingSubtype === '45DEG' ? '45도' : ''; let elbowDetails = [];
itemName = `엘보 ${angle}`.trim();
// 각도 정보
if (fittingSubtype.includes('90DEG') || cleanDescription.includes('90')) {
elbowDetails.push('90도');
} else if (fittingSubtype.includes('45DEG') || cleanDescription.includes('45')) {
elbowDetails.push('45도');
} else {
elbowDetails.push('90도'); // 기본값
}
// 반경 정보
if (fittingSubtype.includes('LONG_RADIUS') || cleanDescription.toUpperCase().includes('LR')) {
elbowDetails.push('LR');
} else if (fittingSubtype.includes('SHORT_RADIUS') || cleanDescription.toUpperCase().includes('SR')) {
elbowDetails.push('SR');
}
// 연결 방식
if (cleanDescription.includes('SW')) {
elbowDetails.push('SW');
} else if (cleanDescription.includes('BW')) {
elbowDetails.push('BW');
}
itemName = `엘보 ${elbowDetails.join(' ')}`.trim();
} else if (fittingType === 'TEE') { } else if (fittingType === 'TEE') {
// 티 타입 표시 // 티 타입 표시
const teeType = fittingSubtype === 'EQUAL' ? '등경' : fittingSubtype === 'REDUCING' ? '축소' : ''; const teeType = fittingSubtype === 'EQUAL' ? '등경' : fittingSubtype === 'REDUCING' ? '축소' : '';
@@ -237,29 +261,47 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
const flangeType = flangeDetails.flange_type || ''; const flangeType = flangeDetails.flange_type || '';
const facingType = flangeDetails.facing_type || ''; const facingType = flangeDetails.facing_type || '';
if (flangeType === 'WELD_NECK') { // 플랜지 타입 풀네임 매핑 (한국어)
itemName = '웰드넥 플랜지'; const flangeTypeKoreanMap = {
} else if (flangeType === 'SLIP_ON') { 'WELD_NECK': 'WELD NECK FLANGE',
itemName = '슬립온 플랜지'; 'SLIP_ON': 'SLIP ON FLANGE',
} else if (flangeType === 'SOCKET_WELD') { 'SOCKET_WELD': 'SOCKET WELD FLANGE',
itemName = '소켓웰드 플랜지'; 'BLIND': 'BLIND FLANGE',
} else if (flangeType === 'BLIND') { 'REDUCING': 'REDUCING FLANGE',
itemName = '블라인드 플랜지'; 'ORIFICE': 'ORIFICE FLANGE',
} else if (flangeType === 'REDUCING') { 'SPECTACLE': 'SPECTACLE BLIND',
itemName = '축소 플랜지'; 'PADDLE': 'PADDLE BLIND',
'SPACER': 'SPACER'
};
// 끝단처리 정보 추가
const facingInfo = facingType ? ` ${facingType}` : '';
if (flangeType && flangeTypeKoreanMap[flangeType]) {
itemName = `${flangeTypeKoreanMap[flangeType]}${facingInfo}`;
} else { } else {
// 특수 플랜지는 구분 // description에서 추출
const desc = cleanDescription.toUpperCase(); const desc = cleanDescription.toUpperCase();
if (desc.includes('ORIFICE')) { if (desc.includes('ORIFICE')) {
itemName = '오리피스 플랜지'; itemName = `ORIFICE FLANGE${facingInfo}`;
} else if (desc.includes('SPECTACLE')) { } else if (desc.includes('SPECTACLE')) {
itemName = '스펙터클 블라인드'; itemName = `SPECTACLE BLIND${facingInfo}`;
} else if (desc.includes('PADDLE')) { } else if (desc.includes('PADDLE')) {
itemName = '패들 블라인드'; itemName = `PADDLE BLIND${facingInfo}`;
} else if (desc.includes('SPACER')) { } else if (desc.includes('SPACER')) {
itemName = '스페이서'; itemName = `SPACER${facingInfo}`;
} else if (desc.includes('REDUCING') || desc.includes('RED')) {
itemName = `REDUCING FLANGE${facingInfo}`;
} else if (desc.includes('BLIND')) {
itemName = `BLIND FLANGE${facingInfo}`;
} else if (desc.includes('WN')) {
itemName = `WELD NECK FLANGE${facingInfo}`;
} else if (desc.includes('SO')) {
itemName = `SLIP ON FLANGE${facingInfo}`;
} else if (desc.includes('SW')) {
itemName = `SOCKET WELD FLANGE${facingInfo}`;
} else { } else {
itemName = '플랜지'; itemName = `FLANGE${facingInfo}`;
} }
} }
@@ -624,7 +666,7 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
// F~O열: 카테고리별 전용 컬럼 구성 (10개 컬럼) // F~O열: 카테고리별 전용 컬럼 구성 (10개 컬럼)
if (category === 'PIPE') { if (category === 'PIPE') {
// 파이프 전용 컬럼 (F~O) // 파이프 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['스케줄'] = schedule; // H열 base['스케줄'] = schedule; // H열
@@ -636,17 +678,17 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
base['관리항목2'] = ''; // N열 base['관리항목2'] = ''; // N열
base['관리항목3'] = ''; // O열 base['관리항목3'] = ''; // O열
} else if (category === 'FITTING') { } else if (category === 'FITTING') {
// 피팅 전용 컬럼 (F~O) // 피팅 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['타입'] = material.fitting_details?.fitting_type || '-'; // H열 base['재질'] = grade; // H열
base['재질'] = grade; // I열 base['상세내역'] = detailInfo || '-'; // I열
base['상세내역'] = detailInfo || '-'; // J열 base['사용자요구'] = material.user_requirement || ''; // J열
base['사용자요구'] = material.user_requirement || ''; // K열 base['관리항목1'] = ''; // K열
base['관리항목1'] = ''; // L열 base['관리항목2'] = ''; // L열
base['관리항목2'] = ''; // M열 base['관리항목3'] = ''; // M열
base['관리항목3'] = ''; // N열 base['관리항목4'] = ''; // N열
base['관리항목4'] = ''; // O열 base['관리항목5'] = ''; // O열
} else if (category === 'FLANGE') { } else if (category === 'FLANGE') {
// 플랜지 타입 풀네임 매핑 (영어) // 플랜지 타입 풀네임 매핑 (영어)
const flangeTypeMap = { const flangeTypeMap = {
@@ -681,34 +723,34 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
const rawFlangeType = material.flange_details?.flange_type || ''; const rawFlangeType = material.flange_details?.flange_type || '';
const rawFacingType = material.flange_details?.facing_type || ''; const rawFacingType = material.flange_details?.facing_type || '';
// 플랜지 전용 컬럼 (F~O) // 플랜지 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['타입'] = flangeTypeMap[rawFlangeType] || rawFlangeType || 'FLANGE'; // H열 base['재질'] = grade; // H열
base['재질'] = grade; // I열 base['페이싱'] = facingTypeMap[rawFacingType] || rawFacingType || '-'; // I열
base['페이싱'] = facingTypeMap[rawFacingType] || rawFacingType || '-'; // J열 base['사용자요구'] = material.user_requirement || ''; // J열
base['사용자요구'] = material.user_requirement || ''; // K열 base['관리항목1'] = ''; // K열
base['관리항목1'] = ''; // L열 base['관리항목2'] = ''; // L열
base['관리항목2'] = ''; // M열 base['관리항목3'] = ''; // M열
base['관리항목3'] = ''; // N열 base['관리항목4'] = ''; // N열
base['관리항목4'] = ''; // O열 base['관리항목5'] = ''; // O열
} else if (category === 'VALVE') { } else if (category === 'VALVE') {
// 밸브 전용 컬럼 (F~O) // 밸브 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['타입'] = material.valve_details?.valve_type || '-'; // H열 base['재질'] = grade; // H열
base['재질'] = grade; // I열 base['상세내역'] = detailInfo || '-'; // I열
base['상세내역'] = detailInfo || '-'; // J열 base['사용자요구'] = material.user_requirement || ''; // J열
base['사용자요구'] = material.user_requirement || ''; // K열 base['관리항목1'] = ''; // K열
base['관리항목1'] = ''; // L열 base['관리항목2'] = ''; // L열
base['관리항목2'] = ''; // M열 base['관리항목3'] = ''; // M열
base['관리항목3'] = ''; // N열 base['관리항목4'] = ''; // N열
base['관리항목4'] = ''; // O열 base['관리항목5'] = ''; // O열
} else if (category === 'GASKET') { } else if (category === 'GASKET') {
// 가스켓 전용 컬럼 (F~O) // 가스켓 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['타입/구조'] = grade; // H열: H/F/I/O, SWG 등 base['구조'] = grade; // H열: H/F/I/O, SWG 등 (타입 정보 제거)
base['재질'] = gasketMaterial || '-'; // I열: SS304/GRAPHITE/SS304/SS304 base['재질'] = gasketMaterial || '-'; // I열: SS304/GRAPHITE/SS304/SS304
base['두께'] = gasketThickness || '-'; // J열: 4.5mm base['두께'] = gasketThickness || '-'; // J열: 4.5mm
base['사용자요구'] = material.user_requirement || ''; // K열 base['사용자요구'] = material.user_requirement || ''; // K열
@@ -717,7 +759,7 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
base['관리항목3'] = ''; // N열 base['관리항목3'] = ''; // N열
base['관리항목4'] = ''; // O열 base['관리항목4'] = ''; // O열
} else if (category === 'BOLT') { } else if (category === 'BOLT') {
// 볼트 전용 컬럼 (F~O) // 볼트 전용 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['길이'] = schedule; // H열: 볼트는 길이 정보 base['길이'] = schedule; // H열: 볼트는 길이 정보
@@ -729,7 +771,7 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
base['관리항목3'] = ''; // N열 base['관리항목3'] = ''; // N열
base['관리항목4'] = ''; // O열 base['관리항목4'] = ''; // O열
} else { } else {
// 기타 카테고리 기본 컬럼 (F~O) // 기타 카테고리 기본 컬럼 (F~O) - 타입 제거, 품목명에 포함됨
base['크기'] = material.size_spec || '-'; // F열 base['크기'] = material.size_spec || '-'; // F열
base['압력등급'] = pressure; // G열 base['압력등급'] = pressure; // G열
base['스케줄'] = schedule; // H열 base['스케줄'] = schedule; // H열