feat: duplicate product detection — STEP conflict warnings on Excel import and CAD upload

- Excel preview detects when a product already has a different STEP file linked
- Excel preview detects intra-Excel conflicts (same product, different CAD model names)
- Product STEP upload warns when replacing an existing file and shows render count
- All warnings are non-blocking (amber badges, toast warnings)
- LEARNINGS.md: all open items resolved

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-14 13:05:40 +01:00
parent f0dd952f63
commit b6bac080bb
10 changed files with 207 additions and 173 deletions
+18
View File
@@ -39,6 +39,14 @@ class ExcelPreviewRow(BaseModel):
has_step: bool = False
is_duplicate: bool = False
duplicate_of_row: int | None = None
# STEP conflict: existing product has a different STEP file than Excel row's name_cad_modell
step_conflict: bool = False
step_conflict_existing_name: str | None = None
step_conflict_excel_name: str | None = None
# Intra-Excel conflict: same product key appears with different name_cad_modell
cad_name_conflict: bool = False
cad_name_conflict_other_name: str | None = None
cad_name_conflict_row: int | None = None
class ExcelPreviewResponse(BaseModel):
@@ -52,6 +60,8 @@ class ExcelPreviewResponse(BaseModel):
has_step_count: int = 0
no_step_count: int = 0
duplicate_count: int = 0
step_conflict_count: int = 0
cad_name_conflict_count: int = 0
warnings: list[str]
rows: list[ExcelPreviewRow]
column_headers: list[str] = []
@@ -145,6 +155,12 @@ async def upload_excel(
has_step=r.get("has_step", False),
is_duplicate=r.get("is_duplicate", False),
duplicate_of_row=r.get("duplicate_of_row"),
step_conflict=r.get("step_conflict", False),
step_conflict_existing_name=r.get("step_conflict_existing_name"),
step_conflict_excel_name=r.get("step_conflict_excel_name"),
cad_name_conflict=r.get("cad_name_conflict", False),
cad_name_conflict_other_name=r.get("cad_name_conflict_other_name"),
cad_name_conflict_row=r.get("cad_name_conflict_row"),
)
for r in preview.rows
]
@@ -195,6 +211,8 @@ async def upload_excel(
has_step_count=preview.has_step_count,
no_step_count=preview.no_step_count,
duplicate_count=preview.duplicate_count,
step_conflict_count=preview.step_conflict_count,
cad_name_conflict_count=preview.cad_name_conflict_count,
warnings=all_warnings,
rows=annotated_rows,
column_headers=parsed_dict.get("column_headers", []),