fix(rpa): 计划报表行按规范化名称匹配修复收料轮询not found
This commit is contained in:
1 parent
c3eef5cf20
commit
e08f314047
2 files changed
+50
-3
No files matched your search
@@ -887,6 +887,22 @@ def _resolve_scheduled_report_file_name(
|
||||
return env_value or _CRANE_SCHEDULED_REPORT_NAME_DEFAULT
|
||||
|
||||
|
||||
def _normalize_scheduled_report_name(value: Any) -> str:
|
||||
"""
|
||||
规范化 Scheduled Reports 行名/期望名,用于相等比较。
|
||||
|
||||
核心逻辑:门户行名形如 InboundDetails.xlsx,而适配器/配置侧为 Inbound Details 形态;
|
||||
直接精确比较永远不等(收料轮询曾因此 25 轮全部 not found)。统一去空白、忽略大小写、
|
||||
去掉 .xlsx/.xls 扩展名后再比较。
|
||||
"""
|
||||
text = str(value or "").strip().lower()
|
||||
if text.endswith(".xlsx"):
|
||||
text = text[: -len(".xlsx")]
|
||||
elif text.endswith(".xls"):
|
||||
text = text[: -len(".xls")]
|
||||
return "".join(text.split())
|
||||
|
||||
|
||||
def _row_matches_scheduled_report(
|
||||
row: Any,
|
||||
*,
|
||||
@@ -894,15 +910,15 @@ def _row_matches_scheduled_report(
|
||||
expected_report_name: str,
|
||||
) -> bool:
|
||||
"""
|
||||
判断行是否为目标导出:Name 精确匹配且 Description 为本次 UUID。
|
||||
判断行是否为目标导出:Name 规范化后相等且 Description 为本次 UUID。
|
||||
核心逻辑:表按 Submitted 降序,自上而下取首条匹配即最近一笔。
|
||||
"""
|
||||
wanted_name = str(expected_report_name or "").strip()
|
||||
wanted_name = _normalize_scheduled_report_name(expected_report_name)
|
||||
wanted_description = str(description or "").strip()
|
||||
if not wanted_name or not wanted_description:
|
||||
return False
|
||||
|
||||
name = _read_scheduled_row_cell(row, _CRANE_SCHEDULED_COL_NAME)
|
||||
name = _normalize_scheduled_report_name(_read_scheduled_row_cell(row, _CRANE_SCHEDULED_COL_NAME))
|
||||
if name != wanted_name:
|
||||
return False
|
||||
|
||||
|
||||
Reference in new issue
Block a user