feat(shipping-notice): 添加订单文档 Profile 盲测集和样本管理功能,支持创建、执行和批准盲测,增强订单冻结和库存核验功能

This commit is contained in:
hugo committed 2026-07-23 00:15:34 +08:00
1 parent c35223d49d
commit abd8fc1e16
98 files changed
+4629 -528

No files matched your search

@@ -269,17 +269,19 @@ def _validate_definition(item: ShippingExcelTemplate) -> dict[str, Any]:
definition = item.definition_json if isinstance(item.definition_json, dict) else {}
mappings = definition.get('mappings')
filename_pattern = str(definition.get('filename_pattern') or '').strip()
if not isinstance(mappings, list) or not mappings or not filename_pattern:
raise ValidationError('Template mappings and filename_pattern are required', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID')
try:
rendered_name = filename_pattern.format(
task_no='TASK', business_no='BUSINESS', source_code='SOURCE', ts='20260101000000', date='20260101',
customer_short_code='CUSTOMER', business_date='260602', sequence='01',
)
except (KeyError, ValueError) as exc:
raise ValidationError('Template filename_pattern is invalid', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID') from exc
if not rendered_name.strip():
raise ValidationError('Template filename_pattern is empty', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID')
if not isinstance(mappings, list) or not mappings:
raise ValidationError('Template mappings are required', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID')
# An empty published rule deliberately delegates naming to the controlled environment fallback.
if filename_pattern:
try:
rendered_name = filename_pattern.format(
task_no='TASK', business_no='BUSINESS', source_code='SOURCE', ts='20260101000000', date='20260101',
customer_short_code='CUSTOMER', business_date='260602', sequence='01',
)
except (KeyError, ValueError) as exc:
raise ValidationError('Template filename_pattern is invalid', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID') from exc
if not rendered_name.strip():
raise ValidationError('Template filename_pattern is empty', code='SHIPPING.EXCEL_TEMPLATE_DEFINITION_INVALID')
raw = file_asset_storage.get_bytes(item.storage_key)
if hashlib.sha256(raw).hexdigest() != item.file_checksum:
raise ValidationError('Template asset is missing or changed', code='SHIPPING.EXCEL_TEMPLATE_ASSET_INVALID')