리비전 페이지 제거 및 트랜잭션 오류 임시 수정
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

- frontend/src/pages/revision/ 폴더 완전 삭제
- EnhancedRevisionPage.css 제거
- support_details 저장 시 트랜잭션 오류로 인해 임시로 상세 정보 저장 비활성화
- 리비전 기능 재설계 예정
This commit is contained in:
Hyungi Ahn
2025-10-21 12:11:57 +09:00
parent 8f42a1054e
commit 1dc735f362
29 changed files with 1728 additions and 6987 deletions

View File

@@ -10,6 +10,7 @@ import tempfile
import os
from concurrent.futures import ThreadPoolExecutor
import gc
from fastapi import HTTPException
from .logger import get_logger
from ..config import get_settings
@@ -333,3 +334,107 @@ class FileProcessor:
# 전역 파일 프로세서 인스턴스
file_processor = FileProcessor()
def parse_dataframe(df):
"""DataFrame을 파싱하여 자재 데이터로 변환"""
df = df.dropna(how='all')
# 원본 컬럼명 출력
# 로그 제거
df.columns = df.columns.str.strip().str.lower()
# 로그 제거
column_mapping = {
'description': ['description', 'item', 'material', '품명', '자재명'],
'quantity': ['qty', 'quantity', 'ea', '수량'],
'main_size': ['main_nom', 'nominal_diameter', 'nd', '주배관'],
'red_size': ['red_nom', 'reduced_diameter', '축소배관'],
'length': ['length', 'len', '길이'],
'weight': ['weight', 'wt', '중량'],
'dwg_name': ['dwg_name', 'drawing', '도면명'],
'line_num': ['line_num', 'line_number', '라인번호']
}
mapped_columns = {}
for standard_col, possible_names in column_mapping.items():
for possible_name in possible_names:
if possible_name in df.columns:
mapped_columns[standard_col] = possible_name
break
print(f"📋 엑셀 컬럼 매핑 결과: {mapped_columns}")
print(f"📋 원본 컬럼명들: {list(df.columns)}")
materials = []
for index, row in df.iterrows():
description = str(row.get(mapped_columns.get('description', ''), '')).strip()
if not description or description.lower() in ['nan', 'none', '']:
continue
# 수량 처리
quantity_raw = row.get(mapped_columns.get('quantity', ''), 0)
try:
quantity = float(quantity_raw) if pd.notna(quantity_raw) else 0
except (ValueError, TypeError):
quantity = 0
if quantity <= 0:
continue
# 길이 처리
length_raw = row.get(mapped_columns.get('length', ''), 0)
try:
length = float(length_raw) if pd.notna(length_raw) else 0
except (ValueError, TypeError):
length = 0
# 도면명 처리
dwg_name = str(row.get(mapped_columns.get('dwg_name', ''), '')).strip()
if dwg_name.lower() in ['nan', 'none']:
dwg_name = ''
# 라인번호 처리
line_num = str(row.get(mapped_columns.get('line_num', ''), '')).strip()
if line_num.lower() in ['nan', 'none']:
line_num = ''
# 사이즈 처리
main_size = str(row.get(mapped_columns.get('main_size', ''), '')).strip()
if main_size.lower() in ['nan', 'none']:
main_size = ''
red_size = str(row.get(mapped_columns.get('red_size', ''), '')).strip()
if red_size.lower() in ['nan', 'none']:
red_size = ''
materials.append({
'original_description': description,
'quantity': quantity,
'unit': 'EA', # 기본 단위
'length': length,
'drawing_name': dwg_name,
'line_no': line_num,
'main_nom': main_size,
'red_nom': red_size,
'row_number': index + 1
})
return materials
def parse_file_data(file_path):
"""파일을 파싱하여 자재 데이터 추출"""
file_extension = Path(file_path).suffix.lower()
try:
if file_extension == ".csv":
df = pd.read_csv(file_path, encoding='utf-8')
elif file_extension in [".xlsx", ".xls"]:
df = pd.read_excel(file_path, sheet_name=0)
else:
raise HTTPException(status_code=400, detail="지원하지 않는 파일 형식")
return parse_dataframe(df)
except Exception as e:
raise HTTPException(status_code=400, detail=f"파일 파싱 실패: {str(e)}")