Merge branch 'hugo-shipping-notice' into test
This commit is contained in:
commit
97cb27c632
2 files changed
+87
-3
No files matched your search
@@ -5,7 +5,8 @@ services/shipping_notice/inventory_file_store.py
|
||||
依赖:models.ShippingInventoryFile/ShippingTaskInventoryLink、inventory_snapshot、export._storage_root。
|
||||
逻辑:inventory_workflow 上传或解析库存时写入库存快照(Link 挂在正式 OT);
|
||||
fulfillment_workflow / Excel 导出经 resolve_inventory_lines_for_execution:
|
||||
冻结候选 OT 读 prepare 合并行,单源读 active Link 文件;禁止用 Notice.id 漏读 OT Link。
|
||||
冻结候选读所属 OT 的 prepare 合并行(传入 Notice 时回源 order_task_id),单源读 active Link 文件;
|
||||
禁止用 Notice.id 漏读 OT Link,导出数据源不得偏离行级匹配门禁命中的候选事实。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -242,6 +243,9 @@ def resolve_inventory_lines_for_execution(
|
||||
本次执行使用的库存行;不会回写任务或通知单的库存行缓存。
|
||||
"""
|
||||
# [STEP 1] STP 冻结候选:匹配输入来自各源快照合并,不读被污染的单文件缓存。
|
||||
# Notice 主键 ≠ OT 且不带候选集指针;冻结候选事实统一回源所属 OT 读取,
|
||||
# 防止导出路径把多源任务退化成单源 Link,出现「行匹配过门禁但生成 Excel 失败」。
|
||||
from app.models import ShippingOrderTask
|
||||
from app.services.shipping_notice.stp_inventory_freeze import (
|
||||
task_frozen_inventory_source_codes,
|
||||
)
|
||||
@@ -249,8 +253,12 @@ def resolve_inventory_lines_for_execution(
|
||||
prepare_candidate_inventory_lines,
|
||||
)
|
||||
|
||||
if len(task_frozen_inventory_source_codes(task)) >= 1:
|
||||
prep = prepare_candidate_inventory_lines(task)
|
||||
owner_task = task
|
||||
order_task_id = getattr(task, 'order_task_id', None)
|
||||
if order_task_id:
|
||||
owner_task = db.session.get(ShippingOrderTask, int(order_task_id)) or task
|
||||
if len(task_frozen_inventory_source_codes(owner_task)) >= 1:
|
||||
prep = prepare_candidate_inventory_lines(owner_task)
|
||||
if prep.get('status') == 'ready':
|
||||
rows = [row for row in list(prep.get('lines') or []) if isinstance(row, dict)]
|
||||
if rows:
|
||||
|
||||
Reference in new issue
Block a user