forked from yoone/API
fix(logistics): 修复物流订单状态检查和结果合并问题
修复 resShipmentOrder 状态检查时的可选链操作问题 修正 partnerOrderNumber 的拼接格式 调整查询结果合并方式,避免直接 push 操作 优化错误处理,使用 Error 对象抛出异常
This commit is contained in:
parent
0a14a7c1ae
commit
1657b96694
|
|
@ -464,7 +464,7 @@ export class LogisticsService {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (resShipmentOrder.status === 'SUCCESS') {
|
if (resShipmentOrder?.status === 'SUCCESS') {
|
||||||
await this.uniExpressService.deleteShipment(resShipmentOrder.data.tno);
|
await this.uniExpressService.deleteShipment(resShipmentOrder.data.tno);
|
||||||
}
|
}
|
||||||
throw new Error(`上游请求错误:${error}`);
|
throw new Error(`上游请求错误:${error}`);
|
||||||
|
|
@ -735,7 +735,7 @@ export class LogisticsService {
|
||||||
const reqBody: any = {
|
const reqBody: any = {
|
||||||
// shipCompany: 'UPSYYZ7000NEW',
|
// shipCompany: 'UPSYYZ7000NEW',
|
||||||
shipCompany: data.courierCompany || "",
|
shipCompany: data.courierCompany || "",
|
||||||
partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
|
partnerOrderNumber: order.siteId + '-1-' + order.externalOrderId,
|
||||||
warehouseId: '25072621030107400060',
|
warehouseId: '25072621030107400060',
|
||||||
shipper: {
|
shipper: {
|
||||||
name: data.details.origin.contact_name, // 姓名
|
name: data.details.origin.contact_name, // 姓名
|
||||||
|
|
@ -802,13 +802,17 @@ export class LogisticsService {
|
||||||
|
|
||||||
//tms只返回了物流订单号,需要查询一次来获取完整的物流信息
|
//tms只返回了物流订单号,需要查询一次来获取完整的物流信息
|
||||||
const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单
|
const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单
|
||||||
resShipmentOrder.push(queryRes);
|
return {
|
||||||
|
...resShipmentOrder,
|
||||||
|
...queryRes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resShipmentOrder;
|
return resShipmentOrder;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('物流订单处理失败:', error); // 使用console.log代替this.log
|
// 处理错误,例如记录日志或抛出异常
|
||||||
throw error;
|
throw new Error(`物流订单处理失败: ${error}`);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue