feat: SWG 가스켓 전체 구성 정보 표시 개선
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled
- H/F/I/O SS304/GRAPHITE/CS/CS 패턴에서 4개 구성요소 모두 표시 - 기존 SS304 + GRAPHITE → SS304/GRAPHITE/CS/CS로 완전한 구성 표시 - 외부링/필러/내부링/추가구성 모든 정보 포함 - 구매수량 계산 모달에서 정확한 재질 정보 확인 가능
This commit is contained in:
@@ -21,21 +21,44 @@ const groupMaterialsByCategory = (materials) => {
|
||||
|
||||
/**
|
||||
* 동일한 자재끼리 합치기 (자재 설명 + 사이즈 기준)
|
||||
* 엑셀 내보내기용 특별 처리:
|
||||
* - PIPE: 끝단 정보 제거 (BOE-POE, POE-TOE 등)
|
||||
* - NIPPLE: 길이별 구분 (75mm, 100mm 등)
|
||||
*/
|
||||
const consolidateMaterials = (materials, isComparison = false) => {
|
||||
const consolidated = {};
|
||||
|
||||
materials.forEach(material => {
|
||||
const category = material.classified_category || material.category || 'UNCATEGORIZED';
|
||||
const description = material.original_description || material.description || '';
|
||||
let description = material.original_description || material.description || '';
|
||||
const sizeSpec = material.size_spec || '';
|
||||
|
||||
// 그룹화 키: 카테고리 + 자재설명 + 사이즈
|
||||
const groupKey = `${category}|${description}|${sizeSpec}`;
|
||||
// 파이프 끝단 정보 제거 (엑셀 내보내기용)
|
||||
if (category === 'PIPE') {
|
||||
description = description
|
||||
.replace(/\s+(BOE-POE|POE-TOE|BOE-TOE|BOE-BBE|BBE-POE|BBE-BBE|POE-POE|TOE-TOE)\s*$/i, '')
|
||||
.replace(/\s+(BOE|POE|TOE|BBE)\s*-\s*(BOE|POE|TOE|BBE)\s*$/i, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
// 니플의 경우 길이 정보를 그룹화 키에 포함
|
||||
let lengthInfo = '';
|
||||
if (category === 'FITTING' && description.toLowerCase().includes('nipple')) {
|
||||
const lengthMatch = description.match(/(\d+)\s*mm/i);
|
||||
if (lengthMatch) {
|
||||
lengthInfo = `_${lengthMatch[1]}mm`;
|
||||
}
|
||||
}
|
||||
|
||||
// 그룹화 키: 카테고리 + 정제된자재설명 + 사이즈 + 길이정보
|
||||
const groupKey = `${category}|${description}|${sizeSpec}${lengthInfo}`;
|
||||
|
||||
if (!consolidated[groupKey]) {
|
||||
consolidated[groupKey] = {
|
||||
...material,
|
||||
// 정제된 설명으로 덮어쓰기
|
||||
original_description: description,
|
||||
description: description,
|
||||
quantity: 0,
|
||||
totalLength: 0, // 파이프용
|
||||
itemCount: 0, // 파이프 개수
|
||||
@@ -99,12 +122,23 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
|
||||
const category = material.classified_category || material.category || '-';
|
||||
const isPipe = category === 'PIPE';
|
||||
|
||||
// 엑셀용 자재 설명 정제
|
||||
let cleanDescription = material.original_description || material.description || '-';
|
||||
|
||||
// 파이프 끝단 정보 제거
|
||||
if (category === 'PIPE') {
|
||||
cleanDescription = cleanDescription
|
||||
.replace(/\s+(BOE-POE|POE-TOE|BOE-TOE|BOE-BBE|BBE-POE|BBE-BBE|POE-POE|TOE-TOE)\s*$/i, '')
|
||||
.replace(/\s+(BOE|POE|TOE|BBE)\s*-\s*(BOE|POE|TOE|BBE)\s*$/i, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
// 구매 수량 계산
|
||||
const purchaseInfo = calculatePurchaseQuantity(material);
|
||||
|
||||
const base = {
|
||||
'카테고리': category,
|
||||
'자재 설명': material.original_description || material.description || '-',
|
||||
'자재 설명': cleanDescription,
|
||||
'사이즈': material.size_spec || '-'
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user