diff --git a/app/modules/inout/CLAUDE.md b/app/modules/inout/CLAUDE.md index 7a89af8..9d3fd82 100644 --- a/app/modules/inout/CLAUDE.md +++ b/app/modules/inout/CLAUDE.md @@ -98,7 +98,7 @@ - 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품(`store.is_bag`, 저장 안 함 — 이름으로 판단) = 옵션 → 상품 정보에서 일반 상품과 **표를 나눔**(봉투·백 표가 위). 칸: **박스당 수량**(`body_per_box` 재사용)·**1파렛트당 박스 수량**(`inout_products.boxes_per_pallet`). 뚜껑 없음(저장하면 `lid_per_box` 는 NULL). **단가·무게·은 칸 없음**(2026-11-04 사용자 지정) — 전에 넣은 값은 줄의 숨은 칸으로 저장 때 그대로 보내 지우지 않음. 그룹·색상 칸은 있음. 새 발주서 "단가 없는 N종"·발주서 화면과 발주 메일의 "단가 미입력 N종"(`store.order_totals`) 안내에서 봉투·백은 뺌. -- 새 발주서 합계 줄에 봉투·백 박스·파렛트를 **통·뚜껑과 따로** 표시: 파렛트 = ⌈Σ(박스 ÷ 그 상품 1파렛트 박스)⌉, 그림 없음. 입수·1파렛트 값은 `store.box_info`(`_form_page`·`/api/items`). +- 새 발주서 합계 줄에 봉투·백 박스·파렛트를 **통·뚜껑과 따로** 표시: 파렛트 = ⌈Σ(박스 ÷ 그 상품 1파렛트 박스)⌉. 파렛트 그림도 통처럼(`palletVis(all, cap, mixed)`, 그림 칸은 60칸까지) — 1파렛트 박스 수가 다른 상품이 섞이면 가장 큰 값으로 환산해 잔량은 %만. 입수·1파렛트 값은 `store.box_info`(`_form_page`·`/api/items`). - 008 확인 `db.bags_ready`(boxes_ready 와 같은 방식). 미적용이면 모두 일반 상품으로 동작. ## 오른쪽 달력 (2026-10-21) diff --git a/app/modules/inout/templates/inout/index.html b/app/modules/inout/templates/inout/index.html index 0247a73..93bf3d3 100644 --- a/app/modules/inout/templates/inout/index.html +++ b/app/modules/inout/templates/inout/index.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} {% from "inout/_macros.html" import order_badge, progress, due, n, ymd %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #} @@ -71,4 +71,4 @@ {% include "inout/_calendar.html" %}
{% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/inout/templates/inout/order_detail.html b/app/modules/inout/templates/inout/order_detail.html index 7497d03..83cc7fd 100644 --- a/app/modules/inout/templates/inout/order_detail.html +++ b/app/modules/inout/templates/inout/order_detail.html @@ -20,7 +20,7 @@ {%- endmacro -%} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %} {% set active = order.status in ('open', 'partial') %} @@ -262,4 +262,4 @@ {% include "inout/_calendar.html" %} {% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/inout/templates/inout/order_form.html b/app/modules/inout/templates/inout/order_form.html index 5b48f76..d011d4c 100644 --- a/app/modules/inout/templates/inout/order_form.html +++ b/app/modules/inout/templates/inout/order_form.html @@ -1,5 +1,5 @@ {% extends "erp_base.html" %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #} @@ -68,6 +68,7 @@ {% endif %} @@ -101,4 +102,4 @@ {% include "inout/_calendar.html" %}
{% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/modules/inout/templates/inout/pending.html b/app/modules/inout/templates/inout/pending.html index f5b101c..f349215 100644 --- a/app/modules/inout/templates/inout/pending.html +++ b/app/modules/inout/templates/inout/pending.html @@ -1,6 +1,6 @@ {% extends "erp_base.html" %} {% from "inout/_macros.html" import due, n, ymd %} -{% block head_extra %}{% endblock %} +{% block head_extra %}{% endblock %} {% block content %}
{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #} @@ -91,4 +91,4 @@ {% include "inout/_calendar.html" %}
{% endblock %} -{% block scripts %}{% endblock %} +{% block scripts %}{% endblock %} diff --git a/app/static/inout.js b/app/static/inout.js index 3a2052f..1e578f6 100644 --- a/app/static/inout.js +++ b/app/static/inout.js @@ -107,22 +107,25 @@ '' + ''; } - function palletVis(all) { + // cap = 1파렛트 박스 수. mixed = 1파렛트 박스 수가 다른 봉투·백이 섞임 — all 은 cap 기준 환산값이라 잔량은 %만 보여 준다. + function palletVis(all, cap, mixed) { if (!all) return ""; - const full = Math.floor(all / palletBoxes), rem = all % palletBoxes, MAX = 10; + const full = Math.floor(all / cap), rem = all % cap, MAX = 10; + const cells = Math.min(cap, 60); // cap 은 입력값 — 아주 커도 그림 칸 수는 60칸까지(비율로 칠함) let html = ""; if (full) { let icons = ""; - for (let i = 0; i < Math.min(full, MAX); i++) icons += palletSvg(palletBoxes, palletBoxes); + for (let i = 0; i < Math.min(full, MAX); i++) icons += palletSvg(cells, cells); html += '' + icons + (full > MAX ? '+' + (full - MAX) + "" : "") + '꽉 찬 파렛트 ' + fmt(full) + ""; } if (rem) { - const pct = Math.round(rem / palletBoxes * 100); - html += '' + palletSvg(rem, palletBoxes) + - '잔량 ' + rem + "박스 · " + pct + "%
" + - '' + (palletBoxes - rem) + "박스 더 실으면 한 파렛트
"; + const pct = Math.round(rem / cap * 100); + const drawn = Math.min(cells - 1, Math.max(1, Math.round(rem / cap * cells))); + html += '' + palletSvg(drawn, cells) + + '잔량 ' + (mixed ? "" + pct + "%" : "" + rem + "박스 · " + pct + "%
" + + '' + (cap - rem) + "박스 더 실으면 한 파렛트"); } else { html += '✓ 모든 파렛트가 꽉 찹니다'; } @@ -131,7 +134,7 @@ function renumber() { let q = 0, k = 0, amount = 0, missing = 0; let bodyBoxes = 0, lidBoxes = 0, unset = 0; - let bagLines = 0, bagBoxes = 0, bagShare = 0, bagUnset = 0; + let bagLines = 0, bagBoxes = 0, bagCapped = 0, bagShare = 0, bagCap = 0, bagMixed = false, bagUnset = 0; body.querySelectorAll(".io-line").forEach(function (tr, i) { tr.querySelector(".io-col-no").textContent = String(i + 1); const n = num(tr.querySelector(".io-qty").value); @@ -146,7 +149,12 @@ const cap = parseInt(tr.dataset.palletBox || "0", 10) || 0; bagLines++; bagBoxes += bx.body; - if (cap) bagShare += bx.body / cap; // 1파렛트 박스 수가 다른 봉투·백은 차지하는 비율로 더함 + if (cap) { // 1파렛트 박스 수가 다른 봉투·백은 차지하는 비율로 더함 + bagCapped += bx.body; + bagShare += bx.body / cap; + if (bagCap && cap !== bagCap) bagMixed = true; + bagCap = Math.max(bagCap, cap); + } if (bx.unset || !cap) bagUnset++; } else { bodyBoxes += bx.body; lidBoxes += bx.lid; if (bx.unset) unset++; @@ -161,15 +169,18 @@ const all = bodyBoxes + lidBoxes, pallets = Math.ceil(all / palletBoxes); const set = function (key, v) { pallet.querySelector('[data-k="' + key + '"]').textContent = v; }; set("body", fmt(bodyBoxes)); set("lid", fmt(lidBoxes)); set("boxes", fmt(all)); set("pallets", fmt(pallets)); - pallet.querySelector('[data-k="vis"]').innerHTML = palletVis(all); + pallet.querySelector('[data-k="vis"]').innerHTML = palletVis(all, palletBoxes); set("note", "1파렛트 = " + palletBoxes + "박스" + (unset ? " · 박스 입수 미설정 " + unset + "종 제외" : "")); } if (bagPallet) { bagPallet.hidden = !bagLines; const setBag = function (key, v) { bagPallet.querySelector('[data-k="' + key + '"]').textContent = v; }; setBag("boxes", fmt(bagBoxes)); - setBag("pallets", fmt(Math.ceil(Math.round(bagShare * 1e6) / 1e6))); // 소수 오차로 한 파렛트 더 나오지 않게 - setBag("note", "통·뚜껑과 따로 셈" + (bagUnset ? " · 박스당 수량·1파렛트당 박스 수량 미설정 " + bagUnset + "종 제외" : "")); + // 섞이면 가장 큰 1파렛트 박스 수로 환산(소수 오차로 한 파렛트 더 나오지 않게 반올림 후 올림) + const bagAll = bagMixed ? Math.ceil(Math.round(bagShare * bagCap * 1e6) / 1e6) : bagCapped; + setBag("pallets", fmt(bagCap ? Math.ceil(bagAll / bagCap) : 0)); + bagPallet.querySelector('[data-k="vis"]').innerHTML = palletVis(bagAll, bagCap, bagMixed); + setBag("note", bagUnset ? "박스당 수량·1파렛트당 박스 수량 미설정 " + bagUnset + "종 제외" : ""); } totalQty.textContent = fmt(q); totalLines.textContent = fmt(k); diff --git a/docs/INOUT_MODULE.md b/docs/INOUT_MODULE.md index 620a47e..ec6d03c 100644 --- a/docs/INOUT_MODULE.md +++ b/docs/INOUT_MODULE.md @@ -209,6 +209,7 @@ cupang·malaysia 와 같은 DSN). 화면에서 코드·이름으로 검색(`GET - 구분은 이름으로(`store.is_bag`, 저장 안 함). 옵션 → 상품 정보에 봉투·백 표를 따로 두고(위), 단가·무게·은 칸은 없다(같은 날 추가 요청 — 전에 넣은 값은 숨은 칸으로 유지). 그룹·색상 칸은 일반 상품과 같다. - 저장: 박스당 수량 = 기존 `body_per_box`, 1파렛트당 박스 수량 = 새 열 `boxes_per_pallet`. 봉투·백을 저장하면 `lid_per_box` 는 NULL. - 계산(새 발주서 합계 줄, `inout.js`, 요청에 명시되지 않아 구현 때 정함): 봉투·백은 통·뚜껑 파렛트(1파렛트 30박스)와 **따로** — 박스 = ⌈수량 ÷ 박스당 수량⌉, 파렛트 = ⌈Σ(박스 ÷ 그 상품의 1파렛트당 박스 수량)⌉. 값이 빠진 상품은 몇 종 빠졌는지 표시. 발주 메일에는 넣지 않음. +- 파렛트 그림(같은 날 추가 요청): 통과 같은 그림. 1파렛트 박스 수가 다른 상품이 섞이면 가장 큰 값으로 환산해 그리고 잔량은 %만 표시. 1파렛트 박스 수는 입력값이라 그림 칸은 60칸까지만 그리고 비율로 칠한다. ## 6-4. 입고 요청 메일 — 물류센터 전산 등록 부탁(2026-10-19, 마이그레이션 005)