feat: 사용자 요구사항 기능 완전 구현 및 전체 카테고리 추가
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

- 사용자 요구사항 저장/로드/엑셀 내보내기 기능 완전 구현
- 백엔드 API 수정: Request Body 방식으로 변경
- 데이터베이스 스키마: material_id 컬럼 추가
- 프론트엔드 상태 관리 개선: 저장 후 자동 리로드
- 입력 필드 연결 문제 해결: 누락된 onChange 핸들러 추가
- NewMaterialsPage에 '전체' 카테고리 버튼 추가 (기본 선택)
- Docker 환경 개선: 프론트엔드 볼륨 마운트 및 포트 수정
- UI 개선: 벌레 이모지 제거, 디버그 코드 정리
This commit is contained in:
Hyungi Ahn
2025-09-30 08:55:20 +09:00
parent 0f9a5ad2ea
commit 50570e4624
34 changed files with 942 additions and 181 deletions

View File

@@ -120,7 +120,6 @@ const consolidateMaterials = (materials, isComparison = false) => {
*/
const formatMaterialForExcel = (material, includeComparison = false) => {
const category = material.classified_category || material.category || '-';
const isPipe = category === 'PIPE';
// 엑셀용 자재 설명 정제
let cleanDescription = material.original_description || material.description || '-';
@@ -135,16 +134,12 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
// 니플의 경우 길이 정보 명시적 추가
if (category === 'FITTING' && cleanDescription.toLowerCase().includes('nipple')) {
// fitting_details에서 길이 정보 가져오기
if (material.fitting_details && material.fitting_details.length_mm) {
const lengthMm = Math.round(material.fitting_details.length_mm);
// 이미 길이 정보가 있는지 확인
if (!cleanDescription.match(/\d+\s*mm/i)) {
cleanDescription += ` ${lengthMm}mm`;
}
}
// 또는 기존 설명에서 길이 정보 추출
else {
} else {
const lengthMatch = material.original_description?.match(/(\d+)\s*mm/i);
if (lengthMatch && !cleanDescription.match(/\d+\s*mm/i)) {
cleanDescription += ` ${lengthMatch[1]}mm`;
@@ -155,31 +150,79 @@ const formatMaterialForExcel = (material, includeComparison = false) => {
// 구매 수량 계산
const purchaseInfo = calculatePurchaseQuantity(material);
// 품목명 생성 (간단하게)
let itemName = '';
if (category === 'PIPE') {
itemName = material.pipe_details?.manufacturing_method || 'PIPE';
} else if (category === 'FITTING') {
itemName = material.fitting_details?.fitting_type || 'FITTING';
} else if (category === 'FLANGE') {
itemName = 'FLANGE';
} else if (category === 'VALVE') {
itemName = 'VALVE';
} else if (category === 'GASKET') {
itemName = 'GASKET';
} else if (category === 'BOLT') {
itemName = 'BOLT';
} else {
itemName = category || 'UNKNOWN';
}
// 압력 등급 추출
let pressure = '-';
const pressureMatch = cleanDescription.match(/(\d+)LB/i);
if (pressureMatch) {
pressure = `${pressureMatch[1]}LB`;
}
// 스케줄 추출
let schedule = '-';
const scheduleMatch = cleanDescription.match(/SCH\s*(\d+[A-Z]*(?:\s*[xX×]\s*SCH\s*\d+[A-Z]*)?)/i);
if (scheduleMatch) {
schedule = scheduleMatch[0];
}
// 재질 추출 (ASTM 등)
let grade = '-';
const gradeMatch = cleanDescription.match(/(ASTM\s+[A-Z0-9\s]+(?:TP\d+|GR\s*[A-Z0-9]+|WP\d+)?)/i);
if (gradeMatch) {
grade = gradeMatch[1].trim();
}
// 새로운 엑셀 양식에 맞춘 데이터 구조
const base = {
'카테고리': category,
'자재 설명': cleanDescription,
'사이즈': material.size_spec || '-'
'TAGNO': '', // 비워둠
'품목명': itemName,
'수량': purchaseInfo.purchaseQuantity || material.quantity || 0,
'통화구분': 'KRW', // 기본값
'단가': 1, // 일괄 1로 설정
'크기': material.size_spec || '-',
'압력등급': pressure,
'스케줄': schedule,
'재질': grade,
'사용자요구': '',
'관리항목1': '', // 빈칸
'관리항목7': '', // 빈칸
'관리항목8': '', // 빈칸
'관리항목9': '', // 빈칸
'관리항목10': '', // 빈칸
'납기일(YYYY-MM-DD)': new Date().toISOString().split('T')[0] // 오늘 날짜
};
// 구매 수량 정보만 추가 (기존 수량/단위 정보 제거)
base['필요 수량'] = purchaseInfo.purchaseQuantity || 0;
base['구매 단위'] = purchaseInfo.unit || 'EA';
// 비교 모드인 경우 구매 수량 변화 정보만 추가
// 비교 모드인 경우 추가 정보
if (includeComparison) {
if (material.previous_quantity !== undefined) {
// 이전 구매 수량 계산
const prevPurchaseInfo = calculatePurchaseQuantity({
...material,
quantity: material.previous_quantity,
totalLength: material.previousTotalLength || 0
});
base['이전 필요 수량'] = prevPurchaseInfo.purchaseQuantity || 0;
base['필요 수량 변경'] = (purchaseInfo.purchaseQuantity - prevPurchaseInfo.purchaseQuantity);
base['이전수량'] = prevPurchaseInfo.purchaseQuantity || 0;
base['수량변경'] = (purchaseInfo.purchaseQuantity - prevPurchaseInfo.purchaseQuantity);
}
base['변경 유형'] = material.change_type || (
base['변경유형'] = material.change_type || (
material.previous_quantity !== undefined ? '수량 변경' :
material.quantity_change === undefined ? '신규' : '변경'
);