diff --git a/src/dto/logistics.dto.ts b/src/dto/logistics.dto.ts index b49b72c..48841db 100644 --- a/src/dto/logistics.dto.ts +++ b/src/dto/logistics.dto.ts @@ -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; diff --git a/src/service/logistics.service.ts b/src/service/logistics.service.ts index 90cea59..174a93e 100644 --- a/src/service/logistics.service.ts +++ b/src/service/logistics.service.ts @@ -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: {