feat(shipping-notice): 收敛阶段能力投影并修复库存 RPA 运行链路
下发 preparation capabilities 并与右卡展示同源授权; 库存 RPA 运行态请求内 memo;取消会话 Profile 本地 TTL; 并为 shipping-worker 挂载共享盘。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f773237226
commit
a6edc4fe61
16 files changed
+433
-179
No files matched your search
@@ -612,6 +612,65 @@ def test_stage_context_prefers_current_structured_inventory_match(app) -> None:
|
||||
assert "retry_inventory_preparation" in line["inventory_allowed_actions"]
|
||||
|
||||
|
||||
def test_stage_context_hides_inventory_actions_while_rpa_running(app) -> None:
|
||||
"""库存 RPA queued/running 时,工作台 preparation 行不得下发重试 RPA 动作。
|
||||
|
||||
与 Case 投影同源:inventory_rpa_is_running 在行循环外算一次;运行中 actions 为空。
|
||||
"""
|
||||
from app.models import ShippingTaskInventoryRpaAttempt
|
||||
|
||||
with app.app_context():
|
||||
user = User(username='ui-rpa-running', email='ui-rpa-running@example.com')
|
||||
db.session.add(user)
|
||||
db.session.flush()
|
||||
task = ShippingOrderTask(task_no='OT-UI-RPA-RUNNING', user_id=user.id, stage='inventory_matching')
|
||||
db.session.add(task)
|
||||
db.session.flush()
|
||||
snapshot = ShippingOrderSnapshot(
|
||||
task_id=task.id, extraction_id=1, schema_version_id=1,
|
||||
order_data_version=1, header_values_json={},
|
||||
)
|
||||
db.session.add(snapshot)
|
||||
db.session.flush()
|
||||
task.order_snapshot_id = snapshot.id
|
||||
snapshot_line = ShippingOrderSnapshotLine(
|
||||
snapshot_id=snapshot.id, position=0, line_no=1,
|
||||
reservation_id='RSV-RPA', part_number='PN-RPA', qty='10', field_values_json={},
|
||||
)
|
||||
db.session.add(snapshot_line)
|
||||
db.session.flush()
|
||||
db.session.add(ShippingNoticeLineInventoryMatch(
|
||||
task_id=task.id,
|
||||
snapshot_line_id=snapshot_line.id,
|
||||
line_no=1,
|
||||
line_index=0,
|
||||
match_result='matched',
|
||||
inventory_status='ready',
|
||||
required_qty='10',
|
||||
available_qty='7',
|
||||
matched_qty='7',
|
||||
shortage_qty='3',
|
||||
reservation_id='RSV-RPA',
|
||||
part_number='PN-RPA',
|
||||
inventory_source_code='DBS_DUB',
|
||||
is_current=True,
|
||||
))
|
||||
db.session.add(ShippingTaskInventoryRpaAttempt(
|
||||
task_no=task.task_no,
|
||||
source_code='DBS_DUB',
|
||||
attempt_no=1,
|
||||
source_run_no='PSR-UI-RPA-1',
|
||||
status='running',
|
||||
))
|
||||
db.session.commit()
|
||||
|
||||
preparation = build_task_ui_state(task, include_stage_context=True)['stage_context']['preparation']
|
||||
line = preparation['lines'][0]
|
||||
# 关键断言:RPA 运行中必须清空库存动作,前端 Bot 不得渲染/触发。
|
||||
assert line['user_line_status'] == 'acquiring_inventory'
|
||||
assert line['inventory_allowed_actions'] == []
|
||||
|
||||
|
||||
def test_stage_context_preparation_projects_source_ambiguity_and_lock(app, monkeypatch) -> None:
|
||||
"""行级 source_conflict 与候选源只读 Match;Excel 未生成时下发 source_options。"""
|
||||
monkeypatch.setattr(
|
||||
|
||||
Reference in new issue
Block a user