feat(inout): 발주 수량 공배수 ◀ ▶·파렛트 그림·품목 표 제목 행 서식
- 품목 표 제목 행 가운데·굵게·110% - 수량 칸 오른쪽 ◀ ▶ 로 통·뚜껑 입수 공배수만큼 줄이기·늘리기 - 합계 줄에 꽉 찬 파렛트 그림과 잔량 파렛트(실린 박스만 색칠, %, 몇 박스 더) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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.*` 라 새 열이 따라온다.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{% from "inout/_macros.html" import order_badge, progress, due, n, ymd %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021d" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021e" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
|
||||
@@ -71,4 +71,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021d" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021e" defer></script>{% endblock %}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</footer>
|
||||
</dialog>
|
||||
{%- endmacro -%}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021d" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021e" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% set active = order.status in ('open', 'partial') %}
|
||||
@@ -256,4 +256,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021d" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021e" defer></script>{% endblock %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021d" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021e" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
|
||||
@@ -43,7 +43,7 @@
|
||||
placeholder="코드 또는 이름" {% if received %}readonly title="입고된 제품은 바꿀 수 없습니다(수량은 바꿀 수 있음)"{% endif %} />
|
||||
{% if received %}<div class="erp-row-sub">입고 {{ '{:,}'.format(received) }}개 — 제품은 그대로, 수량만 바꿀 수 있습니다</div>{% endif %}
|
||||
</td>
|
||||
<td class="io-col-qty"><input class="erp-input io-qty" type="text" inputmode="numeric" name="qty" value="{{ ln.qty }}" placeholder="0" /></td>
|
||||
<td class="io-col-qty"><span class="io-qty-wrap"><input class="erp-input io-qty" type="text" inputmode="numeric" name="qty" value="{{ ln.qty }}" placeholder="0" />{% if boxes_ready %}<span class="io-steps"><button type="button" class="io-step" data-step="-1" aria-label="공배수만큼 줄이기" disabled><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg></button><button type="button" class="io-step" data-step="1" aria-label="공배수만큼 늘리기" disabled><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg></button></span>{% endif %}</span></td>
|
||||
<td class="io-col-money io-price">{{ ln.price_label or '-' }}</td>
|
||||
<td class="io-col-money io-amount">-</td>
|
||||
{% if boxes_ready %}<td class="io-col-box io-box">-</td>{% endif %}
|
||||
@@ -60,6 +60,8 @@
|
||||
<div class="io-pallet" id="io-pallet" aria-live="polite">
|
||||
<span>통 <b data-k="body">0</b>박스</span><span>뚜껑 <b data-k="lid">0</b>박스</span><span>전체 <b data-k="boxes">0</b>박스</span>
|
||||
<span class="io-pallet-main">→ <b data-k="pallets">0</b>파렛트</span>
|
||||
{# 파렛트 그림 — 꽉 찬 파렛트 + 잔량 파렛트(실린 박스만큼 색, %·몇 박스 더) #}
|
||||
<span class="io-pallet-vis" data-k="vis"></span>
|
||||
<span class="erp-muted" data-k="note">1파렛트 = {{ pallet_boxes }}박스</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -75,7 +77,7 @@
|
||||
<input type="hidden" name="item_name" value="" />
|
||||
<input class="erp-input io-item-search" type="text" value="" autocomplete="off" placeholder="코드 또는 이름" />
|
||||
</td>
|
||||
<td class="io-col-qty"><input class="erp-input io-qty" type="text" inputmode="numeric" name="qty" value="" placeholder="0" /></td>
|
||||
<td class="io-col-qty"><span class="io-qty-wrap"><input class="erp-input io-qty" type="text" inputmode="numeric" name="qty" value="" placeholder="0" />{% if boxes_ready %}<span class="io-steps"><button type="button" class="io-step" data-step="-1" aria-label="공배수만큼 줄이기" disabled><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg></button><button type="button" class="io-step" data-step="1" aria-label="공배수만큼 늘리기" disabled><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg></button></span>{% endif %}</span></td>
|
||||
<td class="io-col-money io-price">-</td>
|
||||
<td class="io-col-money io-amount">-</td>
|
||||
{% if boxes_ready %}<td class="io-col-box io-box">-</td>{% endif %}
|
||||
@@ -93,4 +95,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021d" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021e" defer></script>{% endblock %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{% from "inout/_macros.html" import due, n, ymd %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021d" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261021e" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
|
||||
@@ -91,4 +91,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021d" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261021e" defer></script>{% endblock %}
|
||||
|
||||
+26
-2
@@ -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; }
|
||||
|
||||
+61
-3
@@ -84,6 +84,48 @@
|
||||
cell.innerHTML = html + '<div class="io-box-hint" title="' + per + '">' + hint + "</div>";
|
||||
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 += '<rect x="' + (c * w + 0.5) + '" y="' + (r * h + 0.5) + '" width="' + (w - 1.5) + '" height="' + (h - 1.5) +
|
||||
'" rx="1" class="' + (i < filled ? "is-on" : "is-off") + '"/>';
|
||||
}
|
||||
const W = cols * w, H = rows * h;
|
||||
return '<svg class="io-pal-svg" viewBox="0 0 ' + W + " " + (H + 6) + '" width="' + W + '" height="' + (H + 6) + '" aria-hidden="true">' + boxes +
|
||||
'<rect class="io-pal-base" x="0" y="' + (H + 0.5) + '" width="' + W + '" height="2.5"/>' +
|
||||
'<rect class="io-pal-base" x="1" y="' + (H + 3) + '" width="5" height="3"/><rect class="io-pal-base" x="' + (W / 2 - 2.5) + '" y="' + (H + 3) + '" width="5" height="3"/>' +
|
||||
'<rect class="io-pal-base" x="' + (W - 6) + '" y="' + (H + 3) + '" width="5" height="3"/></svg>';
|
||||
}
|
||||
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 += '<span class="io-pal-group" title="꽉 찬 파렛트 ' + full + '개">' + icons +
|
||||
(full > MAX ? '<span class="io-pal-more">+' + (full - MAX) + "</span>" : "") +
|
||||
'<span class="io-pal-cap">꽉 찬 파렛트 <b>' + fmt(full) + "</b></span></span>";
|
||||
}
|
||||
if (rem) {
|
||||
const pct = Math.round(rem / palletBoxes * 100);
|
||||
html += '<span class="io-pal-group is-rem" title="잔량 파렛트 ' + rem + "/" + palletBoxes + '박스">' + palletSvg(rem, palletBoxes) +
|
||||
'<span class="io-pal-cap">잔량 <b>' + rem + "</b>박스 · <b>" + pct + "%</b><br>" +
|
||||
'<span class="io-pal-need">' + (palletBoxes - rem) + "박스 더 실으면 한 파렛트</span></span></span>";
|
||||
} else {
|
||||
html += '<span class="io-pal-ok">✓ 모든 파렛트가 꽉 찹니다</span>';
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -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 에서 바로 붙이고, 서버 값이 바뀐 때만 다시 그린다(보던 달 유지, [오늘]로 돌아옴).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user