feat(shipping-notice): 增加 RPA Worker 心跳上报与状态查询功能
This commit is contained in:
1 parent
c3f05ba96b
commit
5a147c4d85
49 files changed
+4032
-1500
No files matched your search
@@ -62,6 +62,38 @@ def _has_dsv_report_nav_usable(page: Any) -> bool:
|
||||
pass
|
||||
return _has_dsv_report_nav_attached(page)
|
||||
|
||||
def _is_dsv_in_report_navigation_context(page: Any) -> bool:
|
||||
"""
|
||||
判断当前是否仍处于报表 iframe / SSRS 上下文,而非 portal 首页。
|
||||
|
||||
核心逻辑:报表 frame URL 与 portal 首页一样会渲染 Home/Favorites 侧栏与 Reports 顶栏;
|
||||
仅探测 Reports 导航不足以区分,必须结合顶层 URL 与 report-frame 是否仍挂载。
|
||||
"""
|
||||
try:
|
||||
current_url = str(page.url or "").lower()
|
||||
except Exception:
|
||||
current_url = ""
|
||||
if "/main/portal/frame/reports/" in current_url:
|
||||
return True
|
||||
if "/s360reports/" in current_url:
|
||||
return True
|
||||
for frame in getattr(page, "frames", []):
|
||||
try:
|
||||
frame_url = str(frame.url or "").lower()
|
||||
except Exception:
|
||||
frame_url = ""
|
||||
if "/s360reports/reports/default.aspx" in frame_url:
|
||||
return True
|
||||
if "/s360reports/ssrs/" in frame_url:
|
||||
return True
|
||||
try:
|
||||
if frame.locator("#ReportViewerMain").count() > 0:
|
||||
return True
|
||||
except Exception:
|
||||
continue
|
||||
return False
|
||||
|
||||
|
||||
def _is_dsv_on_portal_home(page: Any) -> bool:
|
||||
"""URL 已在 portal 且主页面已出现 Home/Favorites/Recent Reports 等内容。"""
|
||||
try:
|
||||
@@ -72,6 +104,8 @@ def _is_dsv_on_portal_home(page: Any) -> bool:
|
||||
return False
|
||||
if "s360.dbschenker.com" not in current_url:
|
||||
return False
|
||||
if _is_dsv_in_report_navigation_context(page):
|
||||
return False
|
||||
try:
|
||||
body = str(page.locator("body").inner_text(timeout=1_000) or "").lower()
|
||||
except Exception:
|
||||
@@ -219,11 +253,13 @@ def _is_dsv_home_ready(page: Any) -> bool:
|
||||
"""
|
||||
判断 DSV 是否已经稳定进入首页导航态。
|
||||
|
||||
核心逻辑:必须离开认证域名,且 Reports 导航已可用(跨 frame 探测);
|
||||
用户肉眼已在 portal 首页时,不再仅依赖顶层 #report-mega-legacy 计数。
|
||||
核心逻辑:必须离开认证域名与报表 iframe 上下文,且 Reports 导航已可用;
|
||||
停留在 `/main/portal/frame/reports/` 时即使顶栏可见,也不应视为 home-ready。
|
||||
"""
|
||||
if "auth.dbschenker.com" in page.url:
|
||||
return False
|
||||
if _is_dsv_in_report_navigation_context(page):
|
||||
return False
|
||||
return _has_dsv_report_nav_usable(page)
|
||||
|
||||
def _wait_for_dsv_home_ready(
|
||||
@@ -376,6 +412,7 @@ has_dsv_portal_shell = _has_dsv_portal_shell
|
||||
has_dsv_report_nav_attached = _has_dsv_report_nav_attached
|
||||
has_dsv_report_nav_usable = _has_dsv_report_nav_usable
|
||||
is_dsv_home_ready = _is_dsv_home_ready
|
||||
is_dsv_in_report_navigation_context = _is_dsv_in_report_navigation_context
|
||||
is_dsv_on_portal_home = _is_dsv_on_portal_home
|
||||
iter_dsv_report_nav_locators = _iter_dsv_report_nav_locators
|
||||
wait_for_dsv_app_after_login = _wait_for_dsv_app_after_login
|
||||
|
||||
Reference in new issue
Block a user