feat(logistics): 添加courierCompany字段并更新相关逻辑

在ShipmentBookDTO和ShipmentFeeBookDTO中添加courierCompany字段
更新物流服务中shipCompany的赋值逻辑,优先使用courierCompany
This commit is contained in:
zhuotianyuan 2026-01-27 19:55:43 +08:00
parent 7dc1531935
commit be32eead2c
2 changed files with 11 additions and 3 deletions

View File

@ -23,6 +23,10 @@ export class ShipmentBookDTO {
@ApiProperty()
@Rule(RuleType.string())
shipmentPlatform: string;
@ApiProperty()
@Rule(RuleType.string())
courierCompany: string;
}
export class ShipmentFeeBookDTO {
@ -30,6 +34,8 @@ export class ShipmentFeeBookDTO {
@ApiProperty()
shipmentPlatform: string;
@ApiProperty()
courierCompany: string;
@ApiProperty()
stockPointId: number;
@ApiProperty()
sender: string;

View File

@ -467,7 +467,7 @@ export class LogisticsService {
}
};
} catch (error) {
if (resShipmentOrder.status === 'SUCCESS') {
if (resShipmentOrder?.status === 'SUCCESS') {
await this.uniExpressService.deleteShipment(resShipmentOrder.data.tno);
}
throw new Error(`上游请求错误:${error}`);
@ -737,7 +737,8 @@ export class LogisticsService {
if (data.shipmentPlatform === 'freightwaves') {
// 根据TMS系统对接说明文档格式化参数
const reqBody: any = {
shipCompany: 'UPSYYZ7000NEW',
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
warehouseId: '25072621030107400060',
shipper: {
@ -836,7 +837,8 @@ export class LogisticsService {
const address = shipments?.address;
// 转换为RateTryRequest格式
const r = {
shipCompany: 'UPSYYZ7000NEW', // 必填但ShipmentFeeBookDTO中缺少
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
warehouseId: '25072621030107400060', // 可选使用stockPointId转换
shipper: {