"""临时质检对象:系统产品 / 外部编号互斥归一化。""" from typing import Optional, Tuple def resolve_temp_qc_target( *, cell_product_id: Optional[str] = None, external_target_code: Optional[str] = None, ) -> Tuple[Optional[str], Optional[str]]: """临时质检对象互斥归一化。返回 (cell_product_id|None, external_target_code|None)。""" cp = (cell_product_id or "").strip() or None ext = (external_target_code or "").strip() or None if cp and ext: raise ValueError("质检对象不能同时选择系统产品并填写外部编号") if not cp and not ext: raise ValueError("请选择质检对象或填写外部编号") if ext and len(ext) > 64: raise ValueError("外部编号最长 64 个字符") if ext: return None, ext return cp, None