From 59f4c46f08d5ae141795146331d438e837d0c396 Mon Sep 17 00:00:00 2001 From: zhuotianyuan Date: Wed, 28 Jan 2026 17:43:57 +0800 Subject: [PATCH] =?UTF-8?q?fix(logistics):=20=E4=BF=AE=E5=A4=8D=E8=BF=90?= =?UTF-8?q?=E5=8D=95=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E5=92=8C=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E5=90=88=E5=B9=B6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正运单状态判断逻辑,移除冗余的条件检查 修复freightwaves服务返回结果合并方式 --- src/service/logistics.service.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/service/logistics.service.ts b/src/service/logistics.service.ts index 174a93e..a410f7c 100644 --- a/src/service/logistics.service.ts +++ b/src/service/logistics.service.ts @@ -339,8 +339,6 @@ export class LogisticsService { throw new Error('不支持的运单平台'); } - - } catch (e) { throw e; } @@ -363,12 +361,7 @@ export class LogisticsService { try { resShipmentOrder = await this.mepShipment(data, order); - // 记录物流信息,并将订单状态转到完成,uniuni状态为SUCCESS,tms.freightwaves状态为00000200 - if (resShipmentOrder.status === 'SUCCESS' || resShipmentOrder.code === '00000200') { - order.orderStatus = ErpOrderStatus.COMPLETED; - } else { - throw new Error('运单生成失败'); - } + order.orderStatus = ErpOrderStatus.COMPLETED; const dataSource = this.dataSourceManager.getDataSource('default'); let transactionError = undefined; let shipmentId = undefined; @@ -732,6 +725,11 @@ export class LogisticsService { }; // 添加运单 resShipmentOrder = await this.uniExpressService.createShipment(reqBody); + + // 记录物流信息,并将订单状态转到完成,uniuni状态为SUCCESS,tms.freightwaves状态为00000200 + if (resShipmentOrder.status !== 'SUCCESS') { + throw new Error('运单生成失败'); + } } if (data.shipmentPlatform === 'freightwaves') { @@ -805,7 +803,10 @@ export class LogisticsService { resShipmentOrder = await this.freightwavesService.createOrder(reqBody); // 创建订单 //tms只返回了物流订单号,需要查询一次来获取完整的物流信息 const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单 - resShipmentOrder.push(queryRes); + return { + ...resShipmentOrder, + ...queryRes + } } return resShipmentOrder;