feat(shipping-notice): 新增临时库存管理功能,支持创建会话、获取分析结果及字段映射建议
This commit is contained in:
1 parent
46eb63f5bb
commit
e9bdd81f1a
320 files changed
+28361
-10487
No files matched your search
@@ -31,7 +31,7 @@ def _click_dsv_password_method(page: Any) -> bool:
|
||||
return True
|
||||
return _wait_for_visible_selector(
|
||||
page,
|
||||
"FREIGHT_RPA_DSV_PASSWORD_SELECTOR",
|
||||
"SHIPPING_NOTICE_RPA_WORKER_DSV_PASSWORD_SELECTOR",
|
||||
("input#userpassword", 'input[name="userpassword"]', 'input[name="password"]', 'input[type="password"]'),
|
||||
timeout_ms=250,
|
||||
) is not None
|
||||
@@ -299,8 +299,8 @@ _DSV_PASSWORD_UPGRADE_PROMPT_MARKERS: tuple[str, ...] = (
|
||||
|
||||
|
||||
def _dsv_maybe_later_selector_candidates() -> tuple[str, ...]:
|
||||
"""返回“也许以后 / Maybe later”按钮候选选择器;支持 FREIGHT_RPA_DSV_MAYBE_LATER_SELECTOR 覆盖。"""
|
||||
selector = _env("FREIGHT_RPA_DSV_MAYBE_LATER_SELECTOR")
|
||||
"""返回“也许以后 / Maybe later”按钮候选选择器;支持 SHIPPING_NOTICE_RPA_WORKER_DSV_MAYBE_LATER_SELECTOR 覆盖。"""
|
||||
selector = _env("SHIPPING_NOTICE_RPA_WORKER_DSV_MAYBE_LATER_SELECTOR")
|
||||
return (selector,) if selector else _DSV_MAYBE_LATER_SELECTORS
|
||||
|
||||
|
||||
@@ -571,7 +571,7 @@ def _has_dsv_human_check_prompt(page: Any) -> bool:
|
||||
|
||||
|
||||
def _wait_for_dsv_login_method_page(page: Any, timeout_ms: int | None = None) -> bool:
|
||||
wait_ms = timeout_ms if timeout_ms is not None else max(5_000, int(_env("FREIGHT_RPA_DSV_METHOD_PAGE_TIMEOUT_MS", "20000") or "20000"))
|
||||
wait_ms = timeout_ms if timeout_ms is not None else max(5_000, int(_env("SHIPPING_NOTICE_RPA_WORKER_DSV_METHOD_PAGE_TIMEOUT_MS", "20000") or "20000"))
|
||||
deadline = time.monotonic() + (wait_ms / 1000)
|
||||
while time.monotonic() < deadline:
|
||||
if "s360.dbschenker.com" in page.url and "auth.dbschenker.com" not in page.url:
|
||||
@@ -640,7 +640,7 @@ def _find_dsv_password_locator(page: Any, timeout_ms: int = 250):
|
||||
selectors = tuple(
|
||||
item
|
||||
for item in (
|
||||
_env("FREIGHT_RPA_DSV_PASSWORD_SELECTOR"),
|
||||
_env("SHIPPING_NOTICE_RPA_WORKER_DSV_PASSWORD_SELECTOR"),
|
||||
"input#userpassword",
|
||||
'input[name="userpassword"]',
|
||||
'input[name="password"]',
|
||||
@@ -688,7 +688,7 @@ def _is_dsv_blank_auth_transition(page: Any) -> bool:
|
||||
|
||||
def _dsv_login_ready_timeout_ms() -> int:
|
||||
"""DSV 登录表单/跳转就绪的最大等待秒数。"""
|
||||
return max(60_000, int(_env("FREIGHT_RPA_LOGIN_READY_TIMEOUT_MS", "120000") or "120000"))
|
||||
return max(60_000, int(_env("SHIPPING_NOTICE_RPA_WORKER_LOGIN_READY_TIMEOUT_MS", "120000") or "120000"))
|
||||
|
||||
|
||||
def _wait_for_dsv_auth_page_ready(page: Any, *, timeout_ms: int | None = None) -> bool:
|
||||
@@ -712,7 +712,7 @@ def _wait_for_dsv_auth_page_ready(page: Any, *, timeout_ms: int | None = None) -
|
||||
return True
|
||||
if _wait_for_visible_selector(
|
||||
page,
|
||||
"FREIGHT_RPA_DSV_USERNAME_SELECTOR",
|
||||
"SHIPPING_NOTICE_RPA_WORKER_DSV_USERNAME_SELECTOR",
|
||||
_DSV_USERNAME_SELECTORS,
|
||||
timeout_ms=500,
|
||||
) is not None:
|
||||
@@ -801,7 +801,7 @@ def _fill_dsv_username(page: Any, username: str, preferred_locator: Any | None =
|
||||
if preferred_locator is not None and _try_fill_dsv_username_locator(preferred_locator, username):
|
||||
return preferred_locator
|
||||
|
||||
timeout_ms = max(5_000, int(_env("FREIGHT_RPA_LOGIN_READY_TIMEOUT_MS", "300000") or "300000"))
|
||||
timeout_ms = max(5_000, int(_env("SHIPPING_NOTICE_RPA_WORKER_LOGIN_READY_TIMEOUT_MS", "300000") or "300000"))
|
||||
deadline = time.monotonic() + (timeout_ms / 1000)
|
||||
while time.monotonic() < deadline:
|
||||
for frame in page.frames:
|
||||
|
||||
Reference in new issue
Block a user