feat(malaysia): BOM 없는 세트 있어도 재고조사 확정 허용(경고만)
- finalize_stocktake 의 missing_bom 하드 차단 제거 → 확정/저장 진행 - BOM 없는 세트는 낱개로 분해되지 않고 0 반영, 경고 로그만 남김 - 세트 BOM 분리는 itemcode_db(set_components) 권한이 정상일 때 자동 적용 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import logging
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -24,6 +25,8 @@ from app.timezone import KST, now_kst
|
|||||||
|
|
||||||
from . import store
|
from . import store
|
||||||
|
|
||||||
|
logger = logging.getLogger("malaysia.db")
|
||||||
|
|
||||||
|
|
||||||
class MalaysiaStockStore:
|
class MalaysiaStockStore:
|
||||||
def __init__(self, dsn: str, *, min_size: int = 1, max_size: int = 5):
|
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 저장
|
- 차이 = total_qty - current_system_qty → qty 부호 그대로 STOCKTAKE 저장
|
||||||
- movement 이력이 남고, 현재고 계산은 단순 합산으로 유지된다.
|
- movement 이력이 남고, 현재고 계산은 단순 합산으로 유지된다.
|
||||||
- BOM 없는 MY- 세트가 있으면 확정 거부(요구사항 8).
|
- BOM 없는 MY- 세트는 확정을 막지 않는다(경고만). 해당 세트는 낱개로
|
||||||
|
분해되지 않아 낱개 재고에 0 으로 반영된다. BOM 은 itemcode_db
|
||||||
|
(set_components)에서 등록해야 분해가 적용된다.
|
||||||
반환: {"stocktake": {...}, "adjustments": [{item_code, before, after, diff}], "rows": [...]}
|
반환: {"stocktake": {...}, "adjustments": [{item_code, before, after, diff}], "rows": [...]}
|
||||||
"""
|
"""
|
||||||
computed = self.compute_result(stocktake_id=stocktake_id, bom_map=bom_map)
|
computed = self.compute_result(stocktake_id=stocktake_id, bom_map=bom_map)
|
||||||
@@ -825,9 +830,10 @@ class MalaysiaStockStore:
|
|||||||
if head["status"] != "draft":
|
if head["status"] != "draft":
|
||||||
raise ValueError("이미 확정/취소된 재고조사입니다.")
|
raise ValueError("이미 확정/취소된 재고조사입니다.")
|
||||||
if computed["missing_bom"]:
|
if computed["missing_bom"]:
|
||||||
raise ValueError(
|
logger.warning(
|
||||||
"BOM 구성이 없는 세트가 있어 확정할 수 없습니다: "
|
"재고조사 #%s 확정 — BOM 없는 세트 무시(낱개 0 반영): %s",
|
||||||
+ ", ".join(computed["missing_bom"])
|
stocktake_id,
|
||||||
|
", ".join(computed["missing_bom"]),
|
||||||
)
|
)
|
||||||
wh = head["warehouse_code"]
|
wh = head["warehouse_code"]
|
||||||
st_date = head["stocktake_date"]
|
st_date = head["stocktake_date"]
|
||||||
|
|||||||
Reference in New Issue
Block a user