refactor(858 5-8 ②): 서고 옛 꼴 읽기 변환 · 부르는 곳 0 걷음
- 옛 꼴 읽기 변환 걷음(요구 899 — 옛 꼴 호환 없음 · storage 전 층 서고 문서 20 · 프로젝트 사본 = 칸 없는 문서 0 · 옛 품셈 분류 0 · 옛 단가승격 참조 0 · promote 파일 0): `Labor_Ref.filled`(51-12 · 134-5 칸 채움) · `unpromote`(134-2 승격 참조 → 로직 줄) · 층 양식 읽기 길의 두 부름 · `summary` 의 칸 채움 - 부르는 곳 0(저장소 전체 · 시험 포함 다시 셈): `Template_Layers.note_source` · 내 기계 글 키 9(Copied · Win_Edit · Win_Blank · Win_Ok · Win_Cancel · Win_Edit_Note · Win_Uses · Why_M01 · Why_Company) - 남김: `Library_Delete._restore`(부르는 곳이 store.batch 안 · 되돌림을 batch 가 맡게 하려면 Store 몸을 고쳐야 함 — 이번 몫 밖) · 주석만 고침 - 시험: 걷은 두 변환만 붙들던 시험 지움(labor_ref 옛 참조 줄 셋 · 칸 채움 단언 · precombo_class 옛 품셈 분류 하나) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
자리 = 층 양식 길 종류(`M02_Template_Layers.LIBRARY_KINDS`) — 파일 이름 = 키:
|
||||
promote 옛 단가승격 `{층}/promote/SP-######.json`(134-2 · 새로 안 만듦 · 읽기 · 셈만) —
|
||||
`{종류:"단가승격", 키, 이름, 단위, 배, 담은로직:[{로직, 입력값}]}` · 값 = 로직 기준 ÷ 배 ·
|
||||
층 문서를 읽을 때 옛 참조 줄 = 로직 줄 + `승격`(`unpromote`) · 프로젝트 사본은 그대로 셈
|
||||
프로젝트 사본은 그대로 셈
|
||||
precombo `{층}/precombo/SC-######.json` 사전조합
|
||||
`{종류:"사전조합", 키, 이름, 단위, 본뜬, 담은로직:[{참조, 수량:{손}, 메모}
|
||||
| {로직, 입력값, 메모, 수량:{손}, 고름?, 자재표시?}], 자재:[일위대가 자재 꼴]}` —
|
||||
@@ -247,55 +247,6 @@ def saved_qty(one: dict[str, Any]) -> dict[str, Any]:
|
||||
return {**one, "수량": {SAVED: hand}}
|
||||
|
||||
|
||||
_OLD_CLASS = re.compile(r"품셈") # 134-5 — 옛 품셈 분류(건설품셈 공통 · 산림품셈 · 07장 …)
|
||||
|
||||
|
||||
def filled(kind: str, doc: Any) -> Any:
|
||||
"""옛 서고 문서 읽을 때 칸 채움 — 칸 없음(51-12 앞) · 옛 품셈 분류(134-5) = 빈 글(미분류) ·
|
||||
파일은 안 고침([저장] 때 굳음) · 그 밖 지금 값 그대로(구조물정의가 바뀌어도 화면이 선택지로 둠)."""
|
||||
if not isinstance(doc, dict) or kind not in PREFIX:
|
||||
return doc
|
||||
if "구분" in doc and not _OLD_CLASS.search(str(doc.get("구분") or "")):
|
||||
return doc
|
||||
return {**doc, "구분": "", "상세구분": ""}
|
||||
|
||||
|
||||
def unpromote(kind: str, doc: Any) -> Any:
|
||||
"""층 문서를 읽을 때(134-2) — 옛 단가승격 참조 줄 → 로직 줄 `{로직, 입력값, 켜쌓기율, 수량}` +
|
||||
일위대가면 `승격: true`(사전조합 안 로직 줄엔 없음) · 값 같음(승격 값 = 기준 ÷ 배 = 로직 줄 반영) ·
|
||||
같은 로직 줄이 이미 있으면 그 줄은 옛 참조 그대로(읽기 · 셈 · 저장 됨) · 파일은 안 고침([저장] 때 굳음)."""
|
||||
lines = doc.get("담은로직") if isinstance(doc, dict) and kind in ("labor", "precombo") else None
|
||||
if not isinstance(lines, list):
|
||||
return doc
|
||||
have = {str(one.get("로직")) for one in lines if isinstance(one, dict) and one.get("로직")}
|
||||
out, changed = [], False
|
||||
for one in lines:
|
||||
ref = one.get("참조") if isinstance(one, dict) else None
|
||||
src = (
|
||||
read_ref(ref) if isinstance(ref, dict) and kind_of(ref.get("키")) == "promote" else None
|
||||
)
|
||||
line = ((src or {}).get("담은로직") or [None])[0]
|
||||
code = str(line.get("로직") or "") if isinstance(line, dict) else ""
|
||||
if not code or code in have:
|
||||
out.append(one)
|
||||
continue
|
||||
have.add(code)
|
||||
changed = True
|
||||
# ponytail: 수량 null(면적산출 칸 연결)은 알약 키가 로직 것으로 바뀌어 칸을 다시 이어야 함
|
||||
out.append(
|
||||
{
|
||||
"로직": code,
|
||||
"별칭": one.get("별칭"),
|
||||
"메모": one.get("메모"),
|
||||
"입력값": dict(line.get("입력값") or {}),
|
||||
"수량": one.get("수량"),
|
||||
**{k: line[k] for k in ("켜쌓기율", "고름") if line.get(k) is not None},
|
||||
**({"승격": True} if kind == "labor" else {}),
|
||||
}
|
||||
)
|
||||
return {**doc, "담은로직": out} if changed else doc
|
||||
|
||||
|
||||
def _combo_lines(doc: dict, key: str) -> list[dict[str, Any]]:
|
||||
"""참조 줄 `{참조, 수량, 메모}` · 로직 줄 `{로직, 입력값, 메모, 수량}`(51-11) — 검사는
|
||||
일위대가와 같은 길(`labor.clean` · 같은 로직 · 같은 참조 두 번 · 입력값) · 수량 기본 {손: 1}."""
|
||||
@@ -404,7 +355,7 @@ def summary(
|
||||
"""층 목록 한 줄에 붙일 것 — `{제목, 단위, 구분, 상세구분, 연결}`(51-12) · `expand` 면
|
||||
1 단위 기준 계(`기준금액` · 51-4)."""
|
||||
try:
|
||||
doc = filled(kind, json.loads((Path(folder) / kind / f"{key}.json").read_bytes()))
|
||||
doc = json.loads((Path(folder) / kind / f"{key}.json").read_bytes())
|
||||
except (OSError, ValueError):
|
||||
return {}
|
||||
keep = ("구분", "상세구분", "연결")
|
||||
|
||||
Reference in New Issue
Block a user