fix(b09): 내역 수량을 1-2-2 자리로 반올림해 확정한 뒤 금액(버림) — 표에 없는 종목 기본 2자리 · 철근 ton 소수 3자리(kg 정수 환산) · 단위 대소문자 흡수 · STmate 원본 수량 321줄 대조 시험

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BW6Jdsh18WPtYUR6THZJqn
This commit is contained in:
2026-09-14 11:55:23 +09:00
co-authored by Claude Opus 5
parent bd69aa4788
commit d6820db7b0
5 changed files with 93 additions and 18 deletions
@@ -31,6 +31,7 @@ from B09_Estimation.B09_Estimation_MachineProductivity_Dump import (
)
from B09_Estimation.B09_Estimation_MaterialPrices import manual_count
from B09_Estimation.B09_Estimation_PriceBook import Money3
from B09_Estimation.B09_Estimation_QuantityDigits import round_quantity
from B09_Estimation.B09_Estimation_Rounding import OutputPlace, round_at
from B09_Estimation.B09_Estimation_UnitPrice import (
UnitPriceBuild,
@@ -52,6 +53,17 @@ def bill_line(unit: Money3, quantity) -> Money3:
)
def settle_quantity(row: BillRow) -> Decimal:
"""수량을 품셈 1-2-2 자리로 **반올림해 확정**하고 그 값을 돌려줌 — 금액은 확정한 수량으로 셈.
산림청고시 2025-82호 1-2-2 [주]① 「설계서 수량의 단위와 소수자리 표시는 본 표에 따르며,
**반올림하여 적용**한다」 ⇒ 수량 먼저 확정 → 금액(`bill_line` 버림). 둘을 섞지 않음(2026-09-14
브레인 판정). 종전엔 인계 전정밀(0.28181999…96)로 곱해 원 미만 절사에 1원씩 샜음.
"""
row.quantity, _ = round_quantity(row.quantity, row.name, row.unit, row.spec)
return row.quantity
def _sum_groups(rows: list[BillRow]) -> None:
"""머리글 줄 금액 = 그 아래 줄 금액의 합(성분마다) — 실무 내역서 계 줄. 화면은 더하지 않음.
@@ -141,7 +153,7 @@ def _composite_row(
return row
money = money.floored(Decimal(1))
line = bill_line(money, item.quantity)
line = bill_line(money, settle_quantity(row))
_set_unit(row, money)
row.unit_price_krw = round_at(money.total, OutputPlace.UNIT_PRICE_ROW)
row.amount_krw = line.total
@@ -199,7 +211,7 @@ def _structure_price_row(
return row
# 단가 = 호표 계금(구조물도 화면과 같은 값) · 금액 = 호표 성분 소계 × 수량(명세 7장).
line = bill_line(entry["money"], item.quantity)
line = bill_line(entry["money"], settle_quantity(row))
_set_unit(row, entry["money"])
row.price_code = ref
row.parts = list(entry.get("parts") or [])
@@ -544,7 +556,7 @@ def _leaf_row(
row.price_code = price_code
unit_money = unit_prices.book.resolve(price_code)
line = bill_line(unit_money, item.quantity)
line = bill_line(unit_money, settle_quantity(row))
_set_unit(row, unit_money)
row.unit_price_krw = round_at(unit_money.total, OutputPlace.UNIT_PRICE_ROW)
# 내역서 **본체** 행은 성분마다 절사 — 집계표(반올림)와 어긋나는 것이 정상.