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:
hugoandCursor committed 2026-10-19 10:46:06 +08:00
1 parent ffc0d4a430
commit 39fe3c05f2
453 files changed
+17945 -8646

No files matched your search

@@ -26,8 +26,8 @@ from app.core.errors import ConflictError, NotFoundError, ValidationError
from app.models import (
ShippingExcelTemplate,
ShippingExportArtifact,
ShippingInventoryField,
ShippingInventorySource,
FreightRpaOnhandField,
FreightRpaSource,
ShippingOrderField,
)
from app.services.file_assets.storage import file_asset_storage
@@ -327,7 +327,7 @@ def _validate_definition(item: ShippingExcelTemplate) -> dict[str, Any]:
inventory_field_id = int(source_key)
except (TypeError, ValueError) as exc:
raise ValidationError('Inventory field is invalid', code='SHIPPING.EXCEL_TEMPLATE_FIELD_INVALID') from exc
inventory_field = db.session.get(ShippingInventoryField, inventory_field_id)
inventory_field = db.session.get(FreightRpaOnhandField, inventory_field_id)
if inventory_field is None or inventory_field.status != 'active':
raise ValidationError('Inventory field is unavailable', code='SHIPPING.EXCEL_TEMPLATE_FIELD_INVALID')
source_key = str(inventory_field.id)
@@ -371,7 +371,7 @@ def retire(template_id: int) -> dict[str, Any]:
raise NotFoundError('Excel template not found', code='SHIPPING.EXCEL_TEMPLATE_NOT_FOUND')
if item.status != 'published':
raise ConflictError('Only published template can be retired', code='SHIPPING.EXCEL_TEMPLATE_RETIRE_INVALID')
if ShippingInventorySource.query.filter_by(excel_template_id=item.id).count():
if FreightRpaSource.query.filter_by(excel_template_id=item.id).count():
raise ConflictError('Rebind inventory sources first', code='SHIPPING.EXCEL_TEMPLATE_RETIRE_BLOCKED')
item.status = 'retired'
db.session.commit()