refactor(855-E 2-E1): M01 옛 셈 길 /calc · /text 걷음(M02 감싼 길 포함)

- 길 넷 걷음: POST /api/m01/calc · /text · /api/m02/logic-lib/calc · /text — 화면 부름 0(9c7807297 에 runCalc · runText 걷음) · 다른 서버 모듈 · B08 · B09 부름 0 · /openapi.json 480 → 476(이 넷만 빠짐)
- 본체 걷음: Store.calc · text · _swap · DRAFT · Store_Sheet.py(옛 /text 계산서 덧칸) · Router.CalcBody · _pct
- 남김: Store.mtx(B09 Sangeun_Text · M02 Logic_Settle 가 씀) · Store._logic_files(M02 Item_Source · Logic_Standard)
- 시험: 옛 엔진(B09 · M02 가 아직 씀)을 이 길 꼴로 보던 시험 11 파일은 새 도우미 helper_855_old_engine_routes(같은 몸 · 시험 전용 · 2-E4 에서 엔진과 같이 지움)를 앱에 붙임 · M01 시험 계산 길만 보던 test_149_4 한 시험 · test_717_1 M02 /calc 시험 지움
- 관련 1,158(1,105 + 다시 돈 실패 파일 151) 통과 · 빌더 --check 같음 · typecheck 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 04:32:15 +09:00
co-authored by Claude Opus 5.5
parent 9c78072971
commit c88ba7890a
17 changed files with 146 additions and 173 deletions
-40
View File
@@ -21,7 +21,6 @@ from M01_MasterData import M01_MasterData_Store as store
from M01_MasterData import M01_MasterData_Store_List as store_list
from M01_MasterData import M01_MasterData_RateSheet as rate_sheet
from M01_MasterData import M01_MasterData_Store_Make as make
from M01_MasterData import M01_MasterData_Store_Sheet as sheet
import master_basis as mbs # noqa: E402 (`store` 가 scripts 를 길에 둠)
@@ -31,16 +30,6 @@ if "pytest" not in sys.modules: # 시험은 사본 폴더를 써서 정본을
store.warm() # 서버가 뜰 때 뒤에서 마스터를 한 번 읽어 둠 — 첫 목록을 기다리지 않게
class CalcBody(BaseModel):
key: str
inputs: dict[str, Any] = {}
row: dict[str, Any] | None = None # 저장 전 고친 로직 줄(없으면 저장된 파일로)
file: str | None = None # 새 로직이면 더할 로직 파일
고름: dict[
str, str
] = {} # {호표 줄 차례(0부터): 자재 키} — 그 줄만 이 품목으로 셈 · 저장 안 함
class Change(BaseModel):
op: Literal["edit", "add", "delete"]
key: str | None = None
@@ -257,35 +246,6 @@ def post_machine_formula(row: dict[str, Any]) -> dict:
return _call(machine.formula, row)
@router.post("/calc")
def post_calc(body: CalcBody) -> dict:
with store.cm.mf.mp.choosing(body.고름):
got = _call(store.calc, body.key, body.inputs, body.row, body.file)
return _pct(got, body)
def _pct(got: dict, body: CalcBody) -> dict:
"""% 덧줄 표기(149-4) — 줄에 율 · 규격 덧칸(M02 일위대가 하위 행과 같은 도우미 · 금액 그대로)."""
if not got.get("lines"):
return got
from M02_MasterTemplete import M02_Labor_Doc as labor_doc # M02 가 M01 을 부름 — 늦게
whole = store.loaded()[1]
try:
logic = body.row or whole.logic(body.key)
except store.cm.mf.FormulaError:
return got
lines = labor_doc.pct_extras(whole, logic, got["lines"], got.get("middle") or {})
return {**got, "lines": _num(lines)} # 율 Decimal(4.0) 이 글자 「4.0」 으로 나가지 않게
@router.post("/text")
def post_text(body: CalcBody) -> dict:
"""읽는 식 줄 — 몸은 `/calc` 와 같음."""
with store.cm.mf.mp.choosing(body.고름):
return _call(sheet.text, body.key, body.inputs, body.row, body.file) # 줄 덧칸(714-1)
@router.post("/save")
def post_save(body: SaveBody) -> dict:
"""로직 정본 줄 고침 = 개정 확인 · 새 줄(키 없음)은 자체 GX — {files, added, warnings}."""