feat:테넌트설정 API 및 다수 서비스 개선

- TenantSetting CRUD API 추가
- Calendar, Entertainment, VAT 서비스 개선
- 5130 BOM 계산 로직 수정
- quote_items에 item_type 컬럼 추가
- tenant_settings 테이블 마이그레이션
- Swagger 문서 업데이트
This commit is contained in:
2026-01-26 20:29:22 +09:00
parent f2da990771
commit 6d05ab815f
54 changed files with 2090 additions and 110 deletions

View File

@@ -47,4 +47,4 @@ public function down(): void
{
Schema::dropIfExists('schedules');
}
};
};

View File

@@ -58,4 +58,4 @@ public function down(): void
{
Schema::dropIfExists('expense_accounts');
}
};
};

View File

@@ -37,4 +37,4 @@ public function down(): void
$table->dropColumn(['order_id', 'shipment_id', 'source_type']);
});
}
};
};

View File

@@ -41,4 +41,4 @@ public function down(): void
{
DB::table('common_codes')->where('code_group', 'delivery_method')->delete();
}
};
};

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* quote_items 테이블에 item_type 컬럼 추가
* - item_type: RM(원자재), SM(부자재), CS(소모품), FG(완제품), PT(부품)
* - 기존 데이터는 items 테이블에서 조회하여 업데이트
*/
return new class extends Migration
{
public function up(): void
{
Schema::table('quote_items', function (Blueprint $table) {
$table->string('item_type', 15)->nullable()->after('item_id')
->comment('품목 유형: FG, PT, SM, RM, CS');
});
// 기존 데이터 업데이트: items 테이블에서 item_type 가져오기
DB::statement('
UPDATE quote_items qi
INNER JOIN items i ON qi.item_id = i.id
SET qi.item_type = i.item_type
WHERE qi.item_id IS NOT NULL
');
}
public function down(): void
{
Schema::table('quote_items', function (Blueprint $table) {
$table->dropColumn('item_type');
});
}
};

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* 테넌트별 설정 테이블
*
* Key-Value 형태로 테넌트별 다양한 설정 저장
* - stock_item_types: 재고관리 대상 품목유형
* - default_safety_stock: 기본 안전재고
* - low_stock_alert: 재고부족 알림 설정
* 등
*/
return new class extends Migration
{
public function up(): void
{
Schema::create('tenant_settings', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->string('setting_group', 50)->comment('설정 그룹 (stock, order, production 등)');
$table->string('setting_key', 100)->comment('설정 키');
$table->json('setting_value')->nullable()->comment('설정 값 (JSON)');
$table->string('description')->nullable()->comment('설정 설명');
$table->timestamps();
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자 ID');
// 인덱스
$table->unique(['tenant_id', 'setting_group', 'setting_key'], 'tenant_settings_unique');
$table->index(['tenant_id', 'setting_group'], 'tenant_settings_group_idx');
});
}
public function down(): void
{
Schema::dropIfExists('tenant_settings');
}
};