diff --git a/B08_Quantity/B08_Quantity_Router_Earthwork.py b/B08_Quantity/B08_Quantity_Router_Earthwork.py index f52240cf..a99b8f81 100644 --- a/B08_Quantity/B08_Quantity_Router_Earthwork.py +++ b/B08_Quantity/B08_Quantity_Router_Earthwork.py @@ -133,14 +133,22 @@ async def _project_settings(project_id: UUID) -> tuple[dict[str, Any], str | Non async def _stored_haul_plan(project_id: UUID, route_id: int) -> dict[str, Any] | None: - """정본에 남은 운반계획. [확정]을 아직 안 돌렸으면 없다.""" + """정본에 남은 **배분**(`mass_haul.haul_plan`). [확정]을 아직 안 돌렸으면 없다. + + ⚠ 정본에 저장되는 것은 유토곡선 한 벌(`mass_haul`)이고 **배분은 그 안의 `haul_plan`** 이다. + 바깥 껍데기를 그대로 넘기면 `blocks` 를 못 찾아 **운반 표가 영영 0줄**이 된다 — + [확정] 전에는 어차피 빈 표라 화면에서 티가 안 나던 자리다(2026-09-07 실증에서 잡음). + """ try: row = await run_with_connection(get_longitudinal_section, project_id, route_id) except Exception: logger.exception("B08 운반계획 조회 실패: route_id=%s", route_id) return None data = (row or {}).get("data") or {} - plan = data.get("mass_haul") if isinstance(data, dict) else None + mass_haul = data.get("mass_haul") if isinstance(data, dict) else None + if not isinstance(mass_haul, dict): + return None + plan = mass_haul.get("haul_plan") return plan if isinstance(plan, dict) and plan else None