Merge remote-tracking branch 'origin/dev' into main_laptop_1

This commit is contained in:
2026-09-14 02:43:18 +09:00
22 changed files with 1289 additions and 35 deletions
+49 -1
View File
@@ -39,7 +39,18 @@ PRACTICE = ROOT / "resources" / "knowledge" / "original" / "실무문서"
def _workbooks() -> tuple[tuple[str, dict[str, list[tuple]]], ...]:
"""실무 XLSX 마다 쓰는 시트만 값으로 읽어 둠(한 번). `(상대 경로, {시트: 줄들})`."""
openpyxl = pytest.importorskip("openpyxl")
wanted = ("환율및기초자료", "중기사용료", "단가산출근거", "일위대가표", "설계내역서")
wanted = (
"환율및기초자료",
"중기사용료",
"단가산출근거",
"일위대가표",
"설계내역서",
"재료비수량금액집계표",
"노무비수량금액집계표",
"경비수량금액집계표",
"중기시간금액집계표",
"중기목록표",
)
found = []
for path in sorted(PRACTICE.rglob("*.xlsx")):
if path.name.startswith("~$"):
@@ -391,3 +402,40 @@ def test_내역_줄_금액은_성분마다_절사한_합() -> None:
misses.append((name, row[1], want, got))
assert len(rows) >= 300, len(rows)
assert not misses, (len(misses), misses[:5])
def test_집계표_금액은_반올림_중기는_성분마다_반올림한_합() -> None:
"""집계표 넷 — 재료·노무·경비는 `반올림(수량 × 단가)`, 중기는 **성분마다 반올림한 뒤 합**(단가 열 없음).
실측 — 자원 셋 279/279 · 중기 131/144(합계 한 번에 반올림 107/144). 중기 짝은 목록표 명칭·규격으로 찾음
(같은 명칭·규격이 갈래로 둘인 기종은 짝이 흔들림 — 규칙 탓 아님).
"""
from B09_Estimation.B09_Estimation_Lists import machine_summary_amounts
from B09_Estimation.B09_Estimation_Rounding import OutputPlace, round_at
resource, machine, machine_hits = 0, 0, 0
for _name, sheets in _workbooks():
for sheet in ("재료비수량금액집계표", "노무비수량금액집계표", "경비수량금액집계표"):
for row in sheets.get(sheet, []):
quantity, price, amount = _num(row[3]), _num(row[5]), _num(row[6])
if quantity is None or price is None or amount is None:
continue
resource += 1
assert round_at(quantity * price, OutputPlace.RESOURCE_SUMMARY) == amount, row
units = {
(row[1], row[2]): Money3(_num(row[6]), _num(row[5]), _num(row[7]))
for row in sheets.get("중기목록표", [])
if _num(row[4]) is not None
}
for row in sheets.get("중기시간금액집계표", []):
quantity = _num(row[3])
if quantity is None or (row[1], row[2]) not in units:
continue
machine += 1
parts = machine_summary_amounts(units[(row[1], row[2])], quantity)
got = (sum(parts.values()), parts["labor"], parts["material"], parts["expense"])
machine_hits += got == tuple(_num(v) or Decimal(0) for v in row[5:9])
if not resource:
pytest.skip("실무 원본 XLSX 가 없음")
assert resource >= 250 and machine >= 100, (resource, machine)
assert machine_hits >= machine * 0.9, (machine_hits, machine)