feat: update_doc_requirement支持chapter_title回写(D3标题回填)

This commit is contained in:
yumoqing 2026-09-03 19:38:49 +08:00
parent 2617726faf
commit 921cb64a22

View File

@ -438,12 +438,13 @@ async def add_doc_requirement(project_id, requirement, req_type="structure",
async def update_doc_requirement(project_id, record_id="", chapter_no="", req_type="",
requirement="", source_ref="", page_limit="",
delete=False, who=None, agent_id=None):
chapter_title="", delete=False, who=None, agent_id=None):
"""更新/删除既有投标文件要求条目(2026-09-03,根治 add 只增不改)。
定位:record_id 优先;否则 chapter_no+req_type 唯一定位。
- delete=True → 删除该条(编造/无出处项的处置);
- requirement/source_ref/page_limit 非空 → 回写原条目(纠正必须回写,不得只追加新条目)。
- requirement/source_ref/page_limit/chapter_title 非空 → 回写原条目
(纠正必须回写,不得只追加新条目形成矛盾对)。
"""
try:
project_id = await resolve_project_id(project_id)
@ -479,6 +480,8 @@ async def update_doc_requirement(project_id, record_id="", chapter_no="", req_ty
sets, p = [], {"r": rid}
if requirement:
sets.append("requirement=${rq}$"); p["rq"] = requirement
if chapter_title:
sets.append("chapter_title=${ct}$"); p["ct"] = str(chapter_title)[:250]
if source_ref:
sets.append("source_ref=${sr}$"); p["sr"] = str(source_ref)[:480]
if page_limit: