feat: [품질관리] 품질관리서/실적신고/검사 API
- QualityDocument CRUD + 수주 연결 + 개소별 데이터 저장 - PerformanceReport 실적신고 확인/메모 API - Inspection 검사 설정 + product_code 전파 수정 - 수주선택 API에 client_name 필드 추가 - 절곡 검사 프로파일 분리 (S1/S2/S3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('inspections', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('work_order_id')
|
||||
->nullable()
|
||||
->after('lot_no')
|
||||
->comment('작업지시 ID (PQC/FQC용)');
|
||||
|
||||
$table->foreign('work_order_id')
|
||||
->references('id')
|
||||
->on('work_orders')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->index('work_order_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('inspections', function (Blueprint $table) {
|
||||
$table->dropForeign(['work_order_id']);
|
||||
$table->dropIndex(['work_order_id']);
|
||||
$table->dropColumn('work_order_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('quality_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained();
|
||||
$table->string('quality_doc_number', 30)->comment('품질관리서 번호');
|
||||
$table->string('site_name')->comment('현장명');
|
||||
$table->string('status', 20)->default('received')->comment('received/in_progress/completed');
|
||||
$table->foreignId('client_id')->nullable()->constrained('clients')->comment('수주처');
|
||||
$table->foreignId('inspector_id')->nullable()->constrained('users')->comment('검사자');
|
||||
$table->date('received_date')->nullable()->comment('접수일');
|
||||
$table->json('options')->nullable()->comment('관련자정보, 검사정보, 현장주소 등');
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'quality_doc_number']);
|
||||
$table->index(['tenant_id', 'status']);
|
||||
$table->index(['tenant_id', 'client_id']);
|
||||
$table->index(['tenant_id', 'inspector_id']);
|
||||
$table->index(['tenant_id', 'received_date']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('quality_documents');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('quality_document_orders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('quality_document_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('order_id')->constrained('orders');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['quality_document_id', 'order_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('quality_document_orders');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('quality_document_locations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('quality_document_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('quality_document_order_id')->constrained('quality_document_orders', 'id', 'qdl_qdo_id_fk')->cascadeOnDelete();
|
||||
$table->foreignId('order_item_id')->constrained('order_items');
|
||||
$table->integer('post_width')->nullable()->comment('시공후 가로');
|
||||
$table->integer('post_height')->nullable()->comment('시공후 세로');
|
||||
$table->string('change_reason')->nullable()->comment('규격 변경사유');
|
||||
$table->foreignId('document_id')->nullable()->comment('검사성적서 문서 ID');
|
||||
$table->string('inspection_status', 20)->default('pending')->comment('pending/completed');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['quality_document_id', 'inspection_status'], 'qdl_doc_id_status_index');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('quality_document_locations');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('performance_reports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained();
|
||||
$table->foreignId('quality_document_id')->constrained();
|
||||
$table->unsignedSmallInteger('year')->comment('연도');
|
||||
$table->unsignedTinyInteger('quarter')->comment('분기 1-4');
|
||||
$table->string('confirmation_status', 20)->default('unconfirmed')->comment('unconfirmed/confirmed/reported');
|
||||
$table->date('confirmed_date')->nullable();
|
||||
$table->foreignId('confirmed_by')->nullable()->constrained('users');
|
||||
$table->text('memo')->nullable();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['tenant_id', 'quality_document_id']);
|
||||
$table->index(['tenant_id', 'year', 'quarter']);
|
||||
$table->index(['tenant_id', 'confirmation_status']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('performance_reports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('quality_document_locations', function (Blueprint $table) {
|
||||
$table->json('inspection_data')->nullable()->after('change_reason')->comment('검사 데이터 JSON');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('quality_document_locations', function (Blueprint $table) {
|
||||
$table->dropColumn('inspection_data');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user