refactor(shipping-notice): 重构货代发货通知状态管理,移除废弃的process_status字段
统一货代发货通知的业务阶段为四个标准阶段:接收解析、订单复核、发货准备、上传完成 设置 ui_state 为前端唯一状态数据源,不再依赖 process_status 驱动业务流程 删除 shipping_notices 表的废弃 process_status 列及对应复合索引,新增数据库迁移脚本 替换全栈代码中所有对 process_status 的引用为生命周期、上传状态等领域字段 更新相关文档、测试用例与前端展示逻辑适配新的状态管理规则
This commit is contained in:
1 parent
6684e7181a
commit
5ef8329bd8
178 files changed
+5091
-1734
No files matched your search
@@ -359,14 +359,14 @@ def list_batch_task_summaries(batch: Any) -> list[dict[str, Any]]:
|
||||
def compute_batch_process_summary(tasks: list[ShippingNotice]) -> dict[str, int]:
|
||||
"""批次进度汇总(Tool / 工作台 / 写回 batch.process_summary_json 共用公式)。"""
|
||||
total = len(tasks)
|
||||
completed = sum(1 for item in tasks if item.process_status in {"uploaded", "completed", "closed"})
|
||||
failed = sum(1 for item in tasks if item.process_status in {"rejected"} or item.upload_status == "failed")
|
||||
running = sum(1 for item in tasks if item.process_status not in {"uploaded", "completed", "closed", "rejected"})
|
||||
pending = sum(1 for item in tasks if item.process_status in {"created", "pending_review"} or not item.current_step)
|
||||
completed = sum(1 for item in tasks if _is_task_completed(item))
|
||||
failed = sum(1 for item in tasks if _is_task_failed(item))
|
||||
running = sum(1 for item in tasks if _is_task_active(item))
|
||||
pending = max(0, total - completed - failed - running - sum(1 for item in tasks if _is_task_needs_human(item)))
|
||||
focus = next(
|
||||
(
|
||||
item for item in sort_batch_tasks(tasks)
|
||||
if item.process_status not in {"uploaded", "completed", "closed", "rejected"}
|
||||
if not _is_task_completed(item) and not _is_task_failed(item)
|
||||
),
|
||||
None,
|
||||
)
|
||||
@@ -383,14 +383,17 @@ def compute_batch_process_summary(tasks: list[ShippingNotice]) -> dict[str, int]
|
||||
|
||||
def _is_task_completed(task: ShippingNotice) -> bool:
|
||||
"""判断任务是否已进入完成态,用于会话级聚合统计。"""
|
||||
return str(task.process_status or "").strip().lower() in {"uploaded", "completed", "closed"}
|
||||
upload_status = str(getattr(task, "upload_status", None) or "").strip().lower()
|
||||
return upload_status in {"uploaded", "succeeded", "success"} or bool(
|
||||
str(getattr(task, "freight_ref_no", None) or "").strip()
|
||||
)
|
||||
|
||||
|
||||
def _is_task_failed(task: ShippingNotice) -> bool:
|
||||
"""判断任务是否失败或上传失败,用于会话级异常优先展示。"""
|
||||
return (
|
||||
str(task.process_status or "").strip().lower() in {"rejected"}
|
||||
or str(task.upload_status or "").strip().lower() == "failed"
|
||||
str(getattr(task, "review_status", None) or "").strip().lower() == "rejected"
|
||||
or str(getattr(task, "upload_status", None) or "").strip().lower() == "failed"
|
||||
)
|
||||
|
||||
|
||||
@@ -405,8 +408,15 @@ def _is_task_active(task: ShippingNotice) -> bool:
|
||||
"""判断任务是否仍处于自动执行或等待外部系统返回的状态。"""
|
||||
if _is_task_completed(task) or _is_task_failed(task) or _is_task_needs_human(task):
|
||||
return False
|
||||
status = str(task.process_status or "").strip().lower()
|
||||
return status not in {"created", "pending_review"} and bool(status)
|
||||
lifecycle = str(getattr(task, "lifecycle_status", "active") or "active").strip().lower()
|
||||
if lifecycle != "active":
|
||||
return False
|
||||
return bool(
|
||||
getattr(task, "current_step", None)
|
||||
or getattr(task, "inventory_snapshot_id", None)
|
||||
or getattr(task, "export_file_path", None)
|
||||
or getattr(task, "upload_status", None)
|
||||
)
|
||||
|
||||
|
||||
def compute_conversation_workspace_summary(batches: list[Any]) -> dict[str, int]:
|
||||
@@ -470,7 +480,7 @@ def resolve_task_from_payload(
|
||||
if conv_id:
|
||||
candidates = (
|
||||
ShippingNotice.query.filter_by(conversation_id=conv_id)
|
||||
.filter(ShippingNotice.process_status.notin_(["rejected", "closed", "uploaded"]))
|
||||
.filter(ShippingNotice.lifecycle_status == "active")
|
||||
.order_by(ShippingNotice.id.desc())
|
||||
.limit(2)
|
||||
.all()
|
||||
@@ -492,7 +502,6 @@ def _task_tool_payload(task: ShippingNotice) -> dict[str, Any]:
|
||||
"shipping_case_id": task.shipping_case_id,
|
||||
"case_no": task.shipping_case.case_no if task.shipping_case else None,
|
||||
"business_no": task.shipping_case.business_no if task.shipping_case else None,
|
||||
"process_status": task.process_status,
|
||||
"current_step": task.current_step,
|
||||
"review_status": task.review_status,
|
||||
"match_status": task.match_status,
|
||||
@@ -523,7 +532,7 @@ def _task_tool_payload(task: ShippingNotice) -> dict[str, Any]:
|
||||
|
||||
payload["inventory_snapshot"] = serialize_inventory_snapshot_link(task)
|
||||
# Dify 画布 LLM 字段抽取需要正文;已落库订单行后不再重复下发全文。
|
||||
if raw_content and (not lines or str(task.process_status or "").strip().lower() == "created"):
|
||||
if raw_content and not lines:
|
||||
limit = max_notice_chars()
|
||||
payload["raw_text"] = raw_content[:limit] if len(raw_content) > limit else raw_content
|
||||
if len(raw_content) > limit:
|
||||
@@ -656,7 +665,6 @@ def serialize_task(task: ShippingNotice, projection: TaskProjection) -> dict[str
|
||||
"customer_name_snapshot": task.shipping_case.customer_name_snapshot if task.shipping_case else None,
|
||||
"customer_short_code_snapshot": task.shipping_case.customer_short_code_snapshot if task.shipping_case else None,
|
||||
"current_step": task.current_step,
|
||||
"process_status": task.process_status,
|
||||
"review_status": task.review_status,
|
||||
"match_status": task.match_status,
|
||||
"upload_status": task.upload_status,
|
||||
@@ -841,8 +849,10 @@ def _todo_category_from_task_row(
|
||||
extraction_id is not None
|
||||
and int(extraction_id) in extractions_with_lines
|
||||
)
|
||||
upload_status = str(getattr(row, "upload_status", None) or "").strip().lower()
|
||||
if upload_status in {"uploaded", "succeeded", "success"}:
|
||||
return "done"
|
||||
ui = resolve_task_ui_state_from_fields(
|
||||
process_status=getattr(row, "process_status", None),
|
||||
review_status=getattr(row, "review_status", None),
|
||||
pending_human_reason=getattr(row, "pending_human_reason", None),
|
||||
shipping_case_id=getattr(row, "shipping_case_id", None),
|
||||
@@ -945,11 +955,11 @@ def _inject_unified_processing_fields(task: ShippingNotice, data: dict[str, Any]
|
||||
"""
|
||||
将 Notice 关联 OT 的统一进度写入任务中心字段(BE-02 / UI-04)。
|
||||
|
||||
核心逻辑:优先 Notice.order_task_id → ShippingOrderTask;有 OT 时用 Notice 履约
|
||||
process_status 映射为 shipping_processing_status(与 shipping_processing_projection 同源),
|
||||
核心逻辑:优先 Notice.order_task_id → ShippingOrderTask;有 OT 时用领域事实
|
||||
映射为 shipping_processing_status(与 shipping_processing_projection 同源),
|
||||
并注入 shipping_processing_stage / progress_version / order_task_no;
|
||||
另附带 review_run_no / owner_agent_id / conversation_id(经 OT.extraction_run),
|
||||
供任务中心「进入订单处理」深链;无 OT 时仍按 Notice.process_status 映射。
|
||||
供任务中心「进入订单处理」深链。
|
||||
|
||||
Args:
|
||||
task: ShippingNotice(正式发货任务)。
|
||||
@@ -957,7 +967,7 @@ def _inject_unified_processing_fields(task: ShippingNotice, data: dict[str, Any]
|
||||
"""
|
||||
from app.models import ShippingOrderProcessingRun, ShippingOrderTask
|
||||
from app.services.shipping_notice.shipping_processing_projection import (
|
||||
_notice_processing_status_stage,
|
||||
_notice_domain_progress_stage,
|
||||
)
|
||||
|
||||
order_task = None
|
||||
@@ -973,7 +983,7 @@ def _inject_unified_processing_fields(task: ShippingNotice, data: dict[str, Any]
|
||||
.first()
|
||||
)
|
||||
|
||||
status, stage = _notice_processing_status_stage(task)
|
||||
status, stage = _notice_domain_progress_stage(task)
|
||||
data['shipping_processing_status'] = status
|
||||
data['shipping_processing_stage'] = (
|
||||
str(getattr(order_task, 'stage', None) or '').strip() or stage
|
||||
@@ -1114,7 +1124,6 @@ def list_tasks_for_user(
|
||||
user_id: int,
|
||||
*,
|
||||
batch_no: str | None = None,
|
||||
process_status: str | None = None,
|
||||
limit: int = 100,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""列出用户可见任务摘要,可按批次或工作台用户态状态过滤。"""
|
||||
@@ -1123,14 +1132,6 @@ def list_tasks_for_user(
|
||||
)
|
||||
if batch_no:
|
||||
return []
|
||||
if process_status:
|
||||
if process_status == "shortage_review":
|
||||
q = q.filter(
|
||||
(ShippingNotice.review_status == "shortage_review")
|
||||
| (ShippingNotice.pending_human_reason.in_(("shortage", "shortage_review")))
|
||||
)
|
||||
else:
|
||||
q = q.filter(ShippingNotice.process_status == process_status)
|
||||
rows = q.order_by(desc(ShippingNotice.created_at)).limit(max(1, min(limit, 500))).all()
|
||||
return [
|
||||
serialize_task_summary(c, viewer_user_id=user_id)
|
||||
@@ -1144,7 +1145,6 @@ def list_tasks_page_for_user(
|
||||
page: int = 1,
|
||||
page_size: int = 20,
|
||||
batch_no: str | None = None,
|
||||
process_status: str | None = None,
|
||||
lifecycle_status: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
@@ -1160,20 +1160,19 @@ def list_tasks_page_for_user(
|
||||
)
|
||||
if batch_no:
|
||||
return {"items": [], "page": normalized_page, "page_size": normalized_page_size, "total": 0}
|
||||
if process_status:
|
||||
if process_status == "shortage_review":
|
||||
q = q.filter(
|
||||
(ShippingNotice.review_status == "shortage_review")
|
||||
| (ShippingNotice.pending_human_reason.in_(("shortage", "shortage_review")))
|
||||
)
|
||||
else:
|
||||
q = q.filter(ShippingNotice.process_status == process_status)
|
||||
if lifecycle_status:
|
||||
normalized_lifecycle = str(lifecycle_status).strip().lower()
|
||||
if normalized_lifecycle == 'deleted':
|
||||
q = q.filter(ShippingNotice.deleted_at.is_not(None))
|
||||
elif normalized_lifecycle == 'active':
|
||||
q = q.filter(ShippingNotice.deleted_at.is_(None), ShippingNotice.lifecycle_status == 'active')
|
||||
q = q.filter(
|
||||
ShippingNotice.deleted_at.is_(None),
|
||||
ShippingNotice.lifecycle_status == 'active',
|
||||
db.or_(
|
||||
ShippingNotice.upload_status.is_(None),
|
||||
db.func.lower(ShippingNotice.upload_status).notin_(('uploaded', 'succeeded', 'success')),
|
||||
),
|
||||
)
|
||||
elif normalized_lifecycle == 'voided':
|
||||
# 作废后移入回收站的任务仍须出现在“已作废”视图,便于业务审计与追溯。
|
||||
q = q.filter(ShippingNotice.lifecycle_status == normalized_lifecycle)
|
||||
@@ -1373,13 +1372,18 @@ def serialize_review_case_todo(
|
||||
"created_by": case.owner_user_id,
|
||||
"source_file_name": source_name,
|
||||
"customer_name": None,
|
||||
"process_status": None,
|
||||
"updated_at": case.updated_at.isoformat() if case.updated_at else None,
|
||||
"created_at": case.created_at.isoformat() if case.created_at else None,
|
||||
"ui_state": {
|
||||
"checkpoint": "order_review",
|
||||
"stage": {"code": "order_review", "label": "订单复核", "index": 2, "total": 4},
|
||||
"checkpoint": {"code": "order_review", "kind": str(CheckpointKind.MUST_HUMAN), "label": "订单复核"},
|
||||
"todo": {"title": current_todo, "message": current_todo},
|
||||
"actions": {"primary": ({"code": action_buttons[0], "label": "重试自动建单", "kind": "recovery", "enabled": True, "requires_confirmation": False, "disabled_reason": None, "target_surface": "order_review", "expected_gate_version": None} if action_buttons else None), "secondary": []},
|
||||
"reason": {"code": f"review_case_{case.status}", "message": current_todo},
|
||||
"lifecycle_status": "active",
|
||||
"process_gate": None,
|
||||
"checkpoint_code": "order_review",
|
||||
"checkpoint_kind": str(CheckpointKind.MUST_HUMAN),
|
||||
"action_buttons": action_buttons,
|
||||
"summary": {
|
||||
"title": "待人工复核",
|
||||
"message": current_todo,
|
||||
@@ -1531,15 +1535,22 @@ def serialize_intake_todo(
|
||||
"source_file_name": source_name,
|
||||
"source_type": str(intake.source_type or "").strip() or None,
|
||||
"customer_name": None,
|
||||
"process_status": parse_status,
|
||||
"updated_at": intake.updated_at.isoformat() if intake.updated_at else None,
|
||||
"created_at": intake.created_at.isoformat() if intake.created_at else None,
|
||||
"ui_state": {
|
||||
"checkpoint": "intake_parse",
|
||||
"stage": {"code": "intake_parse", "label": "接收解析", "index": 1, "total": 4},
|
||||
"checkpoint": {"code": "order_field_extraction", "kind": str(
|
||||
CheckpointKind.MUST_HUMAN if failed else CheckpointKind.AUTO_CONTINUE
|
||||
), "label": "订单解析"},
|
||||
"todo": {"title": title, "message": message},
|
||||
"actions": {"primary": ({"code": "retry_parse", "label": "重新解析", "kind": "recovery", "enabled": True, "requires_confirmation": False, "disabled_reason": None, "target_surface": "order_review", "expected_gate_version": None} if failed else None), "secondary": []},
|
||||
"reason": ({"code": str(intake.error_code or "intake_parse_failed"), "message": message} if failed else None),
|
||||
"lifecycle_status": "active",
|
||||
"process_gate": None,
|
||||
"checkpoint_code": "order_field_extraction",
|
||||
"checkpoint_kind": str(
|
||||
CheckpointKind.MUST_HUMAN if failed else CheckpointKind.AUTO_CONTINUE
|
||||
),
|
||||
"action_buttons": ["retry_parse"] if failed else [],
|
||||
"summary": {
|
||||
"title": title,
|
||||
"message": message,
|
||||
@@ -1579,31 +1590,42 @@ def _todo_category_sql_filter(allowed: frozenset[str]):
|
||||
# wait_manual_upload:waiting_upload / 已有导出文件且未 uploaded。
|
||||
clauses.append(
|
||||
db.or_(
|
||||
ShippingNotice.process_status.in_(("waiting_upload", "upload_failed")),
|
||||
ShippingNotice.upload_status.in_(("pending", "uploading", "failed")),
|
||||
db.and_(
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
ShippingNotice.process_status.notin_(("uploaded", "closed", "rejected")),
|
||||
db.or_(
|
||||
ShippingNotice.upload_status.is_(None),
|
||||
db.func.lower(ShippingNotice.upload_status).notin_(("uploaded", "succeeded", "success")),
|
||||
),
|
||||
ShippingNotice.lifecycle_status == "active",
|
||||
),
|
||||
)
|
||||
)
|
||||
if "done" in allowed:
|
||||
# 已上传/关闭/驳回终态(不含待人工上传登记)。
|
||||
clauses.append(
|
||||
ShippingNotice.process_status.in_(("uploaded", "closed", "rejected"))
|
||||
db.or_(
|
||||
ShippingNotice.upload_status.in_(("uploaded", "succeeded", "success")),
|
||||
ShippingNotice.review_status == RS_REJECTED,
|
||||
ShippingNotice.lifecycle_status.in_(("voided", "archived", "deleted")),
|
||||
)
|
||||
)
|
||||
if "review" in allowed:
|
||||
clauses.append(
|
||||
db.or_(
|
||||
ShippingNotice.process_status == "pending_review",
|
||||
ShippingNotice.review_status.isnot(None),
|
||||
ShippingNotice.pending_human_reason.isnot(None),
|
||||
)
|
||||
)
|
||||
if "exception" in allowed:
|
||||
clauses.append(ShippingNotice.pending_human_reason.isnot(None))
|
||||
if "in_progress" in allowed:
|
||||
clauses.append(
|
||||
ShippingNotice.process_status.in_(
|
||||
("created", "parsed", "matched", "inventory_ready")
|
||||
db.or_(
|
||||
ShippingNotice.current_step.isnot(None),
|
||||
ShippingNotice.inventory_snapshot_id.isnot(None),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
ShippingNotice.upload_status.isnot(None),
|
||||
)
|
||||
)
|
||||
if not clauses:
|
||||
@@ -1657,12 +1679,13 @@ def _task_todo_category_sql_expr():
|
||||
"""
|
||||
has_lines = _task_has_dynamic_order_lines_sql()
|
||||
reason = ShippingNotice.pending_human_reason
|
||||
upload_status = db.func.lower(db.func.coalesce(ShippingNotice.upload_status, ""))
|
||||
match_status = db.func.lower(db.func.coalesce(ShippingNotice.match_status, ""))
|
||||
return case(
|
||||
(ShippingNotice.process_status == "uploaded", literal("done")),
|
||||
(ShippingNotice.process_status == "closed", literal("done")),
|
||||
(upload_status.in_(("uploaded", "succeeded", "success")), literal("done")),
|
||||
(ShippingNotice.lifecycle_status.in_(("archived", "deleted")), literal("done")),
|
||||
(
|
||||
db.or_(
|
||||
ShippingNotice.process_status == "rejected",
|
||||
ShippingNotice.review_status == RS_REJECTED,
|
||||
),
|
||||
literal("done"),
|
||||
@@ -1691,9 +1714,10 @@ def _task_todo_category_sql_expr():
|
||||
literal("in_progress"),
|
||||
),
|
||||
(reason == PH_RPA_EXHAUSTED, literal("exception")),
|
||||
# Excel 已生成即进入待人工上传登记,不依赖历史 match_status 是否补写。
|
||||
(ShippingNotice.export_file_path.isnot(None), literal("manual_upload")),
|
||||
(
|
||||
db.and_(
|
||||
ShippingNotice.process_status == "parsed",
|
||||
_sql_str_blank(ShippingNotice.review_status),
|
||||
_sql_str_blank(reason),
|
||||
_sql_json_falsy(ShippingNotice.inventory_lines_json),
|
||||
@@ -1702,7 +1726,6 @@ def _task_todo_category_sql_expr():
|
||||
),
|
||||
(
|
||||
db.and_(
|
||||
ShippingNotice.process_status == "inventory_ready",
|
||||
_sql_str_blank(ShippingNotice.review_status),
|
||||
_sql_str_blank(reason),
|
||||
_sql_str_blank(ShippingNotice.match_status),
|
||||
@@ -1712,12 +1735,12 @@ def _task_todo_category_sql_expr():
|
||||
),
|
||||
(
|
||||
db.and_(
|
||||
ShippingNotice.process_status == "matched",
|
||||
match_status.in_(("fulfillable", "partial", "unfulfillable", "matched")),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
),
|
||||
literal("manual_upload"),
|
||||
),
|
||||
(ShippingNotice.process_status == "matched", literal("in_progress")),
|
||||
(match_status.in_(("fulfillable", "partial", "unfulfillable", "matched")), literal("in_progress")),
|
||||
(reason == PH_INV_UNAVAIL, literal("exception")),
|
||||
(reason == PH_INVENTORY_SOURCE_UNRESOLVED, literal("exception")),
|
||||
(
|
||||
@@ -1727,7 +1750,7 @@ def _task_todo_category_sql_expr():
|
||||
(
|
||||
db.or_(
|
||||
reason == PH_UPLOAD_RPA_FAILED,
|
||||
ShippingNotice.process_status == "upload_failed",
|
||||
upload_status == "failed",
|
||||
),
|
||||
literal("exception"),
|
||||
),
|
||||
@@ -1735,7 +1758,7 @@ def _task_todo_category_sql_expr():
|
||||
(reason == PH_RPA_PENDING, literal("exception")),
|
||||
(reason == PH_UPLOAD_RPA_PENDING, literal("exception")),
|
||||
# Excel 后待人工上传登记。
|
||||
(ShippingNotice.process_status == "waiting_upload", literal("manual_upload")),
|
||||
(upload_status.in_(("pending", "uploading")), literal("manual_upload")),
|
||||
else_=literal("in_progress"),
|
||||
)
|
||||
|
||||
@@ -1803,28 +1826,20 @@ def _todo_tasks_base_query(
|
||||
ShippingNotice.pending_human_reason.isnot(None),
|
||||
ShippingNotice.review_status.isnot(None),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
ShippingNotice.process_status.in_(
|
||||
(
|
||||
"pending_review",
|
||||
"matched",
|
||||
"waiting_upload",
|
||||
"upload_failed",
|
||||
"parsed",
|
||||
"inventory_ready",
|
||||
"created",
|
||||
)
|
||||
),
|
||||
ShippingNotice.current_step.isnot(None),
|
||||
ShippingNotice.inventory_snapshot_id.isnot(None),
|
||||
ShippingNotice.upload_status.isnot(None),
|
||||
)
|
||||
)
|
||||
elif normalized_bucket == "done":
|
||||
# Excel 就绪(matched+export / waiting_upload)与历史上传完成均归 done。
|
||||
q = q.filter(
|
||||
db.or_(
|
||||
ShippingNotice.process_status.in_(
|
||||
("uploaded", "closed", "rejected", "waiting_upload")
|
||||
),
|
||||
ShippingNotice.upload_status.in_(("uploaded", "succeeded", "success")),
|
||||
ShippingNotice.review_status == RS_REJECTED,
|
||||
ShippingNotice.lifecycle_status.in_(("voided", "archived", "deleted")),
|
||||
db.and_(
|
||||
ShippingNotice.process_status == "matched",
|
||||
ShippingNotice.match_status.in_(("fulfillable", "partial", "unfulfillable", "matched")),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
),
|
||||
)
|
||||
@@ -1833,25 +1848,8 @@ def _todo_tasks_base_query(
|
||||
|
||||
|
||||
def _active_todo_tasks_scope(user_id: int, *, is_admin: bool = False):
|
||||
"""徽标统计用的活跃 Task 粗筛范围(不含 done)。"""
|
||||
return _visible_tasks_query_for_todos(user_id, is_admin=is_admin).filter(
|
||||
db.or_(
|
||||
ShippingNotice.pending_human_reason.isnot(None),
|
||||
ShippingNotice.review_status.isnot(None),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
ShippingNotice.process_status.in_(
|
||||
(
|
||||
"pending_review",
|
||||
"matched",
|
||||
"waiting_upload",
|
||||
"upload_failed",
|
||||
"parsed",
|
||||
"inventory_ready",
|
||||
"created",
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
"""徽标统计用的活跃 Task 范围;分类 CASE 负责排除 done。"""
|
||||
return _visible_tasks_query_for_todos(user_id, is_admin=is_admin)
|
||||
|
||||
|
||||
def list_my_todos(
|
||||
@@ -2062,11 +2060,11 @@ def count_my_todos(user_id: int, *, is_admin: bool = False) -> dict[str, int]:
|
||||
_visible_tasks_query_for_todos(user_id, is_admin=is_admin)
|
||||
.filter(
|
||||
db.or_(
|
||||
ShippingNotice.process_status.in_(
|
||||
("uploaded", "closed", "rejected", "waiting_upload")
|
||||
),
|
||||
ShippingNotice.upload_status.in_(("uploaded", "succeeded", "success")),
|
||||
ShippingNotice.review_status == RS_REJECTED,
|
||||
ShippingNotice.lifecycle_status.in_(("voided", "archived", "deleted")),
|
||||
db.and_(
|
||||
ShippingNotice.process_status == "matched",
|
||||
ShippingNotice.match_status.in_(("fulfillable", "partial", "unfulfillable", "matched")),
|
||||
ShippingNotice.export_file_path.isnot(None),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user