feat(cupang): 출고 박스 구성(box_plan) 저장 + 달력 상세를 센터 분배 형식으로
- 마이그레이션 005: cupang_shipments.box_plan JSONB (확정 당시 박스 구성) 확정 payload 에서 제품별/혼합 상자와 내용물·상자 종류를 받아 저장 - 달력 오른쪽 목록을 ③ 센터 분배 카드 형식으로 변경 — 혼합 상자는 내용물 트리까지 표시. box_plan 이 없는 예전 출고는 기존 합계 표시로 폴백 - 출고 보기(view.html) ③ 목록도 동일하게 box_plan 기준 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -496,8 +496,9 @@ class CupangDBStore:
|
||||
INSERT INTO cupang_shipments
|
||||
(created_by, document_date, ship_date,
|
||||
center_arrival_date, center_id, center_name_snapshot,
|
||||
ship_method, outbound_summary, worker, status, memo)
|
||||
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
|
||||
ship_method, outbound_summary, worker, status, memo,
|
||||
box_plan)
|
||||
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
|
||||
RETURNING *
|
||||
""",
|
||||
(
|
||||
@@ -512,6 +513,7 @@ class CupangDBStore:
|
||||
h["worker"],
|
||||
h["status"],
|
||||
h["memo"],
|
||||
Jsonb(h["box_plan"]),
|
||||
),
|
||||
).fetchone()
|
||||
shipment_id = row["id"]
|
||||
@@ -533,7 +535,8 @@ class CupangDBStore:
|
||||
SET document_date = %s, ship_date = %s,
|
||||
center_arrival_date = %s, center_id = %s,
|
||||
center_name_snapshot = %s, ship_method = %s,
|
||||
outbound_summary = %s, worker = %s, memo = %s
|
||||
outbound_summary = %s, worker = %s, memo = %s,
|
||||
box_plan = %s
|
||||
WHERE id = %s
|
||||
RETURNING *
|
||||
""",
|
||||
@@ -547,6 +550,7 @@ class CupangDBStore:
|
||||
h["outbound_summary"],
|
||||
h["worker"],
|
||||
h["memo"],
|
||||
Jsonb(h["box_plan"]),
|
||||
shipment_id,
|
||||
),
|
||||
).fetchone()
|
||||
@@ -690,6 +694,8 @@ class CupangDBStore:
|
||||
"worker": str(header.get("worker") or "").strip(),
|
||||
"status": status,
|
||||
"memo": str(header.get("memo") or "").strip(),
|
||||
# 확정 당시 박스 구성(제품별/혼합). 화면 표시 전용이라 형태만 검사한다.
|
||||
"box_plan": header.get("box_plan") if isinstance(header.get("box_plan"), list) else [],
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
@@ -793,6 +799,8 @@ class CupangDBStore:
|
||||
out = dict(row)
|
||||
out["id"] = int(out["id"])
|
||||
out["center_id"] = int(out["center_id"]) if out.get("center_id") is not None else None
|
||||
if not isinstance(out.get("box_plan"), list):
|
||||
out["box_plan"] = []
|
||||
for k in ("document_date", "ship_date", "center_arrival_date"):
|
||||
v = out.get(k)
|
||||
if isinstance(v, date):
|
||||
|
||||
Reference in New Issue
Block a user