feat: 在制品附加信息补全 — 设备名称|规格型号|序列号|身份证
后端: WipTask 新增 spec_model, 查询关联 Product.spec_model 前端: 第二行格式改为 物料|规格|序列号:xxx|身份证:xxx
This commit is contained in:
@ -28,9 +28,10 @@ class WipTask(BaseModel):
|
||||
task_id: str
|
||||
task_name: str
|
||||
assignee: str
|
||||
product_sn: str
|
||||
product_sn: str # 16位HEX身份证
|
||||
external_serial: str | None # 业务序列号
|
||||
material_name: str # 物料名称
|
||||
material_name: str # 设备名称
|
||||
spec_model: str # 规格型号
|
||||
status: str
|
||||
received_at: str
|
||||
duration_hours: float
|
||||
@ -133,7 +134,7 @@ async def get_wip_tasks(db: AsyncSession, limit: int = 20) -> list[WipTask]:
|
||||
from app.core.time_utils import get_beijing_time, BEIJING_TZ
|
||||
|
||||
stmt = (
|
||||
select(Task, Product.serial_number, Product.external_serial, Product.material_name)
|
||||
select(Task, Product.serial_number, Product.external_serial, Product.material_name, Product.spec_model)
|
||||
.join(Product, Task.product_id == Product.id)
|
||||
.where(Task.status.in_([TASK_STATUS_PENDING, TASK_STATUS_WIP]))
|
||||
.limit(limit * 2)
|
||||
@ -149,7 +150,7 @@ async def get_wip_tasks(db: AsyncSession, limit: int = 20) -> list[WipTask]:
|
||||
|
||||
now = get_beijing_time()
|
||||
wip_list: list[WipTask] = []
|
||||
for task, product_sn, ext_sn, mat_name in rows:
|
||||
for task, product_sn, ext_sn, mat_name, spec in rows:
|
||||
start = task.received_at or task.created_at
|
||||
if start:
|
||||
if start.tzinfo is None:
|
||||
@ -169,6 +170,7 @@ async def get_wip_tasks(db: AsyncSession, limit: int = 20) -> list[WipTask]:
|
||||
product_sn=product_sn or "",
|
||||
external_serial=ext_sn or None,
|
||||
material_name=mat_name or "",
|
||||
spec_model=spec or "",
|
||||
status=task.status,
|
||||
received_at=recv_str,
|
||||
duration_hours=hours,
|
||||
|
||||
Reference in New Issue
Block a user