fix(malaysia): 이동이력 낱개/콤보를 '입력 방식' 기준으로 구분
- 콤보 출고는 콤보 줄(set_movement)로만 표시. 분해된 구성 낱개는 숨김
· create_set_out 구성 낱개 ref_type 을 SET_COMPONENT_REF('set')로 고정
· 이동이력 낱개 목록에서 ref_type=SET_COMPONENT_REF 제외
- 직접 낱개 입력만 '낱개', 콤보 입력만 '콤보'로 표기(재고 계산엔 영향 없음)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -250,6 +250,8 @@ class MalaysiaStockStore:
|
|||||||
with conn.transaction():
|
with conn.transaction():
|
||||||
for comp_code, comp_qty in exploded.items():
|
for comp_code, comp_qty in exploded.items():
|
||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
|
# 구성 낱개는 콤보 분해분 — ref_type 을 SET_COMPONENT_REF 로 고정해
|
||||||
|
# 이동이력에서 '낱개 입력' 줄과 구분(숨김)한다. 재고 계산엔 포함.
|
||||||
"""
|
"""
|
||||||
INSERT INTO stock_movement
|
INSERT INTO stock_movement
|
||||||
(movement_date, warehouse_code, item_code, movement_type,
|
(movement_date, warehouse_code, item_code, movement_type,
|
||||||
@@ -262,7 +264,7 @@ class MalaysiaStockStore:
|
|||||||
warehouse_code.strip(),
|
warehouse_code.strip(),
|
||||||
comp_code,
|
comp_code,
|
||||||
comp_qty,
|
comp_qty,
|
||||||
ref_t,
|
store.SET_COMPONENT_REF,
|
||||||
(ref_no or "").strip(),
|
(ref_no or "").strip(),
|
||||||
(memo or f"{sc} {q}세트 분해").strip(),
|
(memo or f"{sc} {q}세트 분해").strip(),
|
||||||
(created_by or "").lower().strip(),
|
(created_by or "").lower().strip(),
|
||||||
|
|||||||
@@ -269,10 +269,13 @@ async def movements_page(request: Request) -> HTMLResponse:
|
|||||||
mtype = (request.query_params.get("type") or "").strip().upper()
|
mtype = (request.query_params.get("type") or "").strip().upper()
|
||||||
fdate = (request.query_params.get("date") or "").strip()
|
fdate = (request.query_params.get("date") or "").strip()
|
||||||
mt = mtype if mtype in store.MOVEMENT_TYPES else None
|
mt = mtype if mtype in store.MOVEMENT_TYPES else None
|
||||||
singles = st.list_movements(
|
raw_singles = st.list_movements(
|
||||||
warehouse_code=wh, movement_type=mt,
|
warehouse_code=wh, movement_type=mt,
|
||||||
date_from=fdate or None, date_to=fdate or None, limit=300,
|
date_from=fdate or None, date_to=fdate or None, limit=300,
|
||||||
)
|
)
|
||||||
|
# 콤보 분해로 생긴 구성 낱개(ref_type=SET_COMPONENT_REF)는 '낱개 입력'이 아니므로
|
||||||
|
# 이동이력에서 숨긴다. 콤보는 아래 set_movement 줄로 표시된다.
|
||||||
|
singles = [m for m in raw_singles if (m.get("ref_type") or "") != store.SET_COMPONENT_REF]
|
||||||
for m in singles:
|
for m in singles:
|
||||||
m["kind"] = "individual"
|
m["kind"] = "individual"
|
||||||
# 콤보(세트) 출고 원장도 함께 보여준다(낱개/콤보 분리 표시).
|
# 콤보(세트) 출고 원장도 함께 보여준다(낱개/콤보 분리 표시).
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ from typing import Any, Iterable
|
|||||||
# ── 이동(movement) 종류 ──
|
# ── 이동(movement) 종류 ──
|
||||||
MOVEMENT_TYPES: tuple[str, ...] = ("IN", "OUT", "ADJUST", "STOCKTAKE")
|
MOVEMENT_TYPES: tuple[str, ...] = ("IN", "OUT", "ADJUST", "STOCKTAKE")
|
||||||
|
|
||||||
|
# 콤보(세트) 출고를 BOM 분해해 생성한 '구성 낱개' movement 의 ref_type 마커.
|
||||||
|
# 이동이력에서 이 낱개 줄은 콤보 입력의 분해분이므로 '낱개 입력'으로 표시하지
|
||||||
|
# 않고 숨긴다(콤보는 set_movement 줄로 따로 표시). 재고 계산엔 그대로 포함된다.
|
||||||
|
SET_COMPONENT_REF: str = "set"
|
||||||
|
|
||||||
# ── 재고조사 상태 ──
|
# ── 재고조사 상태 ──
|
||||||
STOCKTAKE_STATUSES: tuple[str, ...] = ("draft", "finalized", "cancelled")
|
STOCKTAKE_STATUSES: tuple[str, ...] = ("draft", "finalized", "cancelled")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user