diff --git a/extensions/sync_ehr_to_oa/job.py b/extensions/sync_ehr_to_oa/job.py index 570b255..796d0f8 100644 --- a/extensions/sync_ehr_to_oa/job.py +++ b/extensions/sync_ehr_to_oa/job.py @@ -610,6 +610,7 @@ class SyncEhrToOaFormJob(BaseJob): failed_count = 0 failed_data: dict[str, str] = {} do_trigger_bool = _to_bool_or_none(do_trigger) + unique_filed_payload: list[str] | None = None def _call_batch_update(*, form_code: str, chunk_rows: list[dict[str, Any]]) -> tuple[dict[str, Any], dict[str, Any], dict[str, Any]]: resp_local = seeyon.batch_update_cap4_form_soap( @@ -617,7 +618,7 @@ class SyncEhrToOaFormJob(BaseJob): loginName=oa_login_name, rightId=oa_right_id, dataList=chunk_rows, - uniqueFiled=[job_field_code], + uniqueFiled=unique_filed_payload, doTrigger=do_trigger_bool, ) rj_local = resp_local.json() if resp_local.content else {} @@ -651,25 +652,6 @@ class SyncEhrToOaFormJob(BaseJob): chunk_success = int(data.get("successCount", 0) or 0) chunk_failed = int(data.get("failedCount", 0) or 0) - all_no_master = ( - chunk_success == 0 - and chunk_failed == len(chunk) - and len(fd) > 0 - and all("没有主表记录错误" in str(v or "") for v in fd.values()) - ) - # 兜底:若 formCode 选错,改用主表名重试一次。 - if all_no_master and used_form_code != oa_master_table_name: - logger.warning( - "OA batch-update 全量无主表记录,使用主表名 formCode 重试一次:origin_formCode=%s retry_formCode=%s chunk=%s", - used_form_code, - oa_master_table_name, - i // batch_size + 1, - ) - used_form_code = oa_master_table_name - rj, data, fd = _call_batch_update(form_code=used_form_code, chunk_rows=chunk) - message = str(rj.get("message") or "") - chunk_success = int(data.get("successCount", 0) or 0) - chunk_failed = int(data.get("failedCount", 0) or 0) success_count += chunk_success failed_count += chunk_failed