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:
@@ -327,6 +327,40 @@ class MalaysiaStockStore:
|
||||
).fetchall()
|
||||
return [self._serialize(r) for r in rows]
|
||||
|
||||
def list_set_movements(
|
||||
self,
|
||||
*,
|
||||
warehouse_code: str | None = None,
|
||||
movement_type: str | None = None,
|
||||
date_from: str | None = None,
|
||||
date_to: str | None = None,
|
||||
limit: int = 500,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""콤보(세트) 출고 원장(set_movement) 목록. 이동이력 콤보 줄 표시용."""
|
||||
clauses: list[str] = []
|
||||
params: list[Any] = []
|
||||
if warehouse_code:
|
||||
clauses.append("warehouse_code = %s")
|
||||
params.append(warehouse_code)
|
||||
if movement_type in store.MOVEMENT_TYPES:
|
||||
clauses.append("movement_type = %s")
|
||||
params.append(movement_type)
|
||||
if date_from:
|
||||
clauses.append("movement_date >= %s")
|
||||
params.append(date_from)
|
||||
if date_to:
|
||||
clauses.append("movement_date <= %s")
|
||||
params.append(date_to)
|
||||
where = ("WHERE " + " AND ".join(clauses)) if clauses else ""
|
||||
params.append(int(limit))
|
||||
with self._pool.connection() as conn:
|
||||
rows = conn.execute(
|
||||
f"SELECT * FROM set_movement {where} "
|
||||
"ORDER BY movement_date DESC, id DESC LIMIT %s",
|
||||
params,
|
||||
).fetchall()
|
||||
return [self._serialize(r) for r in rows]
|
||||
|
||||
def daily_movement_totals(
|
||||
self, *, warehouse_code: str, movement_date: str, movement_type: str
|
||||
) -> dict[str, int]:
|
||||
|
||||
Reference in New Issue
Block a user