feat(재고): stock_transactions 입출고 거래 이력 테이블 추가

- stock_transactions 마이그레이션 생성 (type, qty, balance_qty, reference)
- StockTransaction 모델 (IN/OUT/RESERVE/RELEASE 타입, 사유 상수)
- StockService 5개 메서드에 거래 이력 기록 추가
  - increaseFromReceiving → IN
  - decreaseFIFO → OUT (LOT별)
  - reserve → RESERVE (LOT별)
  - releaseReservation → RELEASE (LOT별)
  - decreaseForShipment → OUT (LOT별)
- Stock 모델에 transactions() 관계 추가
- 기존 audit_logs 기록은 유지 (감사 로그와 거래 이력 목적 분리)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-29 15:05:03 +09:00
parent 847717e631
commit f7ad9ae36e
4 changed files with 317 additions and 5 deletions

View File

@@ -82,6 +82,14 @@ public function lots(): HasMany
return $this->hasMany(StockLot::class)->orderBy('fifo_order');
}
/**
* 거래 이력 관계
*/
public function transactions(): HasMany
{
return $this->hasMany(StockTransaction::class)->orderByDesc('created_at');
}
/**
* 생성자 관계
*/