From 2fd122feba6ed39da6473e9d1f50dcf6b1f2432a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 3 Mar 2026 15:57:19 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[ai-quotation]=20=EC=A0=9C=EC=A1=B0=20?= =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EB=A7=88=EC=9D=B4=EA=B7=B8?= =?UTF-8?q?=EB=A0=88=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ai_quotations: quote_mode, quote_number, product_category 컬럼 추가 - ai_quotation_items: specification, unit, quantity, unit_price, total_price, item_category, floor_code 컬럼 추가 - ai_quote_price_tables 테이블 신규 생성 --- ...dd_manufacture_fields_to_ai_quotations.php | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 database/migrations/2026_03_03_200000_add_manufacture_fields_to_ai_quotations.php diff --git a/database/migrations/2026_03_03_200000_add_manufacture_fields_to_ai_quotations.php b/database/migrations/2026_03_03_200000_add_manufacture_fields_to_ai_quotations.php new file mode 100644 index 0000000..b190bce --- /dev/null +++ b/database/migrations/2026_03_03_200000_add_manufacture_fields_to_ai_quotations.php @@ -0,0 +1,79 @@ +string('quote_mode', 20)->default('module')->after('tenant_id') + ->comment('견적 모드: module(모듈추천), manufacture(제조견적)'); + $table->string('quote_number', 50)->nullable()->after('quote_mode') + ->comment('견적번호: AQ-SC-260303-01'); + $table->string('product_category', 50)->nullable()->after('quote_number') + ->comment('제품 카테고리: SCREEN, STEEL'); + + $table->index('quote_mode'); + $table->index('quote_number'); + }); + + // ai_quotation_items 테이블: 제조 견적 품목 필드 추가 + Schema::table('ai_quotation_items', function (Blueprint $table) { + $table->string('specification', 200)->nullable()->after('module_name') + ->comment('규격: 3000×2500'); + $table->string('unit', 20)->nullable()->after('specification') + ->comment('단위: SET, EA, ㎡'); + $table->decimal('quantity', 10, 2)->default(1)->after('unit') + ->comment('수량'); + $table->decimal('unit_price', 15, 2)->default(0)->after('quantity') + ->comment('단가'); + $table->decimal('total_price', 15, 2)->default(0)->after('unit_price') + ->comment('금액 (수량×단가)'); + $table->string('item_category', 50)->nullable()->after('total_price') + ->comment('품목 분류: material, labor, install, etc.'); + $table->string('floor_code', 50)->nullable()->after('item_category') + ->comment('위치 코드: B1-A01, 1F-C01'); + }); + + // ai_quote_price_tables: AI 견적용 단가표 (신규) + Schema::create('ai_quote_price_tables', function (Blueprint $table) { + $table->id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('product_category', 50)->comment('SCREEN, STEEL'); + $table->string('price_type', 50)->comment('area_based, weight_based, fixed'); + $table->decimal('min_value', 12, 4)->default(0)->comment('면적/중량 최소'); + $table->decimal('max_value', 12, 4)->default(0)->comment('면적/중량 최대'); + $table->decimal('unit_price', 15, 2)->default(0)->comment('해당 구간 단가'); + $table->decimal('labor_rate', 5, 2)->default(0)->comment('노무비율 (%)'); + $table->decimal('install_rate', 5, 2)->default(0)->comment('설치비율 (%)'); + $table->boolean('is_active')->default(true); + $table->json('options')->nullable(); + $table->timestamps(); + + $table->index('tenant_id'); + $table->index(['product_category', 'price_type']); + }); + } + + public function down(): void + { + Schema::dropIfExists('ai_quote_price_tables'); + + Schema::table('ai_quotation_items', function (Blueprint $table) { + $table->dropColumn([ + 'specification', 'unit', 'quantity', 'unit_price', + 'total_price', 'item_category', 'floor_code', + ]); + }); + + Schema::table('ai_quotations', function (Blueprint $table) { + $table->dropIndex(['quote_mode']); + $table->dropIndex(['quote_number']); + $table->dropColumn(['quote_mode', 'quote_number', 'product_category']); + }); + } +};