fix: 입고 생성 시 balance_qty(잔량) 자동 계산 추가
- 발주 수량에서 기존 입고수량과 신규 입고수량을 차감하여 잔량 업데이트 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -286,6 +286,11 @@ export async function create(req: AuthenticatedRequest, res: Response) {
|
||||
received_qty = CAST(
|
||||
COALESCE(CAST(NULLIF(received_qty, '') AS numeric), 0) + $1 AS text
|
||||
),
|
||||
balance_qty = CAST(
|
||||
COALESCE(CAST(NULLIF(order_qty, '') AS numeric), 0)
|
||||
- COALESCE(CAST(NULLIF(received_qty, '') AS numeric), 0)
|
||||
- $1 AS text
|
||||
),
|
||||
updated_date = NOW()
|
||||
WHERE id = $2 AND company_code = $3`,
|
||||
[item.inbound_qty || 0, item.source_id, companyCode]
|
||||
|
||||
Reference in New Issue
Block a user