陆运选项不全时改为复制填空清单,方便销售按编号回填。
停发填写样例图,同群只跟当前工单,重量体积统一为 KG/CBM。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -665,7 +665,10 @@ class MemoryLedger:
|
||||
ticket = self._tickets.get(work_order_no)
|
||||
if ticket is None:
|
||||
return {"ok": False, "error": "ticket_not_found"}
|
||||
ticket.collab_chat_id = (chat_id or "").strip()
|
||||
room = (chat_id or "").strip()
|
||||
# 一群同时只跟一张单:陆运/海运旧绑定也要清掉,否则群里补字段会写到旧单。
|
||||
self._unbind_other_collab_rooms(room=room, keep_work_order_no=work_order_no)
|
||||
ticket.collab_chat_id = room
|
||||
ticket.collab_member_ids = [str(x) for x in member_ids]
|
||||
ticket.product_ids = [str(x) for x in (product_ids or [])]
|
||||
ticket.product_names = [str(x).strip() for x in (product_names or []) if str(x).strip()]
|
||||
@@ -743,6 +746,22 @@ class MemoryLedger:
|
||||
ticket.collab_facts.pop(name, None)
|
||||
return {"ok": True, "facts": dict(ticket.collab_facts)}
|
||||
|
||||
def _unbind_other_collab_rooms(self, *, room: str, keep_work_order_no: str) -> None:
|
||||
"""
|
||||
同一群只留 keep 这一张单。调用方必须已持 self._lock。
|
||||
|
||||
陆运/海运旧单也要摘掉。测服 WO202609230023 补协同写到了同群陆运 WO202609230007。
|
||||
"""
|
||||
room_id = (room or "").strip()
|
||||
keep = (keep_work_order_no or "").strip()
|
||||
if not room_id:
|
||||
return
|
||||
for other in self._tickets.values():
|
||||
if other.work_order_no == keep:
|
||||
continue
|
||||
if other.collab_chat_id == room_id:
|
||||
other.collab_chat_id = ""
|
||||
|
||||
def find_by_collab_chat(self, *, chat_id: str) -> MemoryTicket | None:
|
||||
"""用工微群 chat_id 找回工单。"""
|
||||
raw = (chat_id or "").strip()
|
||||
@@ -772,10 +791,7 @@ class MemoryLedger:
|
||||
return {"ok": False, "error": "terminal", "status": ticket.status}
|
||||
if ticket.collab_chat_id and ticket.collab_chat_id != room:
|
||||
return {"ok": False, "error": "occupied", "other_chat_id": ticket.collab_chat_id}
|
||||
for other in self._tickets.values():
|
||||
if other.work_order_no != no and other.collab_chat_id == room:
|
||||
if (other.business_line or "").upper() == "AIR":
|
||||
other.collab_chat_id = ""
|
||||
self._unbind_other_collab_rooms(room=room, keep_work_order_no=no)
|
||||
ticket.collab_chat_id = room
|
||||
return {
|
||||
"ok": True,
|
||||
|
||||
Reference in New Issue
Block a user