ui(malaysia): Qty 150px·name 한줄, 재고조사 3분할, 재고현황 낱개/콤보 2분할
- Qty 컬럼 150px 고정, 상품명 줄바꿈 방지(nowrap) - 콤보 Qty(OUT) 헤더 → Qty - 일일 재고조사 상세 3분할(좌 정보/동작·중 낱개·우 콤보) - 재고현황: 좌 낱개 분해 전체 + 우 콤보(최근 재고조사 세트 수량) - db.latest_set_quantities 추가 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -360,6 +360,40 @@ class MalaysiaStockStore:
|
||||
out.sort(key=lambda x: x["item_code"])
|
||||
return out
|
||||
|
||||
def latest_set_quantities(self, *, warehouse_code: str) -> dict[str, Any]:
|
||||
"""가장 최근(취소 제외) 재고조사에 입력된 콤보(MY-) 수량.
|
||||
|
||||
반환: {"stocktake_date": str|None, "rows": [{set_code,set_name,qty}]}
|
||||
재고현황 우측 패널용 — 세트 단위로 입력된 콤보 재고를 그대로 보여줌.
|
||||
"""
|
||||
with self._pool.connection() as conn:
|
||||
head = conn.execute(
|
||||
"SELECT id, stocktake_date FROM daily_stocktake "
|
||||
"WHERE warehouse_code = %s AND status <> 'cancelled' "
|
||||
"ORDER BY stocktake_date DESC, id DESC LIMIT 1",
|
||||
(warehouse_code,),
|
||||
).fetchone()
|
||||
if not head:
|
||||
return {"stocktake_date": None, "rows": []}
|
||||
lines = conn.execute(
|
||||
"SELECT sku_code, qty FROM daily_stocktake_line "
|
||||
"WHERE stocktake_id = %s AND sku_code LIKE 'MY-%%' "
|
||||
"ORDER BY sku_code ASC",
|
||||
(head["id"],),
|
||||
).fetchall()
|
||||
names = self.item_name_map()
|
||||
d = head["stocktake_date"]
|
||||
date_str = d.isoformat() if isinstance(d, date) else str(d)
|
||||
rows = [
|
||||
{
|
||||
"set_code": r["sku_code"],
|
||||
"set_name": names.get(r["sku_code"], r["sku_code"]),
|
||||
"qty": int(r["qty"]),
|
||||
}
|
||||
for r in lines
|
||||
]
|
||||
return {"stocktake_date": date_str, "rows": rows}
|
||||
|
||||
def _last_stocktake_dates(self, *, warehouse_code: str) -> dict[str, str]:
|
||||
"""아이템별 마지막 STOCKTAKE movement 날짜."""
|
||||
with self._pool.connection() as conn:
|
||||
|
||||
Reference in New Issue
Block a user