fix: get_pending_detector_serial 不再删除记录,避免 B2 消费后 B4 拿不到序列号

This commit is contained in:
wangfq
2026-06-15 16:45:49 +08:00
parent ff9482780d
commit a2f31b3bfe

View File

@@ -866,7 +866,7 @@ async def get_vehicle_base_test_by_type(type_num: int) -> dict | None:
# ─── tb_pending_detector ─────────────────────────────────────────── # ─── tb_pending_detector ───────────────────────────────────────────
async def get_pending_detector_serial(dnt_id: int) -> str: async def get_pending_detector_serial(dnt_id: int) -> str:
"""获取并清除待插入的车检器序列号(一次性消费)""" """获取待插入的车检器序列号"""
pool = await get_pool() pool = await get_pool()
async with pool.acquire() as conn: async with pool.acquire() as conn:
async with conn.cursor(aiomysql.DictCursor) as cur: async with conn.cursor(aiomysql.DictCursor) as cur:
@@ -876,10 +876,5 @@ async def get_pending_detector_serial(dnt_id: int) -> str:
) )
row = await cur.fetchone() row = await cur.fetchone()
if row: if row:
# 清除已消费的记录
await cur.execute(
"DELETE FROM tb_pending_detector WHERE dnt_id=%s",
(dnt_id,),
)
return row["detector_serial"] or "" return row["detector_serial"] or ""
return "" return ""