feat(stmate-test): REA MCP(Ghidra) 파일 입출력 — JDL 탭 줄·묶음 내보내기·검사 · 구버전→Win8 변환 · 엑셀 역등록 구성 줄 · 자재 집계표 엑셀 · 그림 코드
- JDL 줄 = 탭 구분 + \x05/\x07 덧붙임(검사기 0x504d20 · 고정폭 표는 죽은 고리 — 34 §17.9 바로잡음) · 단가 목록 7종·Main·GongJong 머리·Global.Ini 상수 키 · zip 받기 - 구버전 판 가리기(Chk_Data 0x459280) · 7.x/DOS 표별 필드 대응 · B→X 조건 = 단위 X - 엑셀 역등록 PRPT「속성」·PRIN「대상」·PROUT「저장」 = PR/RR 줄만 · 원본 BDQTY 4건 일치 - 자재 = 재료비 수량집계표 엑셀 내보내기(주요건설자재현황 시트) - 그림 코드 = COSTN I 코드 IFORM · SIZE = 그림 클래스 이름 - 지식DB 37번 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,12 @@ def code_record(t: DbfTable, i: int, s: int) -> dict:
|
||||
"""FUN_00431758 꼴 코드 기록 — 계열 s 의 노무·재료·경비."""
|
||||
code = _s(t, i, "CODE")
|
||||
k = code[:1]
|
||||
rec = {"CODE": code, "NAME": _s(t, i, "NAME"), "SIZE": _s(t, i, "SIZE"), "UNIT": _s(t, i, "UNIT")}
|
||||
rec = {
|
||||
"CODE": code,
|
||||
"NAME": _s(t, i, "NAME"),
|
||||
"SIZE": _s(t, i, "SIZE"),
|
||||
"UNIT": _s(t, i, "UNIT"),
|
||||
}
|
||||
if k == "X":
|
||||
rec["UNIT"] = "시간"
|
||||
rec |= {"EQCODE": _s(t, i, "EQCODE"), "BQCODE": _s(t, i, "BQCODE"), "UC": _l(t, i, "UC")}
|
||||
@@ -89,13 +94,17 @@ def code_line(rec: dict, gun_ok: bool, gun: str) -> tuple[str, bytes] | None:
|
||||
head = [rec["CODE"], rec["NAME"], rec["SIZE"], unit]
|
||||
last = Raw(gun if (gun_ok and k in "MS") else " ")
|
||||
if k == "L":
|
||||
return name, build_line(head + [rec["L"], rec["EQCODE"], ""], [rec["BQCODE"], rec["UC"], *rec["AMT"], last])
|
||||
return name, build_line(
|
||||
head + [rec["L"], rec["EQCODE"], ""], [rec["BQCODE"], rec["UC"], *rec["AMT"], last]
|
||||
)
|
||||
if k == "M":
|
||||
pairs = [x for a, p in zip(rec["AMT"], rec["PG"]) for x in (a, p)]
|
||||
ext = [rec["BQCODE"], rec["UC"], *rec["AMT"], *rec["PG"], rec["PG_J"], rec["PG_S"], last]
|
||||
return name, build_line(head + [rec["M"], rec["EQCODE"], *pairs, "", "", ""], ext)
|
||||
if k == "S":
|
||||
return name, build_line(head + ["0", "0", rec["E"], rec["EQCODE"], ""], [rec["BQCODE"], rec["UC"], last])
|
||||
return name, build_line(
|
||||
head + ["0", "0", rec["E"], rec["EQCODE"], ""], [rec["BQCODE"], rec["UC"], last]
|
||||
)
|
||||
prices = [rec["M"], rec["L"], rec["E"], rec["EQCODE"]]
|
||||
if k == "W":
|
||||
return name, build_line(head + prices + [""], [rec["BQCODE"], rec["UC"]])
|
||||
@@ -125,7 +134,9 @@ def export_bundle(path: str, series: int | None = None, today: datetime.date | N
|
||||
s = series or SERIES_BY_PCLASS.get(pclass)
|
||||
if not s:
|
||||
raise ValueError(f"PCLASS {pclass} 의 계열 미확인 — series(1~4) 지정 필요")
|
||||
gun_ok = all(f in t.fields for f in ("GUN", "BAMT", "CAMT", "DAMT", "EAMT", "FAMT", "KAMT", "ZAMT"))
|
||||
gun_ok = all(
|
||||
f in t.fields for f in ("GUN", "BAMT", "CAMT", "DAMT", "EAMT", "FAMT", "KAMT", "ZAMT")
|
||||
)
|
||||
files: dict[str, bytearray] = {}
|
||||
warnings: list[str] = []
|
||||
rows = [i for i in range(len(t)) if not t.deleted(i)]
|
||||
@@ -146,7 +157,10 @@ def export_bundle(path: str, series: int | None = None, today: datetime.date | N
|
||||
head = build_line(["01", p.get(0, "PNAME"), 1, ""], ["", False, "", "", "", Raw("0")])
|
||||
files["GongJong.Txt"] = bytearray(head + b"\r\n")
|
||||
day = (today or datetime.date.today()).strftime("%Y%m%d")
|
||||
cost = [(k, p.get(0, f"{f}{s}")) for k, f in (("LCOST", "LCOST"), ("MCOST", "MCOST"), ("ECOST", "SCOST"))]
|
||||
cost = [
|
||||
(k, p.get(0, f"{f}{s}"))
|
||||
for k, f in (("LCOST", "LCOST"), ("MCOST", "MCOST"), ("ECOST", "SCOST"))
|
||||
]
|
||||
cost.append(("TCOST", p.get(0, f"TCOST{s}")))
|
||||
ini = [("BASIC", [("MAKER", "STM"), ("CDATE", day), ("JDL VERSION", "3.3")]), ("COST", cost)]
|
||||
ini.append(("CPART", CPART_CONST))
|
||||
|
||||
Reference in New Issue
Block a user