🔧 볼트 재질 정보 개선 및 A320/A194M 패턴 지원
Some checks failed
SonarQube Analysis / SonarQube Scan (push) Has been cancelled

- bolt_classifier.py: A320/A194M 조합 패턴 처리 로직 추가
- material_grade_extractor.py: A320/A194M 패턴 추출 개선
- integrated_classifier.py: SPECIAL, U_BOLT 카테고리 우선 분류
- 데이터베이스: 492개 볼트의 material_grade를 완전한 형태로 업데이트
  - A320/A194M GR B8/8: 78개
  - A193/A194 GR B7/2H: 414개
- 프론트엔드: BOLT 카테고리 전용 UI (길이 표시)
- Excel 내보내기: BOLT용 컬럼 순서 및 재질 정보 개선
- SPECIAL, U_BOLT 카테고리 지원 추가
This commit is contained in:
Hyungi Ahn
2025-10-01 08:18:25 +09:00
parent 50570e4624
commit 2e0d91cf59
12 changed files with 2370 additions and 256 deletions

View File

@@ -633,6 +633,17 @@ async def upload_file(
classification_result = classify_valve("", description, main_nom or "")
elif material_type == "BOLT":
classification_result = classify_bolt("", description, main_nom or "")
print(f"🔧 BOLT 분류 결과: {classification_result}")
print(f"🔧 원본 설명: {description}")
print(f"🔧 main_nom: {main_nom}")
# 길이 정보 확인
dimensions_info = classification_result.get("dimensions", {})
print(f"🔧 길이 정보: {dimensions_info}")
# 재질 정보 확인
material_info = classification_result.get("material", {})
print(f"🔧 재질 정보: {material_info}")
elif material_type == "GASKET":
classification_result = classify_gasket("", description, main_nom or "")
elif material_type == "INSTRUMENT":
@@ -1075,12 +1086,35 @@ async def upload_file(
dimensions_info = classification_result.get("dimensions", {})
material_info = classification_result.get("material", {})
print(f"🔧 fastener_type_info: {fastener_type_info}")
# 볼트 타입 (STUD_BOLT, HEX_BOLT 등)
bolt_type = ""
if isinstance(fastener_type_info, dict):
bolt_type = fastener_type_info.get("type", "UNKNOWN")
print(f"🔧 추출된 bolt_type: {bolt_type}")
else:
bolt_type = str(fastener_type_info) if fastener_type_info else "UNKNOWN"
print(f"🔧 문자열 bolt_type: {bolt_type}")
# 특수 용도 볼트 확인 (PSV, LT, CK 등)
special_result = classification_result.get("special_applications", {})
print(f"🔧 special_result: {special_result}")
# 특수 용도가 감지되면 타입 우선 적용
if special_result and special_result.get("detected_applications"):
detected_apps = special_result.get("detected_applications", [])
if "LT" in detected_apps:
bolt_type = "LT_BOLT"
print(f"🔧 특수 용도 감지로 bolt_type 변경: {bolt_type}")
elif "PSV" in detected_apps:
bolt_type = "PSV_BOLT"
print(f"🔧 특수 용도 감지로 bolt_type 변경: {bolt_type}")
elif "CK" in detected_apps:
bolt_type = "CK_BOLT"
print(f"🔧 특수 용도 감지로 bolt_type 변경: {bolt_type}")
print(f"🔧 최종 bolt_type: {bolt_type}")
# 나사 타입 (METRIC, INCH 등)
thread_type = ""
@@ -1553,6 +1587,9 @@ async def get_materials(
fd.fitting_type, fd.fitting_subtype, fd.connection_method, fd.pressure_rating,
fd.material_standard, fd.material_grade as fitting_material_grade, fd.main_size,
fd.reduced_size, fd.length_mm as fitting_length_mm, fd.schedule as fitting_schedule,
gd.gasket_type, gd.gasket_subtype, gd.material_type as gasket_material_type,
gd.filler_material, gd.pressure_rating as gasket_pressure_rating, gd.size_inches as gasket_size_inches,
gd.thickness as gasket_thickness, gd.temperature_range as gasket_temperature_range, gd.fire_safe,
mpt.confirmed_quantity, mpt.purchase_status, mpt.confirmed_by, mpt.confirmed_at,
-- 구매수량 계산에서 분류된 정보를 우선 사용
CASE
@@ -1579,6 +1616,7 @@ async def get_materials(
LEFT JOIN pipe_end_preparations pep ON m.id = pep.material_id
LEFT JOIN fitting_details fd ON m.id = fd.material_id
LEFT JOIN valve_details vd ON m.id = vd.material_id
LEFT JOIN gasket_details gd ON m.id = gd.material_id
LEFT JOIN material_purchase_tracking mpt ON (
m.material_hash = mpt.material_hash
AND f.job_no = mpt.job_no
@@ -1914,17 +1952,18 @@ async def get_materials(
flange_groups[flange_key]["materials"].append(material_dict)
material_dict['clean_description'] = clean_description
elif m.classified_category == 'GASKET':
gasket_query = text("SELECT * FROM gasket_details WHERE material_id = :material_id")
gasket_result = db.execute(gasket_query, {"material_id": m.id})
gasket_detail = gasket_result.fetchone()
if gasket_detail:
# 이미 JOIN된 gasket_details 데이터 사용
if m.gasket_type: # gasket_details가 있는 경우
material_dict['gasket_details'] = {
"gasket_type": gasket_detail.gasket_type,
"material_type": gasket_detail.material_type,
"pressure_rating": gasket_detail.pressure_rating,
"size_inches": gasket_detail.size_inches,
"thickness": gasket_detail.thickness,
"temperature_range": gasket_detail.temperature_range
"gasket_type": m.gasket_type,
"gasket_subtype": m.gasket_subtype,
"material_type": m.gasket_material_type,
"filler_material": m.filler_material,
"pressure_rating": m.gasket_pressure_rating,
"size_inches": m.gasket_size_inches,
"thickness": m.gasket_thickness,
"temperature_range": m.gasket_temperature_range,
"fire_safe": m.fire_safe
}
# 가스켓 그룹핑 - 크기, 압력, 재질로 그룹핑