Compare commits

...

3 Commits

Author SHA1 Message Date
zhuotianyuan 4eeda35c2d fix(logistics): 修改courierCompany验证规则并移除冗余逻辑
将logistics.dto.ts中的courierCompany验证规则从string()改为any()
移除logistics.service.ts中关于courierCompany的条件判断逻辑,直接使用原始值
2026-01-29 11:19:33 +08:00
zhuotianyuan 4877783e3f fix(logistics): 修复货运平台courierCompany字段处理逻辑
当courierCompany为"最优物流"时不再传递空字符串,而是不设置shipCompany字段
2026-01-29 11:19:33 +08:00
zhuotianyuan d354267572 fix(logistics): 修复运单状态判断和结果合并问题
修正运单状态判断逻辑,移除冗余的条件检查
修复freightwaves服务返回结果合并方式
2026-01-29 11:19:33 +08:00
2 changed files with 14 additions and 17 deletions

View File

@ -25,7 +25,7 @@ export class ShipmentBookDTO {
shipmentPlatform: string;
@ApiProperty()
@Rule(RuleType.string())
@Rule(RuleType.any())
courierCompany: string;
}

View File

@ -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状态为SUCCESStms.freightwaves状态为00000200
if (resShipmentOrder.status === 'SUCCESS' || resShipmentOrder.code === '00000200') {
order.orderStatus = ErpOrderStatus.COMPLETED;
} else {
throw new Error('运单生成失败');
}
const dataSource = this.dataSourceManager.getDataSource('default');
let transactionError = undefined;
let shipmentId = undefined;
@ -732,13 +725,18 @@ export class LogisticsService {
};
// 添加运单
resShipmentOrder = await this.uniExpressService.createShipment(reqBody);
// 记录物流信息,并将订单状态转到完成,uniuni状态为SUCCESStms.freightwaves状态为00000200
if (resShipmentOrder.status !== 'SUCCESS') {
throw new Error('运单生成失败');
}
}
if (data.shipmentPlatform === 'freightwaves') {
// 根据TMS系统对接说明文档格式化参数
const reqBody: any = {
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
shipCompany: data.courierCompany,
partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
warehouseId: '25072621030107400060',
shipper: {
@ -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;
@ -816,11 +817,7 @@ export class LogisticsService {
}
/**
* ShipmentFeeBookDTO转换为freightwaves的RateTryRequest格式
* @param data ShipmentFeeBookDTO数据
* @returns RateTryRequest格式的数据
*/
/**
* ShipmentFeeBookDTO转换为freightwaves的RateTryRequest格式
* @param data ShipmentFeeBookDTO数据
@ -838,7 +835,7 @@ export class LogisticsService {
// 转换为RateTryRequest格式
const r = {
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
shipCompany: data.courierCompany,
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
warehouseId: '25072621030107400060', // 可选使用stockPointId转换
shipper: {