fix(shipping-notice,admin-schedule,frontend): 修复发货通知与后台排程的业务bug并优化各模块功能
1. 后端发货通知模块:
清空重试任务旧状态避免残留,新增RPA进度回调接口
优化库存匹配性能,修复人工确认校验逻辑与登录弹窗遮挡问题
新增排程worker启动脚本,清理冗余环境配置与缓存查询开销
2. 前端后台排程模块:
新增任务key归一化工具兼容历史格式,修复参数表单隐藏问题
添加加载错误处理,更新多语言文案替换裸JSON占位符
This commit is contained in:
1 parent
1e5aedb9ed
commit
06c18b3c7c
81 files changed
+3301
-424
No files matched your search
@@ -195,20 +195,24 @@ def _mapping_value(
|
||||
excel_business_no: str | None = None,
|
||||
notice_no: str | None = None,
|
||||
export_date: date | None = None,
|
||||
field_id_by_code: dict[str, str] | None = None,
|
||||
) -> Any:
|
||||
"""
|
||||
按映射来源类型读取值;未知来源已在模板发布时被拒绝。
|
||||
|
||||
核心逻辑:order_field 读订单快照;inventory_field 读库存行;system_fact 仅读白名单事实;
|
||||
export_sequence 优先用调用方传入值,缺失时回退行上注入的 ``__export_sequence``。
|
||||
项次缺失时经 order_line_no_resolver 统一解析(line_no 字段 → 客户 PO 行号 →
|
||||
导出行序号),与 UI 展示同一口径,禁止此处另造回退链。
|
||||
|
||||
Args:
|
||||
mapping: 已发布模板映射项。
|
||||
task: 发货任务。
|
||||
order_values: 当前行或表头订单字段值。
|
||||
order_values: 当前行或表头订单字段值(field_id 为键)。
|
||||
inventory_values: 当前行库存字段值。
|
||||
header_values: 明细行模式下可回退的表头字段。
|
||||
export_sequence: 本次导出行序号(1..N)。
|
||||
field_id_by_code: field_code → field_id 映射(快照 Schema);缺失时按 code 键兼容。
|
||||
|
||||
Returns:
|
||||
经 formatter 处理后的单元格值。
|
||||
@@ -219,8 +223,14 @@ def _mapping_value(
|
||||
value = order_values.get(key)
|
||||
field = db.session.get(ShippingOrderField, key) if key else None
|
||||
field_code = str(field.field_code or '') if field else ''
|
||||
if value in (None, '') and field_code == 'line_no' and export_sequence is not None:
|
||||
value = export_sequence
|
||||
if value in (None, '') and field_code == 'line_no':
|
||||
from app.services.shipping_notice.order_line_no_resolver import resolve_order_line_no
|
||||
|
||||
value = resolve_order_line_no(
|
||||
field_values=order_values,
|
||||
field_id_by_code=field_id_by_code,
|
||||
fallback_sequence=export_sequence,
|
||||
)['value']
|
||||
if value is None and mapping.get('row_mode') == 'line' and header_values is not None:
|
||||
value = header_values.get(key)
|
||||
elif kind == 'inventory_field':
|
||||
@@ -617,6 +627,11 @@ def generate_shipment_excel(
|
||||
|
||||
# [STEP 4] Notice 的业务单号与首个 Excel 同一事务产生。此处已完成业务、
|
||||
# 库存和导出行校验;随后 Excel、Artifact 或 Reservation 任一步失败都会回滚编号流水。
|
||||
from app.services.shipping_notice.order_line_no_resolver import field_id_by_code_from_definition
|
||||
|
||||
field_id_by_code = field_id_by_code_from_definition(
|
||||
snapshot.schema_version.definition_json if snapshot.schema_version is not None else None,
|
||||
)
|
||||
if not task.business_no:
|
||||
from app.services.shipping_notice.business_numbering_service import assign_notice_business_number
|
||||
|
||||
@@ -650,6 +665,7 @@ def generate_shipment_excel(
|
||||
mapping, task=task, order_values=header_values, inventory_values=header_inventory,
|
||||
excel_business_no=excel_business_no,
|
||||
export_date=export_date,
|
||||
field_id_by_code=field_id_by_code,
|
||||
)
|
||||
continue
|
||||
row_count = max(len(line_values), 1)
|
||||
@@ -662,6 +678,7 @@ def generate_shipment_excel(
|
||||
export_sequence=int(order_line.get('__export_sequence') or (index + 1)),
|
||||
excel_business_no=excel_business_no,
|
||||
export_date=export_date,
|
||||
field_id_by_code=field_id_by_code,
|
||||
)
|
||||
wb.save(path)
|
||||
finally:
|
||||
|
||||
Reference in new issue
Block a user