feat: 견적확정 밸리데이션, 작업지시 통계 공정별 카운트, 입고/재고 개선

- 견적확정 시 업체명/현장명/담당자/연락처 필수 검증 추가 (QuoteService)
- 작업지시 stats API에 by_process 공정별 카운트 반환 추가
- 작업지시 목록/상세 쿼리에 수주 개소(rootNodes) 연관 로딩
- 작업지시 품목에 sourceOrderItem.node 관계 추가
- 입고관리 완료건 수정 허용 및 재고 차이 조정
- work_order_step_progress 테이블 마이그레이션
- receivings 테이블 options 컬럼 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 03:27:07 +09:00
parent 6b3e5c3e87
commit 487e651845
22 changed files with 1422 additions and 72 deletions

View File

@@ -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
{
/**
* Run the migrations.
*
* options JSON 구조 예시:
* {
* "manufacturer": "포스코", // 제조사
* "inspection_status": "적", // 수입검사 (적/부적/-)
* "inspection_date": "2026-02-05", // 검사일
* "inspection_result": "합격", // 검사결과
* ... 추가 확장 필드
* }
*/
public function up(): void
{
Schema::table('receivings', function (Blueprint $table) {
$table->json('options')->nullable()->after('remark')->comment('확장 필드 (제조사, 수입검사 등)');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('receivings', function (Blueprint $table) {
$table->dropColumn('options');
});
}
};

View File

@@ -0,0 +1,33 @@
<?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('work_order_step_progress', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->foreignId('work_order_id')->constrained('work_orders')->cascadeOnDelete()->comment('작업지시 ID');
$table->foreignId('process_step_id')->constrained('process_steps')->cascadeOnDelete()->comment('공정 단계 ID');
$table->unsignedBigInteger('work_order_item_id')->nullable()->comment('작업지시 품목 ID (특정 품목 연결 시)');
$table->string('status', 20)->default('waiting')->comment('상태: waiting/in_progress/completed');
$table->timestamp('completed_at')->nullable()->comment('완료 일시');
$table->unsignedBigInteger('completed_by')->nullable()->comment('완료 처리자 ID');
$table->timestamps();
// 인덱스
$table->unique(['work_order_id', 'process_step_id', 'work_order_item_id'], 'uq_wo_step_progress');
$table->index(['tenant_id', 'work_order_id'], 'idx_wo_step_tenant');
$table->index(['work_order_id', 'status'], 'idx_wo_step_status');
});
}
public function down(): void
{
Schema::dropIfExists('work_order_step_progress');
}
};