From 8652064415cacebb5ff446379506c0420d60609a Mon Sep 17 00:00:00 2001 From: king Date: Wed, 21 Oct 2026 15:38:50 +0900 Subject: [PATCH] =?UTF-8?q?feat(inout):=20=EB=B0=9C=EC=A3=BC=20=EC=88=98?= =?UTF-8?q?=EB=9F=89=20=EA=B3=B5=EB=B0=B0=EC=88=98=20=E2=97=80=20=E2=96=B6?= =?UTF-8?q?=C2=B7=ED=8C=8C=EB=A0=9B=ED=8A=B8=20=EA=B7=B8=EB=A6=BC=C2=B7?= =?UTF-8?q?=ED=92=88=EB=AA=A9=20=ED=91=9C=20=EC=A0=9C=EB=AA=A9=20=ED=96=89?= =?UTF-8?q?=20=EC=84=9C=EC=8B=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 품목 표 제목 행 가운데·굵게·110% - 수량 칸 오른쪽 ◀ ▶ 로 통·뚜껑 입수 공배수만큼 줄이기·늘리기 - 합계 줄에 꽉 찬 파렛트 그림과 잔량 파렛트(실린 박스만 색칠, %, 몇 박스 더) Co-Authored-By: Claude Opus 5.5 --- app/modules/inout/CLAUDE.md | 3 + app/modules/inout/templates/inout/index.html | 4 +- .../inout/templates/inout/order_detail.html | 4 +- .../inout/templates/inout/order_form.html | 10 +-- .../inout/templates/inout/pending.html | 4 +- app/static/inout.css | 28 +++++++- app/static/inout.js | 64 ++++++++++++++++++- docs/INOUT_MODULE.md | 2 + 8 files changed, 104 insertions(+), 15 deletions(-) diff --git a/app/modules/inout/CLAUDE.md b/app/modules/inout/CLAUDE.md index 42da405..55b62a6 100644 --- a/app/modules/inout/CLAUDE.md +++ b/app/modules/inout/CLAUDE.md @@ -76,6 +76,9 @@ `store.validate_box_values`). 상품 정보 표 제목 행 = 가운데·굵게·13.2px(예전 12px × 110%). - **새 발주서** 줄마다 "통·뚜껑 박스" 칸(`inout.js boxCell`) = 통 ⌈수량 ÷ 통 입수⌉박스 · 뚜껑 ⌈수량 ÷ 뚜껑 입수⌉박스, 힌트 = 통·뚜껑 입수의 **최소공배수**(둘 다 꽉 차는 수량 단위, 뚜껑 없으면 통 입수)와 지금 수량에 가까운 그 배수(누르면 수량 칸에), 배수면 "✓ 꽉 찹니다". 합계 줄 = 통·뚜껑·전체 박스 → **파렛트 ⌈전체 박스 ÷ 30⌉**(`store.PALLET_BOXES`) + 마지막 파렛트 박스 수. +- 수량 칸 오른쪽 **◀ ▶** = 공배수(`unitOf`)만큼 줄이기·늘리기 — 배수가 아니면 가까운 아래/위 배수로, 0 이면 빈칸. 제품을 안 골랐거나 입수가 없으면 못 누름. +- 합계 줄 파렛트 그림(`palletSvg`·`palletVis`, 6열 × 5행 박스 + 받침대) = 꽉 찬 파렛트(최대 10개 + "+N") · 잔량 파렛트(실린 박스만 색칠, 몇 %·몇 박스 더 실으면 한 파렛트), 딱 맞으면 "✓ 모든 파렛트가 꽉 찹니다". +- 품목 표 제목 행 = 가운데·굵게·`--text-caption` × 110%. - 화면 계산만 — 발주 품목 사본·발주서 화면·**발주 메일에는 넣지 않음**(사용자 지정). 값은 지금 상품 정보(`_form_page` 의 `body_per_box`, `/api/items`). - 007 확인 `db.boxes_ready`(groups_ready 와 같은 방식 — 연결 열기 전, 미적용 1분 기억). 그룹·색상 조회(`_PRODUCT_SELECT_006`)는 `p.*` 라 새 열이 따라온다. diff --git a/app/modules/inout/templates/inout/index.html b/app/modules/inout/templates/inout/index.html index a4ed0c0..107d79c 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 e1a0657..70beaec 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') %} @@ -256,4 +256,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 5525d2c..6a33fbf 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) #} @@ -43,7 +43,7 @@ placeholder="코드 또는 이름" {% if received %}readonly title="입고된 제품은 바꿀 수 없습니다(수량은 바꿀 수 있음)"{% endif %} /> {% if received %}
입고 {{ '{:,}'.format(received) }}개 — 제품은 그대로, 수량만 바꿀 수 있습니다
{% endif %} - + {% if boxes_ready %}{% endif %} {{ ln.price_label or '-' }} - {% if boxes_ready %}-{% endif %} @@ -60,6 +60,8 @@
통 0박스뚜껑 0박스전체 0박스 → 0파렛트 + {# 파렛트 그림 — 꽉 찬 파렛트 + 잔량 파렛트(실린 박스만큼 색, %·몇 박스 더) #} + 1파렛트 = {{ pallet_boxes }}박스
{% endif %} @@ -75,7 +77,7 @@ - + {% if boxes_ready %}{% endif %} - - {% if boxes_ready %}-{% endif %} @@ -93,4 +95,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 d90ee64..075d114 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.css b/app/static/inout.css index 850d1b3..8227d0f 100644 --- a/app/static/inout.css +++ b/app/static/inout.css @@ -435,13 +435,37 @@ .io-dlg-pane[data-pane="groups"] .io-group-table { margin-top: 12px; } /* ── 새 발주서: 통·뚜껑 박스·파렛트(2026-10-21, 007) — 화면 계산만 ── */ -.io-lines .io-col-box { min-width: 190px; white-space: normal !important; font-size: 12.5px; } +.io-lines .io-col-box { min-width: 210px; white-space: normal !important; } +.io-lines td.io-col-box { font-size: 12.5px; } .io-box-main b { font-variant-numeric: tabular-nums; } .io-box-hint { margin-top: 2px; font-size: 11.5px; color: var(--color-midtone-gray, #666); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; } -.io-box-ok { color: #1e7a34; font-weight: 600; } +.io-box-ok { color: #1e7a34; font-weight: 600; white-space: nowrap; } .io-box-pick { border: 1px solid #cfe0fb; background: #f0f6ff; color: #1d4f91; border-radius: 6px; padding: 0 6px; height: 20px; font-size: 11.5px; cursor: pointer; } .io-box-pick:hover { background: #dce9ff; } .io-pallet { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 13px; } .io-pallet b { font-variant-numeric: tabular-nums; } .io-pallet-main { font-size: 14px; font-weight: 600; } .io-pallet-main b { font-size: 16px; color: #1d4f91; } + +/* ── 새 발주서(2026-10-21): 품목 표 제목 행 가운데·굵게·110%, 수량 ◀ ▶(공배수만큼), 파렛트 그림 ── */ +.io-lines thead th, .io-table.io-lines th.io-col-money { text-align: center; font-size: calc(var(--text-caption, 12px) * 1.1); font-weight: 700; color: var(--color-rich-black, #1d1d1f); } +.io-lines .io-col-qty { width: 196px; } +.io-qty-wrap { display: flex; align-items: center; gap: 4px; } +.io-qty-wrap .io-qty { flex: 1 1 auto; min-width: 0; } +.io-steps { display: inline-flex; gap: 2px; flex: none; } +.io-step { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; padding: 0; border: 1px solid var(--color-subtle-ash, #e5e5e5); + border-radius: 8px; background: #fff; color: #1d4f91; cursor: pointer; } +.io-step:hover:not(:disabled) { background: #f0f6ff; border-color: #cfe0fb; } +.io-step:disabled { color: #c3c7cc; cursor: not-allowed; } +.io-pallet-vis { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; } +.io-pal-group { display: inline-flex; align-items: flex-end; gap: 4px; } +.io-pal-group.is-rem { padding-left: 12px; border-left: 1px dashed #d5d9de; } +.io-pal-svg { display: block; flex: none; } +.io-pal-svg .is-on { fill: #c98a4b; stroke: #9c6631; stroke-width: .6; } +.io-pal-svg .is-off { fill: #fff; stroke: #c9cdd2; stroke-width: .6; stroke-dasharray: 1.2 1; } +.io-pal-svg .io-pal-base { fill: #8a6a48; } +.io-pal-more { font-size: 12px; font-weight: 700; color: #6b4a2b; align-self: center; } +.io-pal-cap { font-size: 12px; color: #4b5563; line-height: 1.35; align-self: center; margin-left: 2px; white-space: nowrap; } +.io-pal-cap b { color: #1d1d1f; font-variant-numeric: tabular-nums; } +.io-pal-need { color: #b45309; font-weight: 600; } +.io-pal-ok { color: #1e7a34; font-weight: 600; font-size: 12.5px; } diff --git a/app/static/inout.js b/app/static/inout.js index 1d94798..cea9858 100644 --- a/app/static/inout.js +++ b/app/static/inout.js @@ -84,6 +84,48 @@ cell.innerHTML = html + '
' + hint + "
"; return out; } + // 줄의 수량 단위 — 통·뚜껑 입수의 최소공배수(뚜껑 없으면 통 입수). 제품을 안 골랐거나 입수가 없으면 0. + function unitOf(tr) { + if (!tr.querySelector('input[name="item_code"]').value) return 0; + const body = parseInt(tr.dataset.bodyBox || "0", 10) || 0, lid = parseInt(tr.dataset.lidBox || "0", 10) || 0; + return body ? (lid ? lcm(body, lid) : body) : 0; + } + // 파렛트 그림(SVG) — 6열 × 행(파렛트 박스 수 ÷ 6) 박스를 받침대 위에, 실린 박스는 아래 줄 왼쪽부터 색칠 + function palletSvg(filled, total) { + const cols = 6, rows = Math.ceil(total / cols), w = 8, h = 7; + let boxes = ""; + for (let i = 0; i < total; i++) { + const r = rows - 1 - Math.floor(i / cols), c = i % cols; + boxes += ''; + } + const W = cols * w, H = rows * h; + return ''; + } + function palletVis(all) { + if (!all) return ""; + const full = Math.floor(all / palletBoxes), rem = all % palletBoxes, MAX = 10; + let html = ""; + if (full) { + let icons = ""; + for (let i = 0; i < Math.min(full, MAX); i++) icons += palletSvg(palletBoxes, palletBoxes); + 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) + "박스 더 실으면 한 파렛트
"; + } else { + html += '✓ 모든 파렛트가 꽉 찹니다'; + } + return html; + } function renumber() { let q = 0, k = 0, amount = 0, missing = 0; let bodyBoxes = 0, lidBoxes = 0, unset = 0; @@ -98,13 +140,18 @@ if (has) { k++; q += n; if (price === null) missing++; else amount += price * n; } const bx = boxCell(tr, n, has); bodyBoxes += bx.body; lidBoxes += bx.lid; if (bx.unset) unset++; + const unit = unitOf(tr); // ◀ ▶ = 공배수만큼(입수가 없으면 누를 수 없음) + tr.querySelectorAll(".io-step").forEach(function (b) { + b.disabled = !unit || (b.dataset.step === "-1" && !n); + b.title = unit ? "공배수 " + fmt(unit) + "개씩 " + (b.dataset.step === "1" ? "늘리기" : "줄이기") : "제품을 고르고 박스 입수(옵션 → 상품 정보)가 있어야 쓸 수 있습니다"; + }); }); if (pallet && palletBoxes > 0) { - const all = bodyBoxes + lidBoxes, pallets = Math.ceil(all / palletBoxes), last = all % palletBoxes; + 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)); - set("note", "1파렛트 = " + palletBoxes + "박스" + (all && last ? " · 마지막 파렛트 " + last + "박스(" + (palletBoxes - last) + "박스 더 실을 수 있음)" : "") + - (unset ? " · 박스 입수 미설정 " + unset + "종 제외" : "")); + pallet.querySelector('[data-k="vis"]').innerHTML = palletVis(all); + set("note", "1파렛트 = " + palletBoxes + "박스" + (unset ? " · 박스 입수 미설정 " + unset + "종 제외" : "")); } totalQty.textContent = fmt(q); totalLines.textContent = fmt(k); @@ -132,6 +179,17 @@ }); body.addEventListener("input", renumber); // 수량을 바꾸거나 제품 글을 고치면(고른 것 풀림) 다시 셈 body.addEventListener("io-chosen", renumber); // 검색 목록에서 제품을 고르면 + body.addEventListener("click", function (e) { // ◀ ▶ = 공배수만큼 줄이기·늘리기(배수가 아니면 가까운 배수로 맞춤) + const step = e.target.closest(".io-step"); + if (!step || step.disabled) return; + const tr = step.closest(".io-line"), unit = unitOf(tr), qty = tr.querySelector(".io-qty"); + if (!unit) return; + const n = num(qty.value); + let next = step.dataset.step === "1" ? (Math.floor(n / unit) + 1) * unit : (n % unit ? Math.floor(n / unit) * unit : n - unit); + if (next < 0) next = 0; + qty.value = next ? next.toLocaleString("ko-KR") : ""; + renumber(); + }); body.addEventListener("click", function (e) { // 공배수 힌트 숫자 = 그 수량으로 const pick = e.target.closest(".io-box-pick"); if (!pick) return; diff --git a/docs/INOUT_MODULE.md b/docs/INOUT_MODULE.md index 2507849..ddfa7fd 100644 --- a/docs/INOUT_MODULE.md +++ b/docs/INOUT_MODULE.md @@ -198,6 +198,8 @@ cupang·malaysia 와 같은 DSN). 화면에서 코드·이름으로 검색(`GET - 계산(화면, `inout.js`): 통 박스 = ⌈수량 ÷ 통 입수⌉, 뚜껑 박스 = ⌈수량 ÷ 뚜껑 입수⌉, 전체 박스 = Σ(통 + 뚜껑), 파렛트 = ⌈전체 ÷ 30⌉, 마지막 파렛트 = 전체 mod 30. 힌트 단위 = lcm(통 입수, 뚜껑 입수)(뚜껑 없으면 통 입수) — 수량이 그 배수면 "✓ 통·뚜껑 박스가 모두 꽉 찹니다", 아니면 아래·위 가까운 배수 버튼(누르면 수량 칸에). 입수가 없는 상품은 "박스 입수 미설정"으로 합계에서 빼고 몇 종 빠졌는지 표시. 예: 통 120·뚜껑 300 → 공배수 600, 1,000개 = 통 9·뚜껑 4박스(600·1,200 힌트). +- 같은 날 추가 요청: 품목 표 제목 행 가운데·굵게·110%, 수량 칸 오른쪽 ◀ ▶(공배수만큼 — 배수가 아니면 가까운 배수로 맞춤), + 합계 줄에 파렛트 그림(꽉 찬 파렛트 수만큼 + 잔량 파렛트는 실린 박스만 색칠·%·"N박스 더 실으면 한 파렛트"). - 옵션 상품 정보 표 제목 행 = 가운데·굵게·12px × 110%. 그룹 표는 같은 날 **상품 그룹** 탭으로 분리, 옵션 창 폭 1440px 까지. - **달력 다시 그리기 줄이기**(같은 날): 화면을 옮겨도 마지막 달력을 sessionStorage 에서 바로 붙이고, 서버 값이 바뀐 때만 다시 그린다(보던 달 유지, [오늘]로 돌아옴).