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

This commit is contained in:
2026-09-07 01:05:30 +09:00
+33 -27
View File
@@ -352,8 +352,8 @@ async def run_redesign_chain(
from B06_Section.B06_Section_Repository import ( from B06_Section.B06_Section_Repository import (
get_cross_section_designs, get_cross_section_designs,
get_longitudinal_section, get_longitudinal_section,
update_cross_section_design,
) )
from B06_Section.B06_Section_Repository_Bulk import merge_cross_section_designs
from B06_Section.B06_Section_Router_Confirm import confirm_sections from B06_Section.B06_Section_Router_Confirm import confirm_sections
from B06_Section.B06_Section_Schema import SectionConfirmRequest from B06_Section.B06_Section_Schema import SectionConfirmRequest
from common_util.common_util_initial_snapshot import ( from common_util.common_util_initial_snapshot import (
@@ -468,33 +468,11 @@ async def run_redesign_chain(
new_route_id, new_route_id,
) )
# 3) 옛 측점별 사용자 설계를 chainage 매칭으로 새 경로에 이월(비치명적). # 3) 옛 측점별 사용자 설계 이월은 **측점을 다시 만든 뒤**(아래 5) 한다.
# 여기서 하면 `_prepare_drainage_pipes_and_reprofile(refresh=True)` 가 측점을
# 새로 만들며 덮어써 값이 사라진다(2026-09-06 실측: 다단 구간값 `extra_spans` 가
# 노선 변경 뒤 0건이 됐음). 옛 설계는 `old_designs` 로 이미 손에 있다.
carried = 0 carried = 0
try:
async with pool.acquire() as connection:
await connection.begin()
try:
for record in old_designs:
design = record.get("design")
if not isinstance(design, dict):
continue
await update_cross_section_design(
connection,
route_id=new_route_id,
chainage_m=float(record["chainage_m"]),
design=design,
project_id=project_id,
)
carried += 1
await connection.commit()
except Exception:
await connection.rollback()
raise
except Exception:
logger.exception(
"재확정 체인 — 옛 설계 이월 실패(계속 진행): project_id=%s", project_id
)
logger.info("재확정 체인 설계 이월: project_id=%s %d", project_id, carried)
# 4) B05 확정 → B06 확정(옛 표준단면 설정 이월, 미지정 측점 기본값 채움). # 4) B05 확정 → B06 확정(옛 표준단면 설정 이월, 미지정 측점 기본값 채움).
# 재확정 후에도 stage 2·3은 IN_PROGRESS로 남겨 사용자 재검토를 받는다. # 재확정 후에도 stage 2·3은 IN_PROGRESS로 남겨 사용자 재검토를 받는다.
@@ -510,6 +488,34 @@ async def run_redesign_chain(
# 계획선을 앉히면 전부 어긋나고, 저장분은 노선 변경을 스스로 알지 못한다. # 계획선을 앉히면 전부 어긋나고, 저장분은 노선 변경을 스스로 알지 못한다.
await _prepare_drainage_pipes_and_reprofile(project_id, new_route_id, refresh=True) await _prepare_drainage_pipes_and_reprofile(project_id, new_route_id, refresh=True)
# 5) 이제 측점이 새 노선 기준으로 다 섰다 — 옛 사용자 설계를 **누가거리로** 얹는다.
# 묶어 쓰므로 행 수와 무관하게 왕복 두 번이다(`merge_cross_section_designs`).
try:
entries = [
(float(record["chainage_m"]), record["design"])
for record in old_designs
if isinstance(record.get("design"), dict)
]
async with pool.acquire() as connection:
await connection.begin()
try:
carried = await merge_cross_section_designs(
connection,
route_id=new_route_id,
entries=entries,
replace=True,
project_id=project_id,
)
await connection.commit()
except Exception:
await connection.rollback()
raise
except Exception:
logger.exception(
"재확정 체인 — 옛 설계 이월 실패(계속 진행): project_id=%s", project_id
)
logger.info("재확정 체인 설계 이월: project_id=%s %d", project_id, carried)
old_options = ((old_longitudinal or {}).get("data") or {}).get("options") or {} old_options = ((old_longitudinal or {}).get("data") or {}).get("options") or {}
section_request = ( section_request = (
SectionConfirmRequest(standard_cross_section=old_options["standard_cross_section"]) SectionConfirmRequest(standard_cross_section=old_options["standard_cross_section"])