fix: [dev] stocks.item_type을 common_codes 단축코드(PT/RM/SM)로 통일

This commit is contained in:
김보곤
2026-03-22 10:55:42 +09:00
parent d13e8ee5e6
commit f7decfb76e

View File

@@ -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)