fix: 明确拦截档口入库码唯一冲突 (#231)

This commit is contained in:
chengma
2026-08-15 09:12:23 +08:00
parent 9ca7f83289
commit c0eb957097
3 changed files with 44 additions and 2 deletions
+4
View File
@@ -125,6 +125,10 @@ func ImportInnerCodeExcel(db *sql.DB, path, businessDate, actorUserID string) (*
for _, row := range rows {
outcome, err := repository.UpsertInnerCodeImportRow(tx, row, now)
if err != nil {
if errors.Is(err, repository.ErrInnerCodeUniqueConflict) {
return nil, fmt.Errorf("%w:Excel 第 %d 行的入库码 %q 在该业务日期已属于另一条记录",
ErrInvalidInnerCodeImport, row.SourceRow, row.InnerCode)
}
return nil, fmt.Errorf("导入 Excel 第 %d 行失败: %w", row.SourceRow, err)
}
if outcome == repository.InnerCodeImportCreated {