fix: 出库批量导入审查加固(统一已出库判定 + 空登记校验)

- 抽 outbound.util.isOutbound(outTime 或 outImages 任一即已出库),单件/预览/提交统一判重复
- 预览新增「出库时间与出库图至少填一项」校验,杜绝导入成功但未出库的空登记
- 端到端实测全链路(正常/已出库/不存在/空行/含错误拒提交/成功/重复拒绝)通过
This commit is contained in:
Nixevol
2026-07-10 12:15:32 +08:00
parent 4530a83117
commit 18bdfd7e46
5 changed files with 19 additions and 5 deletions
+3 -2
View File
@@ -16,6 +16,7 @@ import { buildOrderBy } from '../common/utils/sort.util';
import { AuthUser } from '../common/decorators/current-user.decorator';
import { OutboundDto } from './dto/outbound.dto';
import { QueryImportRowsDto } from './dto/import-session.dto';
import { isOutbound } from './outbound.util';
const ZIP_MAX_SIZE = 30 * 1024 * 1024;
const SESSION_TTL_DAYS = 2;
@@ -33,8 +34,8 @@ export class OutboundService {
async updateSingle(traceCodeId: bigint, dto: OutboundDto) {
const code = await this.prisma.traceCode.findUnique({ where: { id: traceCodeId } });
if (!code) throw new BusinessException(ErrorCode.TRACE_CODE_NOT_FOUND, '追溯码不存在', 404);
// 一物一码只能出库一次:已登记出库时间的不可重复登记
if (code.outTime) {
// 一物一码只能出库一次:已登记出库时间或出库图任一即视为已出库
if (isOutbound(code)) {
throw new BusinessException(ErrorCode.BAD_REQUEST, '该追溯码已登记出库,不可重复出库');
}
const imageKeys = dto.outImageKeys ?? (dto.outImageKey ? [dto.outImageKey] : []);