feat(입출고): 봉투·백 표에서 단가·무게·은 열 제거
봉투·백에는 단가·무게·은이 없어 표에서 네 열을 뺀다. 전에 넣은 값은 숨은 칸으로 저장 때 그대로 보내 지우지 않는다. 새 발주서·발주서 화면·발주 메일의 단가 미입력 안내에서도 봉투·백을 뺀다. 은 칸이 없는 줄에서 그룹을 바꿔도 색상 표시가 덮이지 않게 고친다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -96,7 +96,8 @@
|
||||
|
||||
## 봉투·백 (008, 2026-11-04)
|
||||
|
||||
- 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품(`store.is_bag`, 저장 안 함 — 이름으로 판단) = 옵션 → 상품 정보에서 일반 상품과 **표를 나눔**(봉투·백 표가 위). 박스 칸만 다름: **박스당 수량**(`body_per_box` 재사용)·**1파렛트당 박스 수량**(`inout_products.boxes_per_pallet`). 뚜껑 없음(저장하면 `lid_per_box` 는 NULL).
|
||||
- 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품(`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`).
|
||||
- 008 확인 `db.bags_ready`(boxes_ready 와 같은 방식). 미적용이면 모두 일반 상품으로 동작.
|
||||
|
||||
|
||||
@@ -547,7 +547,8 @@ def order_totals(lines: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
q = int(x["qty"])
|
||||
a = line_amount(q, x.get("unit_price"))
|
||||
if a is None:
|
||||
missing += 1
|
||||
if not is_bag(x.get("item_name")): # 봉투·백은 단가가 원래 없음 — "단가 미입력" 안내에서 뺀다
|
||||
missing += 1
|
||||
else:
|
||||
amount = (amount or Decimal(0)) + a
|
||||
w = to_dec(x.get("weight_g"))
|
||||
@@ -557,7 +558,7 @@ def order_totals(lines: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
if w is not None and p is not None: # 개당 은 g 를 반올림하기 전 값으로 곱한다(합계 오차 방지)
|
||||
ag = (ag or Decimal(0)) + w * p / Decimal(100) * q
|
||||
use = (use or Decimal(0)) + w * q * (Decimal(100) - p) / Decimal(100000)
|
||||
return {"amount": amount, "missing_price": missing if amount is not None else len(lines), "pp_kg": pp, "silver_g": ag,
|
||||
return {"amount": amount, "missing_price": missing, "pp_kg": pp, "silver_g": ag,
|
||||
"pp_use_kg": use}
|
||||
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
값을 넣은 상품은 다시 불러와도 그대로이고, 지운 단품은 다음 불러오기에서 빠집니다. 발주서 제품은 이 목록에서 고르며, 발주할 때의 값이 발주서에 남습니다.
|
||||
{% if groups_ready %}<b>그룹</b>을 고른 상품은 은 함유량·<b>색상</b>을 그룹 값으로 씁니다(<b>상품 그룹</b> 탭에서 한 번만 설정).{% endif %}
|
||||
{% if boxes_ready %}<b>통 수량(박스)</b>·<b>뚜껑 수량(박스)</b> = 통·뚜껑이 한 박스에 몇 개씩 들어가는지(뚜껑이 없으면 빈칸) — 새 발주서에서 박스 수·파렛트 수를 계산합니다.{% endif %}
|
||||
이름에 "미라클 봉투"·"미라클백"이 들어간 상품은 <b>봉투·백</b> 표에서 <b>박스당 수량</b>·<b>1파렛트당 박스 수량</b>을 넣습니다.
|
||||
이름에 "미라클 봉투"·"미라클백"이 들어간 상품은 <b>봉투·백</b> 표에서 <b>박스당 수량</b>·<b>1파렛트당 박스 수량</b>을 넣습니다(단가·무게·은 없음).
|
||||
</p>
|
||||
<div class="io-prod-bar">
|
||||
<button type="button" class="erp-btn erp-btn-outline erp-btn-sm" id="io-prod-import">단품 불러오기</button>
|
||||
@@ -158,13 +158,17 @@
|
||||
<div class="io-prod-part">
|
||||
{% if bags %}<div class="io-prod-part-title">{{ '봉투·백' if bag_table else '일반 상품' }} <span class="io-sub">{{ rows|length }}개</span></div>{% endif %}
|
||||
<table class="io-dlg-table io-prod-table{% if groups_ready %} has-groups{% endif %}">
|
||||
<colgroup><col class="w-code" /><col />{% if groups_ready %}<col class="w-group" />{% endif %}<col class="w-num" /><col class="w-num" /><col class="w-num" /><col class="w-ag" />{% if boxes_ready %}<col class="w-box" /><col class="w-box" />{% endif %}{% if groups_ready %}<col class="w-color" />{% endif %}<col class="w-del" /></colgroup>
|
||||
<thead><tr><th>코드</th><th>제품명</th>{% if groups_ready %}<th>그룹</th>{% endif %}<th class="io-r">단가(원)</th><th class="io-r">무게·PP(g/개)</th><th class="io-r">은 함유량(%)</th><th class="io-r">은(g/개)</th>{% if bag_table %}<th title="한 박스에 몇 개">박스당 수량</th><th title="한 파렛트에 몇 박스">1파렛트당 박스 수량</th>{% elif boxes_ready %}<th title="통이 한 박스에 몇 개">통 수량(박스)</th><th title="뚜껑이 한 박스에 몇 개 — 뚜껑이 없으면 빈칸">뚜껑 수량(박스)</th>{% endif %}{% if groups_ready %}<th>색상</th>{% endif %}<th></th></tr></thead>
|
||||
<colgroup><col class="w-code" /><col />{% if groups_ready %}<col class="w-group" />{% endif %}{% if not bag_table %}<col class="w-num" /><col class="w-num" /><col class="w-num" /><col class="w-ag" />{% endif %}{% if boxes_ready %}<col class="w-box" /><col class="w-box" />{% endif %}{% if groups_ready %}<col class="w-color" />{% endif %}<col class="w-del" /></colgroup>
|
||||
<thead><tr><th>코드</th><th>제품명</th>{% if groups_ready %}<th>그룹</th>{% endif %}{% if not bag_table %}<th class="io-r">단가(원)</th><th class="io-r">무게·PP(g/개)</th><th class="io-r">은 함유량(%)</th><th class="io-r">은(g/개)</th>{% endif %}{% if bag_table %}<th title="한 박스에 몇 개">박스당 수량</th><th title="한 파렛트에 몇 박스">1파렛트당 박스 수량</th>{% elif boxes_ready %}<th title="통이 한 박스에 몇 개">통 수량(박스)</th><th title="뚜껑이 한 박스에 몇 개 — 뚜껑이 없으면 빈칸">뚜껑 수량(박스)</th>{% endif %}{% if groups_ready %}<th>색상</th>{% endif %}<th></th></tr></thead>
|
||||
<tbody>
|
||||
{% for p in rows %}
|
||||
{% set own_pct = p.own_silver_pct if groups_ready else p.silver_pct %}
|
||||
<tr data-code="{{ p.item_code }}" data-search="{{ (p.item_code ~ ' ' ~ p.item_name ~ ' ' ~ (p.group_name or ''))|lower }}"{% if groups_ready and p.group_id %} class="is-grouped"{% endif %}>
|
||||
<td class="io-code">{{ p.item_code }}</td>
|
||||
<td class="io-code">{{ p.item_code }}{% if bag_table %}
|
||||
{# 봉투·백엔 단가·무게·은 칸이 없다 — 전에 넣은 값이 저장 때 지워지지 않게 숨은 칸으로 그대로 보낸다 #}
|
||||
<input type="hidden" data-key="unit_price" value="{{ fmt_num(p.unit_price) if p.unit_price is not none else '' }}" />
|
||||
<input type="hidden" data-key="weight_g" value="{{ fmt_num(p.weight_g) if p.weight_g is not none else '' }}" />
|
||||
<input type="hidden" data-key="silver_pct" value="{{ fmt_num(own_pct, 4) if own_pct is not none else '' }}" />{% endif %}</td>
|
||||
<td class="io-prod-name">{{ p.item_name }}</td>
|
||||
{% if groups_ready %}
|
||||
<td><select class="io-in io-group-select" data-key="group_id" aria-label="{{ p.item_code }} 그룹">
|
||||
@@ -172,11 +176,13 @@
|
||||
{% for g in groups %}<option value="{{ g.id }}" data-silver="{{ fmt_num(g.silver_pct, 4) if g.silver_pct is not none else '' }}" data-color="{{ g.color }}" {% if p.group_id == g.id %}selected{% endif %}>{{ g.name }}</option>{% endfor %}
|
||||
</select></td>
|
||||
{% endif %}
|
||||
{% if not bag_table %}
|
||||
<td><input class="io-in io-in-num" data-key="unit_price" value="{{ fmt_num(p.unit_price) if p.unit_price is not none else '' }}" inputmode="decimal" aria-label="{{ p.item_code }} 단가" /></td>
|
||||
<td><input class="io-in io-in-num" data-key="weight_g" value="{{ fmt_num(p.weight_g) if p.weight_g is not none else '' }}" inputmode="decimal" aria-label="{{ p.item_code }} 무게" /></td>
|
||||
<td><input class="io-in io-in-num io-own" data-key="silver_pct" value="{{ fmt_num(own_pct, 4) if own_pct is not none else '' }}" inputmode="decimal" aria-label="{{ p.item_code }} 은 함유량" />
|
||||
{% if groups_ready %}<span class="io-group-val io-r" title="그룹 값 — 그룹에서 바꿉니다">{{ fmt_num(p.silver_pct, 4) if p.silver_pct is not none else '-' }}</span>{% endif %}</td>
|
||||
<td class="io-r io-ag" title="무게 × 은 함유량 ÷ 100">{{ fmt_num(p.silver_g, 4) if p.silver_g is not none else '-' }}</td>
|
||||
{% endif %}
|
||||
{% if bag_table %}
|
||||
<td><input class="io-in io-in-num" data-key="body_per_box" value="{{ '{:,}'.format(p.body_per_box) if p.body_per_box else '' }}" inputmode="numeric" aria-label="{{ p.item_code }} 박스당 수량" /></td>
|
||||
<td><input class="io-in io-in-num" data-key="boxes_per_pallet" value="{{ '{:,}'.format(p.boxes_per_pallet) if p.boxes_per_pallet else '' }}" inputmode="numeric" aria-label="{{ p.item_code }} 1파렛트당 박스 수량" /></td>
|
||||
|
||||
@@ -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=20261104a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104b" />{% 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=20261104a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104b" defer></script>{% endblock %}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</footer>
|
||||
</dialog>
|
||||
{%- endmacro -%}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104b" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% set active = order.status in ('open', 'partial') %}
|
||||
@@ -262,4 +262,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104b" defer></script>{% endblock %}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% extends "erp_base.html" %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104b" />{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="io-split">{# 2열 — 왼쪽 화면 | 오른쪽 달력(2026-10-21) #}
|
||||
@@ -101,4 +101,4 @@
|
||||
{% include "inout/_calendar.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104b" 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=20261104a" />{% endblock %}
|
||||
{% block head_extra %}<link rel="stylesheet" href="/static/inout.css?v=20261104b" />{% 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=20261104a" defer></script>{% endblock %}
|
||||
{% block scripts %}<script src="/static/inout.js?v=20261104b" defer></script>{% endblock %}
|
||||
|
||||
+5
-5
@@ -140,7 +140,7 @@
|
||||
const cell = tr.querySelector(".io-amount");
|
||||
// 금액 = 수량 × 단가(상품 정보 단가, 이미 있던 품목은 발주 당시 단가) — 표시만, 저장은 서버가 단가 사본으로
|
||||
if (cell) cell.textContent = has && price !== null && n ? (Math.round(price * n * 100) / 100).toLocaleString("ko-KR") : "-";
|
||||
if (has) { k++; q += n; if (price === null) missing++; else amount += price * n; }
|
||||
if (has) { k++; q += n; if (price !== null) amount += price * n; else if (tr.dataset.bag !== "1") missing++; } // 봉투·백은 단가가 원래 없음
|
||||
const bx = boxCell(tr, n, has);
|
||||
if (has && tr.dataset.bag === "1") {
|
||||
const cap = parseInt(tr.dataset.palletBox || "0", 10) || 0;
|
||||
@@ -511,13 +511,13 @@
|
||||
const opt = sel.options[sel.selectedIndex];
|
||||
const grouped = !!sel.value;
|
||||
tr.classList.toggle("is-grouped", grouped);
|
||||
const vals = tr.querySelectorAll(".io-group-val");
|
||||
if (vals[0]) vals[0].textContent = (opt && opt.dataset.silver) || "-";
|
||||
if (vals[1]) {
|
||||
const silverVal = tr.querySelector(".io-group-val.io-r"), colorVal = tr.querySelector(".io-color.io-group-val"); // 봉투·백 줄엔 은 칸 없음
|
||||
if (silverVal) silverVal.textContent = (opt && opt.dataset.silver) || "-";
|
||||
if (colorVal) {
|
||||
const key = (opt && opt.dataset.color) || "none";
|
||||
const csel = tr.querySelector(".io-color-select");
|
||||
const copt = csel && Array.from(csel.options).find(function (o) { return o.value === key; });
|
||||
const sw = vals[1].querySelector(".io-swatch"), nm = vals[1].querySelector(".io-color-name");
|
||||
const sw = colorVal.querySelector(".io-swatch"), nm = colorVal.querySelector(".io-color-name");
|
||||
if (sw) { sw.style.background = (copt && copt.dataset.hex) || "#fff"; sw.classList.toggle("is-none", !(copt && copt.dataset.hex)); }
|
||||
if (nm) nm.textContent = copt ? copt.textContent : "";
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ cupang·malaysia 와 같은 DSN). 화면에서 코드·이름으로 검색(`GET
|
||||
## 6-3-3. 봉투·백 박스·파렛트(2026-11-04, 마이그레이션 008)
|
||||
|
||||
- 사용자 요청: 상품 정보에서 이름에 **"미라클 봉투"·"미라클백"** 이 들어간 상품은 **박스당 수량**·**1파렛트당 박스 수량**을 넣도록 일반 상품과 분리.
|
||||
- 구분은 이름으로(`store.is_bag`, 저장 안 함). 옵션 → 상품 정보에 봉투·백 표를 따로 두고(위), 나머지 칸(단가·무게·은·그룹·색상)은 일반 상품과 같다.
|
||||
- 구분은 이름으로(`store.is_bag`, 저장 안 함). 옵션 → 상품 정보에 봉투·백 표를 따로 두고(위), 단가·무게·은 칸은 없다(같은 날 추가 요청 — 전에 넣은 값은 숨은 칸으로 유지). 그룹·색상 칸은 일반 상품과 같다.
|
||||
- 저장: 박스당 수량 = 기존 `body_per_box`, 1파렛트당 박스 수량 = 새 열 `boxes_per_pallet`. 봉투·백을 저장하면 `lid_per_box` 는 NULL.
|
||||
- 계산(새 발주서 합계 줄, `inout.js`, 요청에 명시되지 않아 구현 때 정함): 봉투·백은 통·뚜껑 파렛트(1파렛트 30박스)와 **따로** — 박스 = ⌈수량 ÷ 박스당 수량⌉, 파렛트 = ⌈Σ(박스 ÷ 그 상품의 1파렛트당 박스 수량)⌉. 값이 빠진 상품은 몇 종 빠졌는지 표시. 발주 메일에는 넣지 않음.
|
||||
|
||||
|
||||
@@ -126,6 +126,10 @@ class ProductValueTests(unittest.TestCase):
|
||||
self.assertEqual((t["amount"], t["missing_price"], t["pp_kg"], t["silver_g"]), (D("8550.00"), 1, D("2.45"), D("12.25")))
|
||||
empty = s.order_totals([{"qty": 5}]) # 004 전 발주서(값 칸 없음)
|
||||
self.assertEqual((empty["amount"], empty["missing_price"], empty["pp_kg"], empty["silver_g"]), (None, 1, None, None))
|
||||
# 봉투·백은 단가가 원래 없음 — "단가 미입력" 안내에 안 잡힘
|
||||
bag = {"qty": 5, "unit_price": None, "item_name": "미라클백 2.5L"}
|
||||
self.assertEqual(s.order_totals([bag])["missing_price"], 0)
|
||||
self.assertEqual(s.order_totals([bag, {"qty": 5, "unit_price": None, "item_name": "통"}])["missing_price"], 1)
|
||||
|
||||
def test_parse_and_validate(self):
|
||||
from decimal import Decimal as D
|
||||
|
||||
@@ -439,9 +439,14 @@ def body(c):
|
||||
assert 'data-key="boxes_per_pallet"' in bag_row and 'data-key="lid_per_box"' not in bag_row
|
||||
assert 'data-key="boxes_per_pallet"' not in box_row and 'data-key="lid_per_box"' in box_row
|
||||
assert panel.index('data-code="%s"' % BAG) < panel.index("일반 상품") < panel.index('data-code="%s"' % BOX)
|
||||
# 봉투·백 표엔 단가·무게·은 칸이 없다(일반 상품 표에만) — 전에 넣은 값은 숨은 칸으로 남아 저장해도 안 지워짐
|
||||
assert panel.count("단가(원)</th>") == 1 and panel.count("은(g/개)</th>") == 1
|
||||
assert 'class="io-ag"' not in bag_row and 'io-ag' not in bag_row and 'io-in-num" data-key="unit_price"' not in bag_row
|
||||
assert 'io-in-num" data-key="unit_price"' in box_row
|
||||
r = c.post("/inout/settings/products/save", headers={"X-Inout-Options": "1"}, json={"rows": [
|
||||
{"code": BAG, "unit_price": "", "weight_g": "", "silver_pct": "", "body_per_box": "1,000", "boxes_per_pallet": "40"}]})
|
||||
{"code": BAG, "unit_price": "1500", "weight_g": "", "silver_pct": "", "body_per_box": "1,000", "boxes_per_pallet": "40"}]})
|
||||
assert r.status_code == 200 and r.json()["ok"], r.text
|
||||
assert 'type="hidden" data-key="unit_price" value="1,500"' in c.get("/inout/settings?panel=1").text
|
||||
item = c.get("/inout/api/items?q=" + BAG).json()["items"][0]
|
||||
assert (item["is_bag"], item["body_per_box"], item["lid_per_box"], item["boxes_per_pallet"]) == (True, 1000, None, 40)
|
||||
r = c.post("/inout/settings/products/save", headers={"X-Inout-Options": "1"}, json={"rows": [
|
||||
|
||||
Reference in New Issue
Block a user