From fb3ecff02dac7bc58279d1fc20a89db32f6df6cd Mon Sep 17 00:00:00 2001 From: SeongHyun Kim Date: Mon, 6 Apr 2026 15:29:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20newTotalInput=20=EB=B3=80=EC=88=98=20?= =?UTF-8?q?=EC=8A=A4=EC=BD=94=ED=94=84=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/popProductionController.ts | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/backend-node/src/controllers/popProductionController.ts b/backend-node/src/controllers/popProductionController.ts index 7cb73740..fc740529 100644 --- a/backend-node/src/controllers/popProductionController.ts +++ b/backend-node/src/controllers/popProductionController.ts @@ -1859,22 +1859,23 @@ export const acceptProcess = async (req: AuthenticatedRequest, res: Response) => ); // 마스터 행의 input_qty를 분할 합계로 갱신 (리워크 접수 시에는 마스터 input_qty 변경 안 함) + let newTotalInput = currentTotalInput + qty; if (!isRework) { - const newTotalInput = currentTotalInput + qty; await client.query( `UPDATE work_order_process SET input_qty = $3, updated_date = NOW() WHERE id = $1 AND company_code = $2`, [masterId, companyCode, String(newTotalInput)] ); - } - - // 리워크 카드: 전량 접수 시 status를 in_progress로 변경 (추가 접수 방지) - if (isRework && qty >= reworkInputQty) { - await client.query( - `UPDATE work_order_process SET status = 'in_progress', updated_date = NOW() - WHERE id = $1 AND company_code = $2`, - [work_order_process_id, companyCode] - ); + } else { + newTotalInput = currentTotalInput; // 리워크는 기존 합계 유지 + // 리워크 카드: 전량 접수 시 status를 in_progress로 변경 (추가 접수 방지) + if (qty >= reworkInputQty) { + await client.query( + `UPDATE work_order_process SET status = 'in_progress', updated_date = NOW() + WHERE id = $1 AND company_code = $2`, + [work_order_process_id, companyCode] + ); + } } await client.query("COMMIT");