feat: G-2 작업실적 관리 API 구현

- WorkResult 모델 생성 (Production 네임스페이스)
- WorkResultService 서비스 구현 (CRUD + 통계 + 토글)
- WorkResultController 컨트롤러 생성 (8개 엔드포인트)
- FormRequest 검증 클래스 (Store/Update)
- Swagger 문서 작성 (WorkResultApi.php)
- 라우트 추가 (/api/v1/work-results)
- i18n 메시지 추가 (work_result 키)

API Endpoints:
- GET /work-results - 목록 조회 (페이징, 필터링)
- GET /work-results/stats - 통계 조회
- GET /work-results/{id} - 상세 조회
- POST /work-results - 등록
- PUT /work-results/{id} - 수정
- DELETE /work-results/{id} - 삭제
- PATCH /work-results/{id}/inspection - 검사 상태 토글
- PATCH /work-results/{id}/packaging - 포장 상태 토글

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-26 15:18:08 +09:00
parent dd0f79b947
commit 84cce6742e
9 changed files with 1154 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('work_results', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->comment('테넌트 ID');
$table->foreignId('work_order_id')->constrained()->comment('작업지시 ID');
$table->foreignId('work_order_item_id')->nullable()->constrained()->comment('작업지시 품목 ID');
$table->string('lot_no', 50)->comment('로트번호');
$table->date('work_date')->comment('작업일');
$table->enum('process_type', ['screen', 'slat', 'bending'])->comment('공정구분');
$table->string('product_name', 200)->comment('품목명');
$table->string('specification', 100)->nullable()->comment('규격');
$table->integer('production_qty')->default(0)->comment('생산수량');
$table->integer('good_qty')->default(0)->comment('양품수량');
$table->integer('defect_qty')->default(0)->comment('불량수량');
$table->decimal('defect_rate', 5, 2)->default(0)->comment('불량률 (%)');
$table->boolean('is_inspected')->default(false)->comment('검사 완료 여부');
$table->boolean('is_packaged')->default(false)->comment('포장 완료 여부');
$table->foreignId('worker_id')->nullable()->constrained('users')->comment('작업자 ID');
$table->text('memo')->nullable()->comment('비고');
$table->foreignId('created_by')->nullable()->constrained('users')->comment('생성자');
$table->foreignId('updated_by')->nullable()->constrained('users')->comment('수정자');
$table->timestamps();
$table->softDeletes();
// 인덱스
$table->index(['tenant_id', 'work_date']);
$table->index(['tenant_id', 'process_type']);
$table->index(['tenant_id', 'work_order_id']);
$table->index('lot_no');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('work_results');
}
};