fix: 三致命Bug—macro_status预计算+排除已完工脏读+flush落盘+递归深度限制10
This commit is contained in:
@ -74,6 +74,7 @@ async def _recalc_product_location(db: AsyncSession, product_id: uuid.UUID, comp
|
||||
sa_select(Task).where(
|
||||
Task.product_id == product_id,
|
||||
Task.status == TASK_STATUS_WIP,
|
||||
Task.id != completed_task_id, # 🔧 排除刚刚完工的任务(避免脏读)
|
||||
).order_by(Task.created_at.desc())
|
||||
)
|
||||
wip_tasks = task_result.scalars().all()
|
||||
@ -94,6 +95,7 @@ async def _recalc_product_location(db: AsyncSession, product_id: uuid.UUID, comp
|
||||
|
||||
if product.current_location_id != new_location:
|
||||
product.current_location_id = new_location
|
||||
await db.flush() # 🔧 确保位置更新落盘到当前事务
|
||||
|
||||
|
||||
def _check_permission(task_assignee_id: str | None, operator_id: str | None, operator_role: str | None = None) -> None:
|
||||
|
||||
Reference in New Issue
Block a user