feat: 밸브 분류 시스템 및 구매 관리 시스템 기초 구현

 밸브 분류 시스템:
- VALVE 상세 정보 저장 로직 추가 (backend/app/routers/files.py)
- 프론트엔드 밸브 사양서 표시 로직 추가 (MaterialsPage.jsx)
- 밸브 분류기 테스트 스크립트 및 데이터 (test_valve_classifier.py, test_valve_bom.csv)

🛒 구매 관리 시스템:
- 구매 관리 테이블 스키마 (08_create_purchase_tables.sql)
- 구매확정 페이지 컴포넌트 (PurchaseConfirmationPage.jsx)
- MaterialsPage에 구매확정 버튼 추가

🎯 주요 기능:
- 밸브 타입, 연결방식, 압력등급, 재질 분류
- 구매 품목 마스터, 주문 관리, 리비전 추적
- 파이프 절단손실 및 6M 단위 계산 준비
This commit is contained in:
Hyungi Ahn
2025-07-18 13:12:41 +09:00
parent 3dd301cb57
commit 92a78225f0
6 changed files with 1082 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ import {
Divider
} from '@mui/material';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import ShoppingCart from '@mui/icons-material/ShoppingCart';
import { api } from '../api';
const MaterialsPage = () => {
@@ -412,6 +413,67 @@ const MaterialsPage = () => {
unit: 'EA',
isLength: false
};
} else if (category === 'VALVE') {
// VALVE: 타입 + 연결방식 + 압력등급 + 재질 + 사이즈
const main_nom = material.main_nom || '';
const valve_type = material.valve_details?.valve_type || 'VALVE';
const valve_subtype = material.valve_details?.valve_subtype || '';
const connection_method = material.valve_details?.connection_method || '';
const pressure_rating = material.valve_details?.pressure_rating || '';
const body_material = material.valve_details?.body_material || material.material_grade || '';
const actuator_type = material.valve_details?.actuator_type || 'MANUAL';
const fire_safe = material.valve_details?.fire_safe || false;
// 밸브 스펙 생성
const valve_spec_parts = [];
// 밸브 타입 (GATE_VALVE, BALL_VALVE 등)
if (valve_type && valve_type !== 'UNKNOWN') {
valve_spec_parts.push(valve_type.replace('_', ' '));
}
// 연결 방식 (FLANGED, THREADED, SOCKET_WELD 등)
if (connection_method && connection_method !== 'UNKNOWN') {
valve_spec_parts.push(connection_method.replace('_', ' '));
}
// 압력 등급 (150LB, 300LB 등)
if (pressure_rating && pressure_rating !== 'UNKNOWN') {
valve_spec_parts.push(pressure_rating);
}
// 작동 방식 (수동이 아닌 경우만 표시)
if (actuator_type && actuator_type !== 'MANUAL' && actuator_type !== 'UNKNOWN') {
valve_spec_parts.push(actuator_type.replace('_', ' '));
}
// 특수 기능 (Fire Safe 등)
if (fire_safe) {
valve_spec_parts.push('FIRE SAFE');
}
if (valve_subtype && valve_subtype !== 'UNKNOWN') {
valve_spec_parts.push(valve_subtype);
}
const full_valve_spec = valve_spec_parts.join(', ');
specKey = `${category}|${full_valve_spec}|${body_material}|${main_nom}`;
specData = {
category: 'VALVE',
valve_type,
valve_subtype,
connection_method,
pressure_rating,
body_material,
actuator_type,
fire_safe,
full_valve_spec,
size_display: main_nom,
main_nom,
unit: 'EA',
isLength: false
};
} else {
// 기타 자재: 기본 분류
const material_spec = material.material_grade || '';
@@ -515,14 +577,30 @@ const MaterialsPage = () => {
<Box sx={{ maxWidth: 1400, mx: 'auto', mt: 4, px: 2 }}>
{/* 헤더 */}
<Box sx={{ mb: 3 }}>
<Button
variant="outlined"
startIcon={<ArrowBackIcon />}
onClick={() => navigate(-1)}
sx={{ mb: 2 }}
>
뒤로가기
</Button>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', mb: 2 }}>
<Button
variant="outlined"
startIcon={<ArrowBackIcon />}
onClick={() => navigate(-1)}
>
뒤로가기
</Button>
<Button
variant="contained"
color="success"
size="large"
startIcon={<ShoppingCart />}
onClick={() => {
const params = new URLSearchParams(window.location.search);
navigate(`/purchase-confirmation?${params.toString()}`);
}}
disabled={materialSpecs.length === 0}
sx={{ minWidth: 150 }}
>
구매 확정
</Button>
</Box>
<Typography variant="h4" component="h1" gutterBottom>
📋 자재 사양서
@@ -644,7 +722,18 @@ const MaterialsPage = () => {
<TableCell align="right"><strong>수량</strong></TableCell>
</>
)}
{!['PIPE', 'FITTING', 'FLANGE', 'GASKET', 'BOLT', 'INSTRUMENT'].includes(category) && (
{category === 'VALVE' && (
<>
<TableCell><strong>밸브 타입</strong></TableCell>
<TableCell><strong>연결방식</strong></TableCell>
<TableCell><strong>압력등급</strong></TableCell>
<TableCell><strong>재질</strong></TableCell>
<TableCell><strong>사이즈</strong></TableCell>
<TableCell><strong>작동방식</strong></TableCell>
<TableCell align="right"><strong>수량</strong></TableCell>
</>
)}
{!['PIPE', 'FITTING', 'FLANGE', 'GASKET', 'BOLT', 'INSTRUMENT', 'VALVE'].includes(category) && (
<>
<TableCell><strong>재질</strong></TableCell>
<TableCell><strong>사이즈</strong></TableCell>
@@ -787,7 +876,47 @@ const MaterialsPage = () => {
</TableCell>
</>
)}
{(!['PIPE', 'FITTING', 'FLANGE', 'GASKET', 'BOLT', 'INSTRUMENT'].includes(category)) && (
{category === 'VALVE' && (
<>
<TableCell>
<Typography variant="body2" sx={{ fontWeight: 'bold' }}>
{spec.valve_type?.replace('_', ' ') || 'VALVE'}
</Typography>
</TableCell>
<TableCell>
<Typography variant="body2">
{spec.connection_method?.replace('_', ' ') || 'Unknown'}
</Typography>
</TableCell>
<TableCell>
<Typography variant="body2">
{spec.pressure_rating || 'Unknown'}
</Typography>
</TableCell>
<TableCell>
<Typography variant="body2">
{spec.body_material || 'Unknown'}
</Typography>
</TableCell>
<TableCell>
<Typography variant="body2">
{spec.size_display || 'Unknown'}
</Typography>
</TableCell>
<TableCell>
<Typography variant="body2">
{spec.actuator_type?.replace('_', ' ') || 'MANUAL'}
{spec.fire_safe && ' + FIRE SAFE'}
</Typography>
</TableCell>
<TableCell align="right">
<Typography variant="body2" fontWeight="bold">
{spec.totalQuantity} {spec.unit}
</Typography>
</TableCell>
</>
)}
{(!['PIPE', 'FITTING', 'FLANGE', 'GASKET', 'BOLT', 'INSTRUMENT', 'VALVE'].includes(category)) && (
<>
<TableCell>{spec.material_spec || 'Unknown'}</TableCell>
<TableCell>{spec.size_display || 'Unknown'}</TableCell>