From 9ae27bce8a47f8d460ba01d2a4f90f24f0b80533 Mon Sep 17 00:00:00 2001 From: king Date: Wed, 2 Sep 2026 16:13:49 +0900 Subject: [PATCH] =?UTF-8?q?style(cupang):=20=EB=A7=A4=EC=B6=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=A1=B0=EA=B1=B4=201=ED=96=89=20=EA=B3=A0?= =?UTF-8?q?=EC=A0=95=20+=20=EC=A3=BC=EC=B0=A8=20=ED=95=84=ED=84=B0,=20?= =?UTF-8?q?=EC=83=81=EB=8B=A8=20=ED=95=A9=EA=B3=84=20KPI=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 조회 조건은 flex-wrap: nowrap 로 한 줄 유지(좁은 화면은 가로 스크롤) - 주차(week_label) 필터 추가 — 최근 주차부터 목록 - 공급가/원가/물류비/마진/순마진 합계 카드 삭제, 표 영역 높이 확대 Co-Authored-By: Claude Opus 5 --- app/modules/cupang/db.py | 15 ++++++- app/modules/cupang/router.py | 2 + .../cupang/templates/cupang/box_calc.html | 2 +- .../cupang/templates/cupang/box_rules.html | 2 +- .../cupang/templates/cupang/index.html | 2 +- .../cupang/templates/cupang/products.html | 2 +- .../cupang/templates/cupang/sales.html | 41 ++++--------------- app/modules/cupang/templates/cupang/view.html | 2 +- app/static/cupang.css | 29 +++++++++---- 9 files changed, 50 insertions(+), 47 deletions(-) diff --git a/app/modules/cupang/db.py b/app/modules/cupang/db.py index 824cb25..aaaa605 100644 --- a/app/modules/cupang/db.py +++ b/app/modules/cupang/db.py @@ -679,9 +679,10 @@ class CupangDBStore: center_name: str = "", keyword: str = "", po_type: str = "", + week_label: str = "", limit: int = 5000, ) -> list[dict[str, Any]]: - """출고일 기준 조회. 기간·센터·발주유형·검색어(품목/SKU/발주번호/바코드).""" + """출고일 기준 조회. 기간·센터·발주유형·주차·검색어(품목/SKU/발주번호/바코드).""" where: list[str] = [] params: list[Any] = [] if date_from: @@ -696,6 +697,9 @@ class CupangDBStore: if po_type: where.append("po_type = %s") params.append(po_type) + if week_label: + where.append("week_label = %s") + params.append(week_label) if keyword: where.append( "(item_name ILIKE %s OR sku_id ILIKE %s OR po_no ILIKE %s OR barcode ILIKE %s)" @@ -728,6 +732,15 @@ class CupangDBStore: ).fetchall() return [r["center_name"] for r in rows] + def sales_weeks(self) -> list[str]: + """필터용 — 매출 자료의 주차 목록(최근 주차부터).""" + with self._pool.connection() as conn: + rows = conn.execute( + "SELECT week_label, MIN(ship_date) AS d FROM cupang_sales " + "WHERE week_label <> '' GROUP BY week_label ORDER BY d DESC NULLS LAST" + ).fetchall() + return [r["week_label"] for r in rows] + def create_sale(self, *, data: dict[str, Any]) -> dict[str, Any]: row = self._normalize_sale(data) cols = ", ".join(self.SALES_FIELDS) diff --git a/app/modules/cupang/router.py b/app/modules/cupang/router.py index bbbf712..095608d 100644 --- a/app/modules/cupang/router.py +++ b/app/modules/cupang/router.py @@ -590,6 +590,7 @@ def _sales_filters(request: Request) -> dict[str, str]: "center_name": (q.get("center") or "").strip(), "keyword": (q.get("q") or "").strip(), "po_type": (q.get("type") or "").strip(), + "week_label": (q.get("week") or "").strip(), } @@ -641,6 +642,7 @@ async def sales_page(request: Request) -> HTMLResponse: "totals": totals, "filters": filters, "centers": store.sales_centers(), + "weeks": store.sales_weeks(), "po_types": ["일반", "벤더플렉스"], "weekly": sorted(weekly.values(), key=lambda w: w.get("week_from") or ""), }, diff --git a/app/modules/cupang/templates/cupang/box_calc.html b/app/modules/cupang/templates/cupang/box_calc.html index fa69df7..7e8a555 100644 --- a/app/modules/cupang/templates/cupang/box_calc.html +++ b/app/modules/cupang/templates/cupang/box_calc.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/box_rules.html b/app/modules/cupang/templates/cupang/box_rules.html index 205f72e..b7a69b5 100644 --- a/app/modules/cupang/templates/cupang/box_rules.html +++ b/app/modules/cupang/templates/cupang/box_rules.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/index.html b/app/modules/cupang/templates/cupang/index.html index 99ec541..4057669 100644 --- a/app/modules/cupang/templates/cupang/index.html +++ b/app/modules/cupang/templates/cupang/index.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/products.html b/app/modules/cupang/templates/cupang/products.html index 4be3e42..d1772c2 100644 --- a/app/modules/cupang/templates/cupang/products.html +++ b/app/modules/cupang/templates/cupang/products.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
diff --git a/app/modules/cupang/templates/cupang/sales.html b/app/modules/cupang/templates/cupang/sales.html index e835948..a32ae32 100644 --- a/app/modules/cupang/templates/cupang/sales.html +++ b/app/modules/cupang/templates/cupang/sales.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %} {# 쿠팡 로켓 매출 — 발주 라인별 공급가·원가·물류비·마진 #} @@ -29,6 +29,13 @@ {% endfor %} +