Compare commits
2 Commits
51b59ca176
...
1657b96694
| Author | SHA1 | Date |
|---|---|---|
|
|
1657b96694 | |
|
|
0a14a7c1ae |
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -247,6 +247,9 @@ export class FreightwavesService {
|
|||
};
|
||||
|
||||
const response = await this.sendRequest<RateTryResponseData>('/shipService/order/rateTry', requestData);
|
||||
if (response.code !== '00000200') {
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
@ -262,7 +265,10 @@ export class FreightwavesService {
|
|||
};
|
||||
|
||||
const response = await this.sendRequest<CreateOrderResponseData>('/shipService/order/createOrder', requestData);
|
||||
return response;
|
||||
if (response.code !== '00000200') {
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -295,6 +301,9 @@ export class FreightwavesService {
|
|||
};
|
||||
|
||||
const response = await this.sendRequest<ModifyOrderResponseData>('/shipService/order/modifyOrder', requestData);
|
||||
if (response.code !== '00000200') {
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
@ -309,6 +318,9 @@ export class FreightwavesService {
|
|||
partner: this.config.partner,
|
||||
};
|
||||
const response = await this.sendRequest<RefundOrderResponseData>('/shipService/order/refundOrder', requestData);
|
||||
if (response.code !== '00000200') {
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -464,7 +464,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}`);
|
||||
|
|
@ -733,8 +733,9 @@ export class LogisticsService {
|
|||
if (data.shipmentPlatform === 'freightwaves') {
|
||||
// 根据TMS系统对接说明文档格式化参数
|
||||
const reqBody: any = {
|
||||
shipCompany: 'UPSYYZ7000NEW',
|
||||
partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
|
||||
// shipCompany: 'UPSYYZ7000NEW',
|
||||
shipCompany: data.courierCompany || "",
|
||||
partnerOrderNumber: order.siteId + '-1-' + order.externalOrderId,
|
||||
warehouseId: '25072621030107400060',
|
||||
shipper: {
|
||||
name: data.details.origin.contact_name, // 姓名
|
||||
|
|
@ -798,15 +799,20 @@ 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;
|
||||
} catch (error) {
|
||||
console.log('物流订单处理失败:', error); // 使用console.log代替this.log
|
||||
throw error;
|
||||
// 处理错误,例如记录日志或抛出异常
|
||||
throw new Error(`物流订单处理失败: ${error}`);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -826,7 +832,8 @@ export class LogisticsService {
|
|||
const address = shipments?.address;
|
||||
// 转换为RateTryRequest格式
|
||||
const r = {
|
||||
shipCompany: 'UPSYYZ7000NEW', // 必填,但ShipmentFeeBookDTO中缺少
|
||||
//shipCompany: 'UPSYYZ7000NEW', // 必填,但ShipmentFeeBookDTO中缺少
|
||||
shipCompany: data.courierCompany || "",
|
||||
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
|
||||
warehouseId: '25072621030107400060', // 可选,使用stockPointId转换
|
||||
shipper: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue