feat(inout): 박스 입수·파렛트 계산·상품 그룹 탭·달력 다시 그리기 줄임
- 옵션 상품 그룹을 별도 탭으로, 상품 정보 제목 행 가운데·굵게·110% - 상품 정보에 통 수량(박스)·뚜껑 수량(박스)(마이그레이션 007, 뚜껑 없으면 빈칸) - 새 발주서: 줄마다 통·뚜껑 박스 수와 공배수 힌트, 합계 박스 → 파렛트(30박스) 계산 (화면 계산만, 발주 메일은 그대로) - 메뉴를 옮겨도 달력은 sessionStorage 에서 바로 복원, 서버 값이 바뀔 때만 다시 그림 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -335,6 +335,40 @@ class InoutDbTests(unittest.TestCase):
|
||||
pass
|
||||
self.assertEqual(self.st.catalog_count(), before)
|
||||
|
||||
def test_box_quantities(self):
|
||||
"""007 — 통·뚜껑 박스 입수(뚜껑 없음 = 빈칸), 검사, 목록·검색·조회에 나오고, 넣은 상품은 다시 불러와도 그대로."""
|
||||
from app.modules.inout import store
|
||||
|
||||
if not self.st.boxes_ready():
|
||||
self.skipTest("inout_db 007 미적용")
|
||||
T = self.tag.upper()
|
||||
A, B = f"ZB-{T}-A", f"ZB-{T}-B"
|
||||
before = self.st.catalog_count()
|
||||
try:
|
||||
self.st.import_products([{"code": A, "name": "통"}, {"code": B, "name": "뚜껑없음"}], by="b@x")
|
||||
self.assertEqual(store.validate_box_values({"body_per_box": "1,200", "lid_per_box": ""}), {"body_per_box": 1200, "lid_per_box": None})
|
||||
for bad in ("0", "-3", "1.5", "abc"):
|
||||
with self.assertRaises(ValueError):
|
||||
store.validate_box_values({"body_per_box": bad})
|
||||
empty = {"unit_price": None, "weight_g": None, "silver_pct": None}
|
||||
self.st.save_products([{"code": A, **empty, **store.validate_box_values({"body_per_box": "120", "lid_per_box": "500"})},
|
||||
{"code": B, **empty, **store.validate_box_values({"body_per_box": "48", "lid_per_box": ""})}], by="b@x")
|
||||
got = self.st.catalog_lookup([A, B])
|
||||
self.assertEqual((got[A]["body_per_box"], got[A]["lid_per_box"], got[B]["body_per_box"], got[B]["lid_per_box"]), (120, 500, 48, None))
|
||||
self.assertEqual({x["item_code"]: x["body_per_box"] for x in self.st.catalog_search(f"ZB-{T}")}, {A: 120, B: 48})
|
||||
self.assertEqual({x["item_code"]: x["lid_per_box"] for x in self.st.list_products() if x["item_code"] in (A, B)}, {A: 500, B: None})
|
||||
self.assertEqual(self.st.import_products([{"code": B, "name": "새 이름"}], by="b@x")["kept"], 1) # 박스 입수만 넣어도 값 있는 상품
|
||||
# 박스 칸을 안 보낸 저장(예전 화면)은 박스 입수를 건드리지 않는다
|
||||
self.st.save_products([{"code": A, **empty}], by="b@x")
|
||||
self.assertEqual(self.st.catalog_lookup([A])[A]["body_per_box"], 120)
|
||||
finally:
|
||||
for code in (A, B):
|
||||
try:
|
||||
self.st.exclude_product(code, by="cleanup@x")
|
||||
except ValueError:
|
||||
pass
|
||||
self.assertEqual(self.st.catalog_count(), before)
|
||||
|
||||
def test_product_groups_colors_and_calendar(self):
|
||||
"""006 — 그룹의 은 함유량·색상이 그룹 상품에 적용(그룹 없는 상품은 자기 값), 같은 이름 거절, 발주 품목 색상 사본,
|
||||
메일 품목 줄 배경, 그룹 지우면 자기 값으로, 다시 불러와도 그룹·색상만 넣은 상품은 그대로. 달력 = 발주일·입고일(취소 제외)."""
|
||||
|
||||
Reference in New Issue
Block a user