diff --git a/M01_MasterData/M01_MasterData_Machine.py b/M01_MasterData/M01_MasterData_Machine.py index fa6061d72..6de6ac86b 100644 --- a/M01_MasterData/M01_MasterData_Machine.py +++ b/M01_MasterData/M01_MasterData_Machine.py @@ -3,7 +3,8 @@ 계수 = `master_machine_coef`(TS 짝 `common_util/common_util_machine_coef.ts`) · 시간당 = 서버 기계경비식(`M02_Machine_Hourly.hourly` · 전국평균 · 기본 옵션) · -쓰는 계산식 = `M02_Machine_Hourly.pick`(목록 › 꼴 · 822-2) · [새 기계] 저장 = 꼴에 맞는 식 목록에 원문번호 등록 · +쓰는 계산식 = `M02_Machine_Hourly.pick`(목록 › 꼴 · 822-2) · [새 기계] 저장 = 꼴에 맞는 식 목록에 원문번호 등록 +(원문번호 빈 칸 = 「자체 EQ…」 받을 키) · M01 에서 만든 기계(출처 모두 「자체」)를 지우면 그 번호 기계가 더 없을 때 목록에서 뺌(`register`) · 마스터 파일은 읽기만 — 쓰기는 `Store_Make.save`. """ @@ -275,8 +276,18 @@ def fix(part: dict) -> None: return stored = {str(r.get("키")): r for r in _rows()} units = _units() + issue = int(store.mk.load_book(store.FOLDER / store.mk.BOOK.name)["다음"].get("EQ", 1)) for ch in part.get("changes") or []: row = ch.get("row") + if ( + ch.get("op") == "add" + and isinstance(row, dict) + and not str(row.get("원문번호") or "").strip() + ): + row["원문번호"] = ( + f"{OWN_SOURCE} EQ{issue:06d}" # 822-2 식 목록에 넣을 번호(빈 칸 = 받을 키) + ) + issue += 1 if ( ch.get("op") == "delete" or not isinstance(row, dict) diff --git a/resources/master_data/scripts/master_pick.py b/resources/master_data/scripts/master_pick.py index 6f6a2b7c1..61b09a4c0 100644 --- a/resources/master_data/scripts/master_pick.py +++ b/resources/master_data/scripts/master_pick.py @@ -52,9 +52,12 @@ def resolve(spec: dict, value, master=None): def machine(spec: dict, value, master=None) -> bool: - """기계 입력 — 고르기 목록 밖 원문 분류번호도 기계 마스터에 있으면 받음.""" + """기계 입력 — 고르기 목록 밖 원문 분류번호도 기계 마스터에 있으면 받음 · 빈 고르기(직접 값 식 + GC001199 · 822-2) = 어느 기계든.""" known = _numbers(master) - picks = spec.get("고르기") or [] + picks = spec.get("고르기") + if picks == [] and spec.get("이름") == "기계": + return str(value).strip() in known return bool(picks) and str(value).strip() in known and all(str(o) in known for o in picks) diff --git a/resources/tester/test_822_2_machine_hourly_all.py b/resources/tester/test_822_2_machine_hourly_all.py index 3a2359d0c..6194dbbbe 100644 --- a/resources/tester/test_822_2_machine_hourly_all.py +++ b/resources/tester/test_822_2_machine_hourly_all.py @@ -138,6 +138,11 @@ def test_new_machine_registers_and_unregisters(copy: Path): _save(client, [{"op": "delete", "key": key}]) assert "9999-0822" not in _codes("GC000268") assert (copy / LOGIC).read_text(encoding="utf-8") == logic_text + _save(client, [{"op": "add", "row": {**row, "원문번호": ""}}]) # 빈 원문번호 = 「자체 EQ…」 받을 키 + key = max(k for k, r in _rows().items() if r["이름"] == NAME) + assert _rows()[key]["원문번호"] == f"자체 {key}" and f"자체 {key}" in _codes("GC000268") + _save(client, [{"op": "delete", "key": key}]) + assert (copy / LOGIC).read_text(encoding="utf-8") == logic_text # ④ 직접 값 식 ───────────────────────────────────────────────────────── @@ -157,6 +162,9 @@ def test_direct_formula_my_machine(world): made = _at(me, mym.create, body) assert made["시간당"]["로직"] == DIRECT and made["시간당"]["계"] == 60 no = made["줄"]["원문번호"] + whole = _at(me, mym.whole) + run = m01.cm.mf.run(whole, DIRECT, {"기계": no}) # 직접 값 식 — 내 기계 원문번호를 받음 + assert (run["노무비"], run["재료비"], run["경비"]) == (10, 20, 30) line = {"종류": "로직", "로직": DIRECT, "입력값": {"기계": no}, "수량": "2"} name = _at( me, lambda: refs.create("sangeun", {"이름": NAME, "단위": "시간", "더한줄": [line]})["이름"] diff --git a/ui_template/ui_template_locale_machine.ts b/ui_template/ui_template_locale_machine.ts index b5376cb30..3650252ae 100644 --- a/ui_template/ui_template_locale_machine.ts +++ b/ui_template/ui_template_locale_machine.ts @@ -55,8 +55,8 @@ export const ui_locales_machine = { M01_MachineFormula: ["쓰는 계산식", "Hourly formula"], M01_MachineFormulaListed: ["목록에 있음", "listed"], M01_MachineFormulaShape: [ - "꼴로 고름(채운 칸) — 저장하면 그 식 목록에 등록", - "picked by filled fields — registered on save", + "꼴로 고름(채운 칸 · 새 기계는 저장 때 그 식 목록에 등록)", + "picked by filled fields (new machines are listed on save)", ], M01_MachineFormulaOwn: ["그 기계만의 식", "machine's own formula"], M01_MachineFormulaNone: ["식 없음", "no formula"], diff --git a/ui_template/ui_template_pick_search.css b/ui_template/ui_template_pick_search.css index 097dc7c1b..e9f7e175d 100644 --- a/ui_template/ui_template_pick_search.css +++ b/ui_template/ui_template_pick_search.css @@ -3,6 +3,10 @@ position: relative; } +.ui-float-panel.ui-pick-search { + max-height: none; +} + .ui-pick-search .ui-float-panel__body { padding: var(--spacing-8); }