diff --git a/B08_Quantity/B08_Quantity_Router_Earthwork.py b/B08_Quantity/B08_Quantity_Router_Earthwork.py index 0251e050..a1aff6f9 100644 --- a/B08_Quantity/B08_Quantity_Router_Earthwork.py +++ b/B08_Quantity/B08_Quantity_Router_Earthwork.py @@ -160,6 +160,10 @@ def _spoil_of(plan: dict[str, Any] | None, settings: dict[str, Any]) -> dict[str ⚠ `spoil_m3` 는 **공제·가산이 끝난 값**이다(채집석 공제는 빼고 구조물 잔토는 더한 뒤). 여기서 또 만지면 두 번 셈이 된다. ⚠ 자연방토(`natural_spoil_m3`)는 실어 내지 않는 몫이라 **뺀다**. + ⚠⚠ **상태가 갈린다.** 유토곡선 잔량은 **다짐상태**이고 품셈 운반(10-11·10-12)의 밑수는 + **자연상태**다(식이 `f = 1/L` 을 스스로 곱한다). 잔량이 되돌린 값 + (`natural_m3_by_ground`)을 들고 오면 **그것을 쓰고**, 없으면 다짐값으로 서되 그 사실을 + 근거에 적는다 — 조용히 쓰면 상태가 어긋난 물량이 단가에 물린다(2026-09-09 두 창 확인). """ haul_plan = (plan or {}).get("haul_plan") if isinstance(plan, dict) else None source = haul_plan if isinstance(haul_plan, dict) else (plan or {}) @@ -171,11 +175,17 @@ def _spoil_of(plan: dict[str, Any] | None, settings: dict[str, Any]) -> dict[str # 토사로 눅이면 덤프 단가가 임의로 정해진다. grounds: dict[str, float] = {} unknown = 0.0 + natural_basis = True for residual in source.get("residuals") or []: if str(residual.get("kind") or "") != "spoil": continue + # 되돌린 값이 오면 그것이 이긴다 — 우리가 다시 환산하지 않는다(계수가 저쪽에 있다). + returned = residual.get("natural_m3_by_ground") + source_map = returned if isinstance(returned, dict) else residual + if not isinstance(returned, dict): + natural_basis = False for key in ("ea_m3", "rr_m3", "br_m3"): - value = float(residual.get(key) or 0.0) + value = float(source_map.get(key) or source_map.get(key[:2]) or 0.0) if value > 0: grounds[key] = grounds.get(key, 0.0) + value unknown += float(residual.get("ground_unknown_m3") or 0.0) @@ -188,12 +198,20 @@ def _spoil_of(plan: dict[str, Any] | None, settings: dict[str, Any]) -> dict[str deducted = source.get("collected_stone_deducted_m3") if deducted: note_parts.append(f"채집석 {float(deducted):,.2f}㎥ 빠진 뒤") + if grounds and not natural_basis: + note_parts.append( + "⚠ 다짐상태 물량 — 품셈 운반 밑수는 자연상태라 유토곡선이 되돌린 값이 오면 그것을 씀" + ) + if unknown > 0: + note_parts.append(f"⚠ 갈래를 못 붙인 {unknown:,.2f}㎥ 는 상태도 못 되돌림") return { "volume_m3": round(volume, 3), "distance_m": settings.get("spoil_site_distance_m"), "note": " · ".join(note_parts), "by_ground_m3": {key: round(value, 3) for key, value in grounds.items()}, "ground_unknown_m3": round(unknown, 3), + # 어느 상태의 물량인가 — 받는 쪽이 단가와 맞는지 스스로 볼 수 있게 값으로 적는다. + "volume_basis": "natural" if natural_basis else "compacted", }