工业级重构: 用户Grid选择+工序由接收人定+隐藏结束按钮(次分支卡片内结束)+蓝图网格背景
This commit is contained in:
@ -154,16 +154,17 @@ async def receive_task_endpoint(
|
||||
task_id: str,
|
||||
operator_id: str | None = Query(None, description="操作人ID"),
|
||||
remark: str | None = Body(None, description="接收备注", embed=True),
|
||||
task_name: str | None = Body(None, description="接收人选定的工序名称", embed=True),
|
||||
db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
"""
|
||||
**确认接收任务。**
|
||||
**确认接收任务。工人选定工序名称后接收。**
|
||||
|
||||
校验:只有状态为 PENDING 的任务可接收。
|
||||
动作:将状态改为 WIP,记录 received_at 为当前时间,写入 remark。
|
||||
动作:状态改为 WIP,记录 received_at,更新 task_name,同步产品宏观状态。
|
||||
"""
|
||||
return await task_service.receive_task(
|
||||
db, uuid.UUID(task_id), operator_id, remark
|
||||
db, uuid.UUID(task_id), operator_id, remark, task_name
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user