工业级重构: 用户Grid选择+工序由接收人定+隐藏结束按钮(次分支卡片内结束)+蓝图网格背景

This commit is contained in:
2026-08-06 09:52:21 +08:00
parent 34347dafb0
commit e183ea5583
5 changed files with 71 additions and 49 deletions

View File

@ -335,13 +335,13 @@ ARCHIVED_STATUS = "ARCHIVED"
async def receive_task(
db: AsyncSession, task_id: uuid.UUID, operator_id: str | None = None,
remark: str | None = None,
remark: str | None = None, task_name: str | None = None,
) -> TaskResponse:
"""
操作员确认接收任务。
操作员确认接收任务。工人选定工序名称后接收。
校验:只有状态为 PENDING 的任务可接收。
动作:状态改为 WIP记录 received_at写入 remark
动作:状态改为 WIP记录 received_at更新 task_name同步产品宏观状态
"""
task = await _get_task_or_404(db, task_id)
@ -364,6 +364,8 @@ async def receive_task(
task.received_at = now
if remark:
task.remark = remark
if task_name:
task.task_name = task_name
await _create_task_log(
db, task_id,
@ -372,11 +374,14 @@ async def receive_task(
remark=remark or f"操作员确认接收任务「{task.task_name}",
)
# 接收时同步产品位置到接收人
# 接收时同步产品位置到接收人 + 宏观状态同步
product_result = await db.execute(select(Product).where(Product.id == task.product_id))
product = product_result.scalar_one_or_none()
if product and task.assignee_id:
product.current_location_id = task.assignee_id
if product:
if task.assignee_id:
product.current_location_id = task.assignee_id
if task_name:
product.overall_status = task_name
await db.commit()
await db.refresh(task)