fix(WEB): 수주 페이지 필드 매핑 및 제품-부품 트리 구조 개선
- ApiClient 인터페이스: representative → manager_name, contact_person 변경 - transformApiToFrontend: client.representative → client.manager_name 수정 - ApiOrderItem에 floor_code, symbol_code 필드 추가 (제품-부품 매핑) - ApiOrder에 options 타입 정의 추가 - ApiQuote에 calculation_inputs 타입 정의 추가 - 수주 상세 페이지 제품-부품 트리 구조 UI 개선
This commit is contained in:
@@ -17,55 +17,59 @@
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// 1. work_order_items
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_items_tenant');
|
||||
});
|
||||
// 1. work_order_items (이미 존재하면 건너뜀)
|
||||
if (! Schema::hasColumn('work_order_items', 'tenant_id')) {
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_items_tenant');
|
||||
});
|
||||
|
||||
// 기존 데이터 업데이트
|
||||
DB::statement('
|
||||
UPDATE work_order_items wi
|
||||
JOIN work_orders wo ON wi.work_order_id = wo.id
|
||||
SET wi.tenant_id = wo.tenant_id
|
||||
');
|
||||
DB::statement('
|
||||
UPDATE work_order_items wi
|
||||
JOIN work_orders wo ON wi.work_order_id = wo.id
|
||||
SET wi.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
// nullable 제거
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
// 2. work_order_bending_details
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_bending_details_tenant');
|
||||
});
|
||||
// 2. work_order_bending_details (이미 존재하면 건너뜀)
|
||||
if (! Schema::hasColumn('work_order_bending_details', 'tenant_id')) {
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_bending_details_tenant');
|
||||
});
|
||||
|
||||
DB::statement('
|
||||
UPDATE work_order_bending_details wbd
|
||||
JOIN work_orders wo ON wbd.work_order_id = wo.id
|
||||
SET wbd.tenant_id = wo.tenant_id
|
||||
');
|
||||
DB::statement('
|
||||
UPDATE work_order_bending_details wbd
|
||||
JOIN work_orders wo ON wbd.work_order_id = wo.id
|
||||
SET wbd.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
// 3. work_order_issues
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_issues_tenant');
|
||||
});
|
||||
// 3. work_order_issues (이미 존재하면 건너뜀)
|
||||
if (! Schema::hasColumn('work_order_issues', 'tenant_id')) {
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_issues_tenant');
|
||||
});
|
||||
|
||||
DB::statement('
|
||||
UPDATE work_order_issues woi
|
||||
JOIN work_orders wo ON woi.work_order_id = wo.id
|
||||
SET woi.tenant_id = wo.tenant_id
|
||||
');
|
||||
DB::statement('
|
||||
UPDATE work_order_issues woi
|
||||
JOIN work_orders wo ON woi.work_order_id = wo.id
|
||||
SET woi.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('work_order_assignees')) {
|
||||
return; // 이미 존재하면 건너뜀
|
||||
}
|
||||
|
||||
Schema::create('work_order_assignees', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
|
||||
@@ -21,11 +21,16 @@
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 이미 마이그레이션이 완료된 경우 (process_type이 없고 process_id가 있음) 건너뜀
|
||||
if (! Schema::hasColumn('work_orders', 'process_type') && Schema::hasColumn('work_orders', 'process_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 절곡 공정이 없으면 각 테넌트별로 생성
|
||||
$this->ensureBendingProcessExists();
|
||||
|
||||
// 2. process_id 컬럼 추가 (이미 존재하면 스킵)
|
||||
if (!Schema::hasColumn('work_orders', 'process_id')) {
|
||||
if (! Schema::hasColumn('work_orders', 'process_id')) {
|
||||
Schema::table('work_orders', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('process_id')
|
||||
->nullable()
|
||||
@@ -46,7 +51,7 @@ public function up(): void
|
||||
AND REFERENCED_TABLE_NAME IS NOT NULL
|
||||
")[0]->cnt > 0;
|
||||
|
||||
if (!$hasFk) {
|
||||
if (! $hasFk) {
|
||||
Schema::table('work_orders', function (Blueprint $table) {
|
||||
$table->foreign('process_id')
|
||||
->references('id')
|
||||
|
||||
@@ -21,4 +21,4 @@ public function down(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE clients CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -25,4 +25,4 @@ public function down(): void
|
||||
$table->dropColumn('priority');
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,4 +26,4 @@ public function down(): void
|
||||
$table->dropColumn('source_order_item_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -78,4 +78,4 @@ public function down(): void
|
||||
->whereIn('code_group', $codeGroups)
|
||||
->delete();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -26,4 +26,3 @@ public function down(): void
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user