fix(b09): 운반공 줄 이름 = 거리이정표 항목명 그대로 · 행마다 개별 줄 (261-4)
- 「운반」 덧붙임 없앰 · 빈 항목명 = 거래처 · 그것도 없으면 묶음 이름 · 「운반」
- 자동 상자 둘째 행부터 `haul:{묶음}.n` 개별 줄(묶음 줄 바로 뒤 · 수량 빈칸)
- 시험 기대값 고침(253_1 · 251_1 · 145_3) · 새 시험 test_261_4
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JywHxQuWPk6UYXTebyrBoU
This commit is contained in:
@@ -111,48 +111,45 @@ def haul_items(
|
||||
routes: list[dict[str, Any]] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""운반공 줄 — B08 운반 묶음(251-1 · 장비 둘 + 총괄자재 묶음 · 옛 키 haul:1~6 그대로) +
|
||||
거리이정표 사용자 상자 행(253-1 · `B08_Quantity_Haul.haul_rows` · 수량 빈칸) ·
|
||||
거리이정표 행(253-1 · `B08_Quantity_Haul.haul_rows` · 행 하나 = 줄 하나 · 둘째 행부터 수량 빈칸) ·
|
||||
이름 = 거리이정표 항목명 그대로(261-4 · 「운반」 안 붙임 · 비면 거래처 · 그것도 없으면 묶음 이름 · 「운반」) ·
|
||||
연결 = 거리이정표 단가연결(251-5 · `refs{줄 키: ref}` · 설계내역서 연결 덮개가 이김) ·
|
||||
`dist{L1, L2}` = 그 행 거리(253-3 「운반 단가」 모달 · 없으면 None)."""
|
||||
dists = {r["key"]: {"L1": r.get("L1"), "L2": r.get("L2")} for r in routes or []}
|
||||
rows = routes or []
|
||||
by_key = {r["key"]: r for r in rows}
|
||||
extra: dict[str, list[dict[str, Any]]] = {} # 자동 상자 둘째 행부터 — 묶음 줄 바로 뒤
|
||||
for r in rows:
|
||||
if r.get("haul") and r["key"] != bill_key(str(r["haul"])):
|
||||
extra.setdefault(str(r["haul"]), []).append(r)
|
||||
|
||||
def line(key: str, name: str, unit: str, qty: Any, note: str) -> dict[str, Any]:
|
||||
ref = (refs or {}).get(key)
|
||||
route = by_key.get(key) or {}
|
||||
return {
|
||||
"key": key,
|
||||
"section": "3",
|
||||
"name": name,
|
||||
"spec": "",
|
||||
"unit": unit,
|
||||
"qty": qty,
|
||||
"note": note,
|
||||
"ref": ref,
|
||||
"dist": {"L1": route["L1"], "L2": route["L2"]} if route else None,
|
||||
"why": WHY_LOGIC if (ref or {}).get("tab") == "logic" else WHY_HAUL,
|
||||
}
|
||||
|
||||
out = []
|
||||
for g in haul_groups(materials):
|
||||
qty = g["qty"]
|
||||
ref = (refs or {}).get(bill_key(g["key"]))
|
||||
logic = (ref or {}).get("tab") == "logic"
|
||||
key = bill_key(g["key"])
|
||||
name = (by_key.get(key) or {}).get("name") or g["name"]
|
||||
out.append(
|
||||
{
|
||||
"key": bill_key(g["key"]),
|
||||
"section": "3",
|
||||
"name": f"{g['name']}운반",
|
||||
"spec": "",
|
||||
"unit": g["unit"],
|
||||
"qty": qty,
|
||||
"note": "B08 총괄자재" if qty is not None else "",
|
||||
"ref": ref,
|
||||
"dist": dists.get(bill_key(g["key"])),
|
||||
"why": WHY_LOGIC if logic else WHY_HAUL,
|
||||
}
|
||||
)
|
||||
for r in routes or []:
|
||||
if not r.get("user"):
|
||||
continue
|
||||
ref = (refs or {}).get(r["key"])
|
||||
logic = (ref or {}).get("tab") == "logic"
|
||||
out.append(
|
||||
{
|
||||
"key": r["key"],
|
||||
"section": "3",
|
||||
"name": r["name"],
|
||||
"spec": "",
|
||||
"unit": "",
|
||||
"qty": None,
|
||||
"note": "B08 거리이정표",
|
||||
"ref": ref,
|
||||
"dist": dists.get(r["key"]),
|
||||
"why": WHY_LOGIC if logic else WHY_HAUL,
|
||||
}
|
||||
line(key, name, g["unit"], g["qty"], "B08 총괄자재" if g["qty"] is not None else "")
|
||||
)
|
||||
for r in extra.get(g["key"], []):
|
||||
out.append(line(r["key"], r.get("name") or g["name"], "", None, "B08 거리이정표"))
|
||||
for r in rows:
|
||||
if r.get("user"):
|
||||
out.append(line(r["key"], r.get("name") or "운반", "", None, "B08 거리이정표"))
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user