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

Merged
longbot merged 1 commits from zhuotianyuan/API:div into stable 2026-01-28 08:45:29 +00:00
2 changed files with 11 additions and 3 deletions

View File

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

View File

@ -467,7 +467,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}`);
@ -737,7 +737,8 @@ export class LogisticsService {
if (data.shipmentPlatform === 'freightwaves') { if (data.shipmentPlatform === 'freightwaves') {
// 根据TMS系统对接说明文档格式化参数 // 根据TMS系统对接说明文档格式化参数
const reqBody: any = { const reqBody: any = {
shipCompany: 'UPSYYZ7000NEW', // shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
partnerOrderNumber: order.siteId + '-' + order.externalOrderId, partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
warehouseId: '25072621030107400060', warehouseId: '25072621030107400060',
shipper: { shipper: {
@ -836,7 +837,8 @@ export class LogisticsService {
const address = shipments?.address; const address = shipments?.address;
// 转换为RateTryRequest格式 // 转换为RateTryRequest格式
const r = { const r = {
shipCompany: 'UPSYYZ7000NEW', // 必填但ShipmentFeeBookDTO中缺少 // shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany || "",
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成 partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
warehouseId: '25072621030107400060', // 可选使用stockPointId转换 warehouseId: '25072621030107400060', // 可选使用stockPointId转换
shipper: { shipper: {