feat(freight-rpa): 库存/收料改名在手/入站,报表归属RPA,类名统一FreightRpa
把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与 枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa 持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀, 上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ffc0d4a430
commit
39fe3c05f2
453 files changed
+17945
-8646
No files matched your search
@@ -53,7 +53,7 @@ def gate_chain(app):
|
||||
conversation_id=session.session_id,
|
||||
extraction_run_id=int(run.id),
|
||||
status='processing',
|
||||
stage='inventory_matching',
|
||||
stage='onhand_matching',
|
||||
progress_version=1,
|
||||
)
|
||||
db.session.add(order_task)
|
||||
@@ -137,7 +137,7 @@ def _summary_c(execution_id: int):
|
||||
@pytest.mark.parametrize('scenario', [
|
||||
# gate_code, gate.status, blocking_reason_code, next_action_code
|
||||
# [CANONICAL-AGREE] 这些场景 A 与 C 当前一致:flatten 后仍必须一致。
|
||||
('inventory_sufficiency', 'blocked_manual', 'inventory_shortage_review_required', 'open_shortage_review'),
|
||||
('onhand_sufficiency', 'blocked_manual', 'inventory_shortage_review_required', 'open_shortage_review'),
|
||||
('freight_upload_rpa', 'blocked_manual', 'upload_rpa_failed', 'retry_freight_upload_rpa'),
|
||||
])
|
||||
def test_a_primary_action_equals_c(app, gate_chain, scenario):
|
||||
@@ -175,9 +175,9 @@ def test_a_blocking_reason_does_not_over_collapse_retryable(app, gate_chain):
|
||||
run, notice, order_task = _load_chain(gate_chain)
|
||||
execution_id = _attach_execution(
|
||||
order_task,
|
||||
gate_code='inventory_preparation', status='blocked_retryable',
|
||||
gate_code='onhand_preparation', status='blocked_retryable',
|
||||
blocking_reason_code='inventory_preparation_failed',
|
||||
next_action_code='retry_inventory_preparation',
|
||||
next_action_code='retry_onhand_preparation',
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
@@ -217,8 +217,8 @@ def test_a_primary_action_uses_same_recovery_source_as_c(app, gate_chain):
|
||||
run, notice, order_task = _load_chain(gate_chain)
|
||||
execution_id = _attach_execution(
|
||||
order_task,
|
||||
gate_code='inventory_preparation', status='blocked_retryable',
|
||||
blocking_reason_code='inventory_rpa_exhausted', next_action_code='retry_inventory_matching',
|
||||
gate_code='onhand_preparation', status='blocked_retryable',
|
||||
blocking_reason_code='onhand_rpa_exhausted', next_action_code='retry_onhand_matching',
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
@@ -227,13 +227,13 @@ def test_a_primary_action_uses_same_recovery_source_as_c(app, gate_chain):
|
||||
|
||||
a_primary = str((a.get('primary_action') or {}).get('code') or '').strip()
|
||||
c_next = str(summary.get('next_action_code') or '').strip()
|
||||
assert a_primary == c_next == 'retry_inventory_matching'
|
||||
assert a_primary == c_next == 'retry_onhand_matching'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('scenario', [
|
||||
# gate_code, gate.status, blocking_reason_code, next_action_code
|
||||
('inventory_sufficiency', 'blocked_manual', 'inventory_shortage_review_required', 'open_shortage_review'),
|
||||
('inventory_preparation', 'blocked_retryable', 'inventory_preparation_failed', 'retry_inventory_preparation'),
|
||||
('onhand_sufficiency', 'blocked_manual', 'inventory_shortage_review_required', 'open_shortage_review'),
|
||||
('onhand_preparation', 'blocked_retryable', 'inventory_preparation_failed', 'retry_onhand_preparation'),
|
||||
('artifact_generation', 'blocked_retryable', 'artifact_generation_failed', 'regenerate_excel_artifact'),
|
||||
('freight_upload_rpa', 'blocked_manual', 'upload_rpa_failed', 'retry_freight_upload_rpa'),
|
||||
])
|
||||
@@ -288,7 +288,7 @@ def test_preparation_line_emits_decisional_allowed_actions(app, gate_chain):
|
||||
inventory_allowed_actions / inventory_file_no,否则前端 formalPreparationLineAllows 恒 false、
|
||||
明细行按钮不渲染。用正式 OT + 一行 not_found 断言短缺行按钮被正确授权。"""
|
||||
from app.models import (
|
||||
ShippingNoticeLineInventoryMatch,
|
||||
ShippingNoticeLineOnhandMatch,
|
||||
ShippingOrderSnapshot,
|
||||
ShippingOrderSnapshotLine,
|
||||
)
|
||||
@@ -310,12 +310,12 @@ def test_preparation_line_emits_decisional_allowed_actions(app, gate_chain):
|
||||
)
|
||||
db.session.add(line)
|
||||
db.session.flush()
|
||||
db.session.add(ShippingNoticeLineInventoryMatch(
|
||||
db.session.add(ShippingNoticeLineOnhandMatch(
|
||||
task_id=int(order_task.id), snapshot_line_id=int(line.id), line_no=1, line_index=0,
|
||||
match_result='not_found', inventory_status='ready', required_qty='8',
|
||||
match_result='not_found', onhand_status='ready', required_qty='8',
|
||||
available_qty='0', matched_qty='0', shortage_qty='8',
|
||||
reservation_id='RSV-EQ', part_number='PN-EQ',
|
||||
inventory_source_code='DBS_DUB', matched_file_no='INV-EQ', is_current=True,
|
||||
source_code='DBS_DUB', matched_file_no='INV-EQ', is_current=True,
|
||||
))
|
||||
db.session.commit()
|
||||
|
||||
@@ -324,9 +324,9 @@ def test_preparation_line_emits_decisional_allowed_actions(app, gate_chain):
|
||||
line_row = preparation['lines'][0]
|
||||
# 短缺行:close + release_inventory_shortage(line);retry_inventory_preparation(inventory)。
|
||||
assert set(line_row['line_allowed_actions']) == {
|
||||
'close_unfulfillable', 'release_inventory_shortage',
|
||||
'close_unfulfillable', 'release_onhand_shortage',
|
||||
}
|
||||
assert 'retry_inventory_preparation' in line_row['inventory_allowed_actions']
|
||||
assert 'retry_onhand_preparation' in line_row['inventory_allowed_actions']
|
||||
# 下载库存按钮依赖 inventory_file_no。
|
||||
assert line_row['inventory_file_no'] == 'INV-EQ'
|
||||
assert line_row['user_line_status'] == 'shortage'
|
||||
@@ -342,7 +342,7 @@ def test_preparation_line_allowed_actions_are_zero_n_plus_one(app, gate_chain):
|
||||
from sqlalchemy import event
|
||||
|
||||
from app.models import (
|
||||
ShippingNoticeLineInventoryMatch,
|
||||
ShippingNoticeLineOnhandMatch,
|
||||
ShippingOrderSnapshot,
|
||||
ShippingOrderSnapshotLine,
|
||||
)
|
||||
@@ -366,12 +366,12 @@ def test_preparation_line_allowed_actions_are_zero_n_plus_one(app, gate_chain):
|
||||
)
|
||||
db.session.add(line)
|
||||
db.session.flush()
|
||||
db.session.add(ShippingNoticeLineInventoryMatch(
|
||||
db.session.add(ShippingNoticeLineOnhandMatch(
|
||||
task_id=int(order_task.id), snapshot_line_id=int(line.id), line_no=i + 1, line_index=i,
|
||||
match_result='matched', inventory_status='ready', required_qty='8',
|
||||
match_result='matched', onhand_status='ready', required_qty='8',
|
||||
available_qty='8', matched_qty='8', shortage_qty='0',
|
||||
reservation_id=f'RSV-{i}', part_number=f'PN-{i}',
|
||||
inventory_source_code='DBS_DUB', matched_file_no=f'INV-{i}', is_current=True,
|
||||
source_code='DBS_DUB', matched_file_no=f'INV-{i}', is_current=True,
|
||||
))
|
||||
db.session.commit()
|
||||
|
||||
@@ -395,8 +395,8 @@ def test_preparation_line_allowed_actions_are_zero_n_plus_one(app, gate_chain):
|
||||
|
||||
@pytest.mark.parametrize('scenario', [
|
||||
# gate_code, expected lifecycle stage(契约:正式 Gate 映射到五阶段业务码唯一表)
|
||||
('inventory_matching', 'fulfillment_prep'),
|
||||
('inventory_sufficiency', 'fulfillment_prep'),
|
||||
('onhand_matching', 'fulfillment_prep'),
|
||||
('onhand_sufficiency', 'fulfillment_prep'),
|
||||
('artifact_generation', 'fulfillment_prep'),
|
||||
('freight_upload_rpa', 'freight_upload'),
|
||||
('manual_upload_handoff', 'freight_upload'),
|
||||
@@ -415,7 +415,7 @@ def test_gate_maps_to_lifecycle_stage_b(app, gate_chain, scenario):
|
||||
execution_id = _attach_execution(
|
||||
order_task,
|
||||
gate_code=gate_code, status='blocked_manual',
|
||||
blocking_reason_code='inventory_preparation_failed', next_action_code='retry_inventory_preparation',
|
||||
blocking_reason_code='inventory_preparation_failed', next_action_code='retry_onhand_preparation',
|
||||
)
|
||||
# 让 notice 路径经 order_task_id 命中同一 execution(B 在生产中把 Notice
|
||||
# 传给 build_task_ui_state;Execution.task_id 必须保持为 OT.id)。
|
||||
|
||||
Reference in new issue
Block a user