feat:개소별 자재 투입 관리 API 추가

- work_order_material_inputs 테이블 신규 생성 (개소별 자재 투입 추적)
- 개소별 자재 조회/투입/이력/삭제/수정 API 5개 추가
- StockService.increaseToLot: LOT 수량 복원 메서드 추가
- WorkOrderService에 개소별 자재 투입 비즈니스 로직 구현
- WorkOrder, WorkOrderItem 모델에 materialInputs 관계 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 03:41:35 +09:00
parent d730c2d91a
commit e4c53c7b17
9 changed files with 872 additions and 70 deletions

View File

@@ -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::create('work_order_material_inputs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->foreignId('work_order_id')->constrained('work_orders')->cascadeOnDelete()->comment('작업지시 ID');
$table->foreignId('work_order_item_id')->constrained('work_order_items')->cascadeOnDelete()->comment('개소(작업지시품목) ID');
$table->unsignedBigInteger('stock_lot_id')->comment('투입 로트 ID');
$table->unsignedBigInteger('item_id')->comment('자재 품목 ID');
$table->decimal('qty', 12, 3)->comment('투입 수량');
$table->unsignedBigInteger('input_by')->nullable()->comment('투입자 ID');
$table->timestamp('input_at')->useCurrent()->comment('투입 시각');
$table->timestamps();
// 인덱스
$table->index('tenant_id', 'idx_womi_tenant');
$table->index(['work_order_id', 'work_order_item_id'], 'idx_womi_wo_item');
$table->index('stock_lot_id', 'idx_womi_lot');
});
}
public function down(): void
{
Schema::dropIfExists('work_order_material_inputs');
}
};