feat: 견적 시스템 API

- 5130의 71개 하드코딩 컬럼을 동적 카테고리 필드 시스템으로 전환
- 모터 브라켓 계산 등 핵심 비즈니스 로직 FormulaParser에 통합
- 파라미터 기반 동적 견적 폼 시스템 구축
- 견적 상태 워크플로 (DRAFT → SENT → APPROVED/REJECTED/EXPIRED)
- 모델셋 관리 API: 카테고리+제품+BOM 통합 관리
- 견적 관리 API: 생성/수정/복제/상태변경/미리보기 기능

주요 구현 사항:
- EstimateController/EstimateService: 견적 비즈니스 로직
- ModelSetController/ModelSetService: 모델셋 관리 로직
- Estimate/EstimateItem 모델: 견적 데이터 구조
- 동적 견적 필드 마이그레이션: 스크린/철재 제품 구조
- API 라우트 17개 엔드포인트 추가
- 다국어 메시지 지원 (성공/에러 메시지)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-24 17:41:26 +09:00
parent eb42d11f5e
commit 2d9217c9b4
14 changed files with 2021 additions and 0 deletions

View File

@@ -102,6 +102,11 @@ protected function executePreDefinedFunction(string $formula, array $variables):
return ['result' => 5]; // 최대값
}
// 5130 시스템 브라켓 사이즈 계산 (중량+인치 기반)
if ($formula === 'motor_bracket_size') {
return $this->calculateMotorBracketSize($variables);
}
// 환봉 수량 계산
if ($formula === 'round_bar_quantity') {
$W1 = $variables['W1'] ?? 0;
@@ -220,6 +225,89 @@ protected function evaluateCondition(string $condition, array $variables): bool
return eval("return {$expression};");
}
/**
* 5130 시스템 모터 브라켓 사이즈 계산 (중량+인치 기반)
*/
protected function calculateMotorBracketSize(array $variables): array
{
$weight = floatval($variables['weight'] ?? 0);
$inch = is_numeric($variables['inch'] ?? null) ? intval($variables['inch']) : 0;
$motorCapacity = 0;
if ($inch > 0) {
// 중량 + 인치 기준 판단 (철재 기준)
if (
($inch == 4 && $weight <= 300) ||
($inch == 5 && $weight <= 246) ||
($inch == 6 && $weight <= 208)
) {
$motorCapacity = 300;
} elseif (
($inch == 4 && $weight > 300 && $weight <= 400) ||
($inch == 5 && $weight > 246 && $weight <= 327) ||
($inch == 6 && $weight > 208 && $weight <= 277)
) {
$motorCapacity = 400;
} elseif (
($inch == 5 && $weight > 327 && $weight <= 500) ||
($inch == 6 && $weight > 277 && $weight <= 424) ||
($inch == 8 && $weight <= 324)
) {
$motorCapacity = 500;
} elseif (
($inch == 5 && $weight > 500 && $weight <= 600) ||
($inch == 6 && $weight > 424 && $weight <= 508) ||
($inch == 8 && $weight > 324 && $weight <= 388)
) {
$motorCapacity = 600;
} elseif (
($inch == 6 && $weight > 600 && $weight <= 800) ||
($inch == 6 && $weight > 508 && $weight <= 800) ||
($inch == 8 && $weight > 388 && $weight <= 611)
) {
$motorCapacity = 800;
} elseif (
($inch == 6 && $weight > 800 && $weight <= 1000) ||
($inch == 8 && $weight > 611 && $weight <= 1000)
) {
$motorCapacity = 1000;
}
} else {
// 인치가 없으면 중량만으로 판단
if ($weight <= 300) {
$motorCapacity = 300;
} elseif ($weight <= 400) {
$motorCapacity = 400;
} elseif ($weight <= 500) {
$motorCapacity = 500;
} elseif ($weight <= 600) {
$motorCapacity = 600;
} elseif ($weight <= 800) {
$motorCapacity = 800;
} elseif ($weight <= 1000) {
$motorCapacity = 1000;
}
}
// 용량별 브라켓 사이즈 매핑
$bracketSize = '530*320'; // 기본값
if (in_array($motorCapacity, [300, 400])) {
$bracketSize = '530*320';
} elseif (in_array($motorCapacity, [500, 600])) {
$bracketSize = '600*350';
} elseif (in_array($motorCapacity, [800, 1000])) {
$bracketSize = '690*390';
}
return [
'bracket_size' => $bracketSize,
'motor_capacity' => $motorCapacity,
'calculated_weight' => $weight,
'shaft_inch' => $inch
];
}
/**
* 미리 정의된 함수인지 확인
*/
@@ -230,6 +318,7 @@ protected function isPreDefinedFunction(string $formula): bool
'kyungdong_steel_size',
'screen_weight_calculation',
'bracket_quantity',
'motor_bracket_size',
'round_bar_quantity',
'shaft_size_determination',
'motor_capacity_determination'