diff --git a/app/Http/Controllers/Api/V1/ReceivingController.php b/app/Http/Controllers/Api/V1/ReceivingController.php index 80fbccdb..7a08e63b 100644 --- a/app/Http/Controllers/Api/V1/ReceivingController.php +++ b/app/Http/Controllers/Api/V1/ReceivingController.php @@ -303,8 +303,8 @@ public function forceCreate(Request $request) */ private function createStockAndLot(Item $item, int $tenantId, int $qty, int $userId, string $date, string $lotNo, Receiving $receiving, string $orderNo, string $supplier): Stock { - $itemTypeMap = ['FG' => 'purchased_part', 'PT' => 'bent_part', 'SM' => 'sub_material', 'RM' => 'raw_material', 'CS' => 'consumable']; - $stockType = $itemTypeMap[$item->item_type] ?? 'raw_material'; + // items.item_type 코드(FG/PT/SM/RM/CS)를 그대로 사용 (common_codes 매핑과 일치) + $stockType = $item->item_type ?: 'RM'; $stock = Stock::withoutGlobalScopes() ->where('tenant_id', $tenantId)