feat(shipping-notice): 实现滚动履约功能,优化发货通知流程与代码清理
清理废弃的ShippingCase相关代码与依赖,统一使用ShippingNotice直接关联客户数据。调整库存网关依赖规则,支持仅对库存满足或已人工放行的订单行生成发货Excel,实现滚动履约逻辑。
This commit is contained in:
1 parent
7cfd5d167e
commit
1e5aedb9ed
235 files changed
+11394
-9613
No files matched your search
@@ -180,6 +180,7 @@ def reserve_available_for_artifact(
|
||||
artifact: ShippingExportArtifact,
|
||||
verification: ShippingInventoryVerification,
|
||||
released_snapshot_line_ids: set[int] | None = None,
|
||||
selected_snapshot_line_ids: set[int] | None = None,
|
||||
) -> list[ShippingReservation]:
|
||||
"""
|
||||
锁定本轮可用或已审计短缺放行的预约单,并写入 Artifact 行。
|
||||
@@ -193,6 +194,7 @@ def reserve_available_for_artifact(
|
||||
artifact: 已落库但尚未提交的导出 Artifact。
|
||||
verification: 当前库存核验轮次。
|
||||
released_snapshot_line_ids: 已审计短缺放行对应的冻结订单行 ID 集合。
|
||||
selected_snapshot_line_ids: 独立通知已固化的冻结行 ID;提供时不得占用集合外行。
|
||||
|
||||
Returns:
|
||||
本次被 Artifact 占用的预约单。
|
||||
@@ -226,7 +228,12 @@ def reserve_available_for_artifact(
|
||||
)
|
||||
if not rows:
|
||||
raise ConflictError('No available reservations can be exported', code='SHIPPING.ROLLING_EXPORT_NOT_READY')
|
||||
selected = [item for item in rows if item.id in verification_lines]
|
||||
selected_ids = {int(item) for item in (selected_snapshot_line_ids or set())}
|
||||
selected = [
|
||||
item for item in rows
|
||||
if item.id in verification_lines
|
||||
and (not selected_ids or int(item.snapshot_line_id) in selected_ids)
|
||||
]
|
||||
if not selected:
|
||||
raise ConflictError('Current verification has no available reservations', code='SHIPPING.ROLLING_EXPORT_NOT_READY')
|
||||
for reservation in selected:
|
||||
@@ -244,6 +251,7 @@ def current_available_snapshot_line_ids(
|
||||
task: ShippingNotice,
|
||||
*,
|
||||
released_snapshot_line_ids: set[int] | None = None,
|
||||
selected_snapshot_line_ids: set[int] | None = None,
|
||||
) -> tuple[ShippingInventoryVerification, set[int]]:
|
||||
"""
|
||||
取得最新核验中可导出的冻结订单行。
|
||||
@@ -254,6 +262,7 @@ def current_available_snapshot_line_ids(
|
||||
Args:
|
||||
task: 当前正式发货任务。
|
||||
released_snapshot_line_ids: 已审计短缺放行对应的冻结订单行 ID 集合。
|
||||
selected_snapshot_line_ids: 独立通知已固化的冻结行 ID;提供时仅返回该集合。
|
||||
|
||||
Returns:
|
||||
(最新核验轮次, 本次可导出的冻结订单行 ID)。
|
||||
@@ -288,7 +297,11 @@ def current_available_snapshot_line_ids(
|
||||
ShippingReservation.id.in_(reservation_ids),
|
||||
ShippingReservation.status.in_({'available', 'pending'}),
|
||||
).all() if reservation_ids else []
|
||||
line_ids = {item.snapshot_line_id for item in reservations}
|
||||
selected_ids = {int(item) for item in (selected_snapshot_line_ids or set())}
|
||||
line_ids = {
|
||||
item.snapshot_line_id for item in reservations
|
||||
if not selected_ids or int(item.snapshot_line_id) in selected_ids
|
||||
}
|
||||
if not line_ids:
|
||||
raise ConflictError('No available reservations can be exported', code='SHIPPING.ROLLING_EXPORT_NOT_READY')
|
||||
return verification, line_ids
|
||||
Reference in new issue
Block a user