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
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
backend/tests/test_freight_rpa_class_names.py
|
||||
|
||||
用途:锁住货代 RPA 模型的类名、表名和站点关系属性名。
|
||||
依赖:app.models 里拆出的 freight_rpa_* 模型模块。
|
||||
逻辑:被 pytest 直接导入;不连数据库。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import app.models as models
|
||||
from app.models.freight_rpa_config import (
|
||||
FreightRpaOnhandExternalMapping,
|
||||
FreightRpaOnhandReportConfig,
|
||||
FreightRpaSource,
|
||||
)
|
||||
from app.models.freight_rpa_inbound_report import (
|
||||
FreightRpaInboundReportConfig,
|
||||
FreightRpaInboundReportFile,
|
||||
FreightRpaInboundUnitRun,
|
||||
)
|
||||
from app.models.freight_rpa_onhand_report_file import FreightRpaOnhandReportFile
|
||||
from app.models.freight_rpa_onhand_task_attempts import FreightRpaOnhandTaskAttempt
|
||||
|
||||
|
||||
def test_freight_rpa_classes_keep_existing_table_names():
|
||||
"""类名换成 FreightRpa 后,表名仍是规格里的 freight_rpa_*。"""
|
||||
assert FreightRpaSource.__tablename__ == "freight_rpa_sources"
|
||||
assert FreightRpaOnhandReportFile.__tablename__ == "freight_rpa_onhand_report_files"
|
||||
assert FreightRpaInboundReportFile.__tablename__ == "freight_rpa_inbound_report_files"
|
||||
assert FreightRpaInboundUnitRun.__tablename__ == "freight_rpa_inbound_rpa_unit_runs"
|
||||
|
||||
|
||||
def test_site_relationships_drop_inventory_and_receipt_names():
|
||||
"""站点关系改叫 source / inbound_report_config,索引名不在这个测试里改。"""
|
||||
assert "source" in FreightRpaOnhandReportConfig.__mapper__.relationships
|
||||
assert "inventory_source" not in FreightRpaOnhandReportConfig.__mapper__.relationships
|
||||
assert "source" in FreightRpaInboundReportConfig.__mapper__.relationships
|
||||
assert "source" in FreightRpaInboundUnitRun.__mapper__.relationships
|
||||
assert "inbound_report_config" in FreightRpaSource.__mapper__.relationships
|
||||
assert "receipt_report_config" not in FreightRpaSource.__mapper__.relationships
|
||||
assert "source" in FreightRpaOnhandExternalMapping.__mapper__.relationships
|
||||
assert FreightRpaOnhandTaskAttempt.__tablename__ == "freight_rpa_onhand_task_rpa_attempts"
|
||||
|
||||
|
||||
def test_old_shipping_class_names_are_not_exported():
|
||||
"""旧类名不留别名。发货任务关联类仍叫 ShippingTaskOnhandLink。"""
|
||||
assert not hasattr(models, "ShippingOnhandSource")
|
||||
assert not hasattr(models, "ShippingOnhandFile")
|
||||
assert not hasattr(models, "ShippingInboundReportFile")
|
||||
assert not hasattr(models, "ShippingParsingProfile")
|
||||
assert hasattr(models, "FreightRpaSource")
|
||||
assert hasattr(models, "FreightRpaOnhandReportFile")
|
||||
assert hasattr(models, "ShippingTaskOnhandLink")
|
||||
assert hasattr(models, "ShippingUploadAttempt")
|
||||
Reference in new issue
Block a user