feat(shipping-order): 增加客户事实、编辑窗口与正式通知创建服务

This commit is contained in:
hugo committed 2026-09-04 22:00:27 +08:00
1 parent 4e8b2f8db2
commit bffcd55b40
17 files changed
+738 -486

No files matched your search

@@ -26,10 +26,8 @@ from app.services.shipping_notice.customer_shadow_resolution import (
label_shadow_resolution,
)
from app.services.shipping_notice.customer_auto_resolution import (
correct_numbered_task_customer,
get_auto_resolution_metrics,
)
from app.services.shipping_notice.query_service import get_task_by_ref
XLSX_MIME_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
@@ -287,32 +285,6 @@ def get_shipping_customer_shadow_report():
return jsonify(report)
@admin_bp.route('/shipping-customers/numbered-task-correction', methods=['POST'])
@require_admin
def correct_shipping_numbered_task_customer():
"""管理员更正已编号任务客户;保留原号作废并生成有替代关系的新号。"""
data = request.get_json(silent=True) or {}
task_ref = str(data.get('task_ref') or data.get('task_no') or '').strip().upper()
if not task_ref:
raise ValidationError(
'Task reference is required',
code='SHIPPING.CUSTOMER_CORRECTION_TASK_REQUIRED',
)
try:
customer_id = int(data.get('customer_id'))
except (TypeError, ValueError) as exc:
raise ValidationError('Customer id is required', code='SHIPPING.CUSTOMER_CONFIRMATION_CUSTOMER_REQUIRED') from exc
task = get_task_by_ref(task_ref)
if task is None:
raise ValidationError('Shipping task not found', code='SHIPPING.CUSTOMER_CORRECTION_TASK_MISSING')
return jsonify(correct_numbered_task_customer(
task,
customer_id=customer_id,
reason=str(data.get('reason') or ''),
actor_id=_actor_id(),
))
@admin_bp.route('/shipping-customer-shadow-resolutions/<int:resolution_id>/label', methods=['PUT'])
@require_admin
def label_shipping_customer_shadow_resolution(resolution_id: int):