feat: 경동기업 전용 견적 계산 로직 구현 (Phase 4 완료)

- KdPriceTable 모델: 경동기업 단가 테이블 (motor, shaft, pipe, angle, raw_material, bdmodels)
- KyungdongFormulaHandler: 모터 용량, 브라켓 크기, 절곡품(10종), 부자재(3종) 계산
- FormulaEvaluatorService: tenant_id=287 라우팅 추가
- kd_price_tables 마이그레이션 및 시더 (47건 단가 데이터)

테스트 결과: W0=3000, H0=2500 입력 시 16개 항목, 합계 751,200원 정상 계산

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 01:10:42 +09:00
parent e9894fef61
commit 3fce54b7d4
6 changed files with 2013 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* 경동기업 전용 단가 테이블
*
* 5130 레거시 시스템의 price_* 테이블 데이터를 저장
* - price_motor: 모터/제어기 단가
* - price_shaft: 샤프트 계산 참조
* - price_pipe: 파이프 계산 참조
* - price_angle: 앵글 계산 참조
* - price_raw_materials: 원자재 단가
*/
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('kd_price_tables', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->default(287)->comment('경동기업 테넌트 ID');
$table->string('table_type', 50)->comment('테이블 유형: motor, shaft, pipe, angle, raw_material, bdmodels');
$table->string('item_code', 100)->nullable()->comment('품목 코드 (연동용)');
$table->string('item_name', 200)->nullable()->comment('품목명');
// 조회 조건 필드들
$table->string('category', 100)->nullable()->comment('분류 (모터용량, 재질, 타입 등)');
$table->string('spec1', 100)->nullable()->comment('규격1 (사이즈, 두께 등)');
$table->string('spec2', 100)->nullable()->comment('규격2 (길이, 브라켓크기 등)');
$table->string('spec3', 100)->nullable()->comment('규격3 (추가 조건)');
// 단가 정보
$table->decimal('unit_price', 15, 2)->default(0)->comment('단가');
$table->string('unit', 20)->default('EA')->comment('단위');
// 원본 JSON 데이터 (레거시 호환용)
$table->json('raw_data')->nullable()->comment('원본 JSON 데이터');
// 메타 정보
$table->boolean('is_active')->default(true)->comment('활성 여부');
$table->timestamps();
// 인덱스
$table->index(['tenant_id', 'table_type']);
$table->index(['table_type', 'category']);
$table->index(['table_type', 'spec1', 'spec2']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('kd_price_tables');
}
};