fix: [dashboard] 생산현황 shipments.shipping_cost 컬럼 미존재 에러 수정
- shipments 테이블에 shipping_cost 컬럼이 없어서 500 에러 발생 - 컬럼 추가 전까지 금액 0 고정, 건수만 집계 - TODO: shipping_cost 컬럼 추가 시 금액 집계 복원 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -467,12 +467,15 @@ private function getShipmentSummary(int $tenantId, string $today): array
|
||||
$monthEnd = $thisMonth->copy()->endOfMonth()->format('Y-m-d');
|
||||
|
||||
// 예정 출고
|
||||
// NOTE: shipments 테이블에 shipping_cost 컬럼이 아직 없음 (2026-03-19)
|
||||
// 금액 집계는 컬럼 추가 + 입력 UI 반영 후 활성화 예정
|
||||
// TODO: shipping_cost 컬럼 추가 시 → selectRaw에 SUM(shipping_cost) 복원
|
||||
$expected = DB::table('shipments')
|
||||
->where('tenant_id', $tenantId)
|
||||
->whereBetween('scheduled_date', [$monthStart, $monthEnd])
|
||||
->whereIn('status', ['scheduled', 'ready'])
|
||||
->whereNull('deleted_at')
|
||||
->selectRaw('COUNT(*) as count, COALESCE(SUM(shipping_cost), 0) as amount')
|
||||
->selectRaw('COUNT(*) as count')
|
||||
->first();
|
||||
|
||||
// 실제 출고
|
||||
@@ -481,13 +484,13 @@ private function getShipmentSummary(int $tenantId, string $today): array
|
||||
->whereBetween('scheduled_date', [$monthStart, $monthEnd])
|
||||
->whereIn('status', ['shipping', 'completed'])
|
||||
->whereNull('deleted_at')
|
||||
->selectRaw('COUNT(*) as count, COALESCE(SUM(shipping_cost), 0) as amount')
|
||||
->selectRaw('COUNT(*) as count')
|
||||
->first();
|
||||
|
||||
return [
|
||||
'expected_amount' => (int) ($expected->amount ?? 0),
|
||||
'expected_amount' => 0, // shipping_cost 컬럼 추가 전까지 0 고정
|
||||
'expected_count' => (int) ($expected->count ?? 0),
|
||||
'actual_amount' => (int) ($actual->amount ?? 0),
|
||||
'actual_amount' => 0, // shipping_cost 컬럼 추가 전까지 0 고정
|
||||
'actual_count' => (int) ($actual->count ?? 0),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user