refactor: prices.item_type_code 통합 및 하드코딩 제거
- 레거시 PRODUCT/MATERIAL 값을 실제 item_type(FG, PT 등)으로 마이그레이션 - Price 모델에서 하드코딩된 ITEM_TYPE_* 상수 제거 - PricingService.getCost()에서 하드코딩된 자재 유형 배열을 common_codes.attributes.is_material 플래그 조회로 변경 - common_codes item_type 그룹에 is_material 플래그 추가 - FG, PT: is_material = false (제품) - SM, RM, CS: is_material = true (자재) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -385,8 +385,15 @@ public function getCost(array $params): array
|
||||
'price_id' => null,
|
||||
];
|
||||
|
||||
// 1순위: 자재인 경우 수입검사 입고단가 조회
|
||||
if ($itemType === 'MATERIAL') {
|
||||
// 1순위: 자재(is_material = true)인 경우 수입검사 입고단가 조회
|
||||
// common_codes의 attributes.is_material 플래그로 자재 여부 판단
|
||||
$isMaterial = DB::table('common_codes')
|
||||
->where('code_group', 'item_type')
|
||||
->where('code', $itemType)
|
||||
->whereJsonContains('attributes->is_material', true)
|
||||
->exists();
|
||||
|
||||
if ($isMaterial) {
|
||||
$receipt = MaterialReceipt::query()
|
||||
->where('material_id', $itemId)
|
||||
->where('receipt_date', '<=', $date)
|
||||
|
||||
Reference in New Issue
Block a user