feat: 档口入库码支持软删除与重导恢复 (#238)

This commit is contained in:
chengma
2026-08-15 10:49:28 +08:00
parent 4cbdc81a30
commit 2aea22b44d
13 changed files with 515 additions and 26 deletions
+7
View File
@@ -45,6 +45,7 @@ type InnerCodeImportResult struct {
TotalRows int
CreatedCount int
UpdatedCount int
RestoredCount int
DuplicateRows int
}
@@ -130,10 +131,16 @@ func ImportInnerCodeExcel(db *sql.DB, path, originalFilename, actorUserID string
return nil, fmt.Errorf("%w:Excel 第 %d 行的入库码 %q 在该业务日期已属于另一条记录",
ErrInvalidInnerCodeImport, row.SourceRow, row.InnerCode)
}
if errors.Is(err, repository.ErrInnerCodeRestoreConflict) {
return nil, fmt.Errorf("%w:Excel 第 %d 行对应的已删除记录已有远端结果,且入库码发生变化;请人工核对后处理",
ErrInvalidInnerCodeImport, row.SourceRow)
}
return nil, fmt.Errorf("导入 Excel 第 %d 行失败: %w", row.SourceRow, err)
}
if outcome == repository.InnerCodeImportCreated {
result.CreatedCount++
} else if outcome == repository.InnerCodeImportRestored {
result.RestoredCount++
} else {
result.UpdatedCount++
}