feat(malaysia): 이동 이력에 낱개/콤보 분리 표시
- set_movement(콤보 출고 원장)을 이동이력에 병합, 구분 컬럼(낱개/콤보) 추가 - db.list_set_movements (동일 필터: 창고/종류/날짜) - 콤보 줄은 set_code 를 Item 으로 표시 → 콤보 몇 개 나갔는지 확인 가능 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -268,12 +268,26 @@ async def movements_page(request: Request) -> HTMLResponse:
|
||||
wh = _selected_wh(request, st)
|
||||
mtype = (request.query_params.get("type") or "").strip().upper()
|
||||
fdate = (request.query_params.get("date") or "").strip()
|
||||
movements = st.list_movements(
|
||||
warehouse_code=wh,
|
||||
movement_type=mtype if mtype in store.MOVEMENT_TYPES else None,
|
||||
date_from=fdate or None,
|
||||
date_to=fdate or None,
|
||||
limit=300,
|
||||
mt = mtype if mtype in store.MOVEMENT_TYPES else None
|
||||
singles = st.list_movements(
|
||||
warehouse_code=wh, movement_type=mt,
|
||||
date_from=fdate or None, date_to=fdate or None, limit=300,
|
||||
)
|
||||
for m in singles:
|
||||
m["kind"] = "individual"
|
||||
# 콤보(세트) 출고 원장도 함께 보여준다(낱개/콤보 분리 표시).
|
||||
combos = st.list_set_movements(
|
||||
warehouse_code=wh, movement_type=mt,
|
||||
date_from=fdate or None, date_to=fdate or None, limit=300,
|
||||
)
|
||||
for m in combos:
|
||||
m["kind"] = "set"
|
||||
m["item_code"] = m.get("set_code", "")
|
||||
# 날짜(그다음 id) 내림차순 병합.
|
||||
movements = sorted(
|
||||
singles + combos,
|
||||
key=lambda m: (str(m.get("movement_date") or ""), int(m.get("id") or 0)),
|
||||
reverse=True,
|
||||
)
|
||||
for m in movements:
|
||||
m["date_label"] = _date_label(m.get("movement_date"))
|
||||
|
||||
Reference in New Issue
Block a user