落地海运协同群:测服靠会话存档听群话,报价单能带上协同字段。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-15 18:12:45 +08:00
co-authored by Cursor
parent 235ecd8c83
commit 12219cacb1
39 changed files with 4436 additions and 256 deletions
+58
View File
@@ -102,6 +102,15 @@ class HttpLedger:
return {"ok": False, "found": False, "owned": False, "work_order_no": work_order_no}
return out
def get_ticket(self, *, work_order_no: str) -> dict[str, Any] | None:
"""用工单号读快照。给群入站在按房间反查时用。找不到返回 None。"""
out = self.get_for_agent(work_order_no=work_order_no, sender_id="")
if not out or (not out.get("found") and not out.get("work_order_no") and not out.get("ok")):
return None
if out.get("found") is False and out.get("ok") is False:
return None
return out
def query_tms(
self,
*,
@@ -224,6 +233,7 @@ class HttpLedger:
chat_id: str,
member_ids: list[str],
product_names: list[str] | None = None,
product_ids: list[str] | None = None,
) -> dict[str, Any]:
out = self._post(
"/inquiry/agent/ticket/bindCollabGroup",
@@ -232,6 +242,7 @@ class HttpLedger:
"chatId": chat_id,
"memberIds": member_ids,
"productNames": product_names or [],
"productIds": product_ids or [],
},
idem=f"bind-group:{work_order_no}",
)
@@ -261,3 +272,50 @@ class HttpLedger:
if not out.get("found") and not out.get("work_order_no"):
return None
return out
def end_collab_group(self, *, work_order_no: str) -> dict[str, Any]:
"""协同结束,这单不能再拉群。不改六态。"""
return self._post(
"/inquiry/agent/ticket/endCollabGroup",
{"workOrderNo": work_order_no},
idem=f"end-collab:{work_order_no}",
)
def attach_file(
self,
*,
work_order_no: str,
file_name: str,
object_key: str = "",
content_type: str = "",
sender_id: str = "",
) -> dict[str, Any]:
"""群附件元数据写入主账。"""
return self._post(
"/inquiry/agent/ticket/attachFile",
{
"workOrderNo": work_order_no,
"fileName": file_name,
"objectKey": object_key or file_name,
"contentType": content_type,
"senderId": sender_id,
},
)
def upsert_product_quote(
self,
*,
work_order_no: str,
quote: dict[str, Any],
to_status: str = "已报价",
) -> dict[str, Any]:
"""产品报价写入主账并迁已报价。"""
return self._post(
"/inquiry/agent/ticket/upsertProductQuote",
{
"workOrderNo": work_order_no,
"quote": quote,
"toStatus": to_status,
},
idem=f"product-quote:{work_order_no}:{sorted((quote or {}).keys())}",
)