From 0aec60f3d950ba62bf536055e579c0b4b4f98615 Mon Sep 17 00:00:00 2001 From: kmh Date: Tue, 31 Mar 2026 13:37:33 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9E=85=EA=B3=A0=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EC=8B=9C=20balance=5Fqty(=EC=9E=94=EB=9F=89)=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EA=B3=84=EC=82=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 발주 수량에서 기존 입고수량과 신규 입고수량을 차감하여 잔량 업데이트 Co-Authored-By: Claude Opus 4.6 (1M context) --- backend-node/src/controllers/receivingController.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend-node/src/controllers/receivingController.ts b/backend-node/src/controllers/receivingController.ts index 3a1aeec4..400538cc 100644 --- a/backend-node/src/controllers/receivingController.ts +++ b/backend-node/src/controllers/receivingController.ts @@ -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]