fix: 明确拦截档口入库码唯一冲突 (#231)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user