47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
# ============================================================
|
|
# OR-06 订单钉扎 / 计划追溯黄金测试
|
|
# ============================================================
|
|
from __future__ import annotations
|
|
|
|
from server.aps_domain.flex import run_flex_schedule
|
|
from server.aps_domain.trace import flex_plan_trace, plan_trace
|
|
from server.state.seed import seed_world
|
|
|
|
|
|
class _MemStore:
|
|
def __init__(self, data):
|
|
self.data = data
|
|
|
|
def next_id(self, kind: str) -> int:
|
|
key = f"_c_{kind}"
|
|
self.data[key] = self.data.get(key, 6000) + 1
|
|
return self.data[key]
|
|
|
|
def save(self):
|
|
pass
|
|
|
|
|
|
def test_flex_pegging_chain():
|
|
store = _MemStore(seed_world())
|
|
run_flex_schedule(store, sort_mode="BOTTLENECK", actor="test")
|
|
r = flex_plan_trace(store.data, "FO-2601")
|
|
assert r["track"] == "flex"
|
|
assert r["count"] == 1
|
|
row = r["orders"][0]
|
|
assert row["order"]["orderNo"] == "FO-2601"
|
|
assert row["master"]["bom"]
|
|
assert row["master"]["routing"]
|
|
assert row["schedule"]["virtualLines"]
|
|
assert row["schedule"]["workOrders"]
|
|
assert row["schedule"]["loadMinutesByEquipment"]
|
|
assert "尚无柔性排产版本" not in row["missing"]
|
|
|
|
|
|
def test_plan_trace_auto_routes_fo():
|
|
store = _MemStore(seed_world())
|
|
run_flex_schedule(store, sort_mode="BOTTLENECK", actor="test")
|
|
r = plan_trace(store.data, "FO-2601") # auto
|
|
assert r["track"] == "flex"
|
|
r2 = plan_trace(store.data, "FO-2601", track="flex")
|
|
assert r2["track"] == "flex"
|