fix: 修复出库追溯码默认加载
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user