fix: 修复出库追溯码默认加载

This commit is contained in:
Nixevol
2026-07-03 04:35:05 +08:00
parent 9eda1b722a
commit bc6a4e9cc2
5 changed files with 109 additions and 30 deletions
+6 -5
View File
@@ -4,6 +4,7 @@ import { Queue } from 'bullmq';
import { Response } from 'express';
import { createHash } from 'crypto';
import * as ExcelJS from 'exceljs';
import { Prisma } from '@prisma/client';
import {
ErrorCode,
JobType,
@@ -35,13 +36,13 @@ 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);
const data: Prisma.TraceCodeUpdateInput = {};
if ('outTime' in dto) data.outTime = dto.outTime ? new Date(dto.outTime) : null;
if ('outImageKey' in dto) data.outImage = dto.outImageKey || null;
if ('remark' in dto) data.remark = dto.remark || null;
const updated = await this.prisma.traceCode.update({
where: { id: traceCodeId },
data: {
outTime: dto.outTime ? new Date(dto.outTime) : undefined,
outImage: dto.outImageKey,
remark: dto.remark,
},
data,
});
// 录入了上链哈希则记录一条已上链存证(手工登记,不触发 Mock 链)
if (dto.txHash) {