From 765d3ba9859b76b32c792671e201aefd0b7799c5 Mon Sep 17 00:00:00 2001 From: king Date: Tue, 16 Jun 2026 11:12:13 +0900 Subject: [PATCH] =?UTF-8?q?feat(malaysia):=20BOM=20=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=EC=84=B8=ED=8A=B8=20=EC=9E=88=EC=96=B4=EB=8F=84=20=EC=9E=AC?= =?UTF-8?q?=EA=B3=A0=EC=A1=B0=EC=82=AC=20=ED=99=95=EC=A0=95=20=ED=97=88?= =?UTF-8?q?=EC=9A=A9(=EA=B2=BD=EA=B3=A0=EB=A7=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - finalize_stocktake 의 missing_bom 하드 차단 제거 → 확정/저장 진행 - BOM 없는 세트는 낱개로 분해되지 않고 0 반영, 경고 로그만 남김 - 세트 BOM 분리는 itemcode_db(set_components) 권한이 정상일 때 자동 적용 Co-Authored-By: Claude Opus 4.8 --- app/modules/malaysia/db.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/modules/malaysia/db.py b/app/modules/malaysia/db.py index 53140ed..981563f 100644 --- a/app/modules/malaysia/db.py +++ b/app/modules/malaysia/db.py @@ -14,6 +14,7 @@ from __future__ import annotations +import logging from datetime import date, datetime from typing import Any @@ -24,6 +25,8 @@ from app.timezone import KST, now_kst from . import store +logger = logging.getLogger("malaysia.db") + class MalaysiaStockStore: def __init__(self, dsn: str, *, min_size: int = 1, max_size: int = 5): @@ -817,7 +820,9 @@ class MalaysiaStockStore: - 차이 = total_qty - current_system_qty → qty 부호 그대로 STOCKTAKE 저장 - movement 이력이 남고, 현재고 계산은 단순 합산으로 유지된다. - - BOM 없는 MY- 세트가 있으면 확정 거부(요구사항 8). + - BOM 없는 MY- 세트는 확정을 막지 않는다(경고만). 해당 세트는 낱개로 + 분해되지 않아 낱개 재고에 0 으로 반영된다. BOM 은 itemcode_db + (set_components)에서 등록해야 분해가 적용된다. 반환: {"stocktake": {...}, "adjustments": [{item_code, before, after, diff}], "rows": [...]} """ computed = self.compute_result(stocktake_id=stocktake_id, bom_map=bom_map) @@ -825,9 +830,10 @@ class MalaysiaStockStore: if head["status"] != "draft": raise ValueError("이미 확정/취소된 재고조사입니다.") if computed["missing_bom"]: - raise ValueError( - "BOM 구성이 없는 세트가 있어 확정할 수 없습니다: " - + ", ".join(computed["missing_bom"]) + logger.warning( + "재고조사 #%s 확정 — BOM 없는 세트 무시(낱개 0 반영): %s", + stocktake_id, + ", ".join(computed["missing_bom"]), ) wh = head["warehouse_code"] st_date = head["stocktake_date"]