Compare commits
No commits in common. "1657b96694f18942f7b14c1f3a00dce29a8ed0f5" and "51b59ca17650dd588263bcabe34265e3b7f787a8" have entirely different histories.
1657b96694
...
51b59ca176
|
|
@ -23,10 +23,6 @@ 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 {
|
||||||
|
|
@ -34,8 +30,6 @@ export class ShipmentFeeBookDTO {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
shipmentPlatform: string;
|
shipmentPlatform: string;
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
courierCompany: string;
|
|
||||||
@ApiProperty()
|
|
||||||
stockPointId: number;
|
stockPointId: number;
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
sender: string;
|
sender: string;
|
||||||
|
|
|
||||||
|
|
@ -247,9 +247,6 @@ export class FreightwavesService {
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendRequest<RateTryResponseData>('/shipService/order/rateTry', requestData);
|
const response = await this.sendRequest<RateTryResponseData>('/shipService/order/rateTry', requestData);
|
||||||
if (response.code !== '00000200') {
|
|
||||||
throw new Error(response.msg);
|
|
||||||
}
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -265,10 +262,7 @@ export class FreightwavesService {
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendRequest<CreateOrderResponseData>('/shipService/order/createOrder', requestData);
|
const response = await this.sendRequest<CreateOrderResponseData>('/shipService/order/createOrder', requestData);
|
||||||
if (response.code !== '00000200') {
|
return response;
|
||||||
throw new Error(response.msg);
|
|
||||||
}
|
|
||||||
return response.data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -301,9 +295,6 @@ export class FreightwavesService {
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await this.sendRequest<ModifyOrderResponseData>('/shipService/order/modifyOrder', requestData);
|
const response = await this.sendRequest<ModifyOrderResponseData>('/shipService/order/modifyOrder', requestData);
|
||||||
if (response.code !== '00000200') {
|
|
||||||
throw new Error(response.msg);
|
|
||||||
}
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -318,9 +309,6 @@ export class FreightwavesService {
|
||||||
partner: this.config.partner,
|
partner: this.config.partner,
|
||||||
};
|
};
|
||||||
const response = await this.sendRequest<RefundOrderResponseData>('/shipService/order/refundOrder', requestData);
|
const response = await this.sendRequest<RefundOrderResponseData>('/shipService/order/refundOrder', requestData);
|
||||||
if (response.code !== '00000200') {
|
|
||||||
throw new Error(response.msg);
|
|
||||||
}
|
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -464,7 +464,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}`);
|
||||||
|
|
@ -733,9 +733,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 + '-1-' + order.externalOrderId,
|
|
||||||
warehouseId: '25072621030107400060',
|
warehouseId: '25072621030107400060',
|
||||||
shipper: {
|
shipper: {
|
||||||
name: data.details.origin.contact_name, // 姓名
|
name: data.details.origin.contact_name, // 姓名
|
||||||
|
|
@ -799,20 +798,15 @@ export class LogisticsService {
|
||||||
};
|
};
|
||||||
|
|
||||||
resShipmentOrder = await this.freightwavesService.createOrder(reqBody); // 创建订单
|
resShipmentOrder = await this.freightwavesService.createOrder(reqBody); // 创建订单
|
||||||
|
|
||||||
//tms只返回了物流订单号,需要查询一次来获取完整的物流信息
|
//tms只返回了物流订单号,需要查询一次来获取完整的物流信息
|
||||||
const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单
|
const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单
|
||||||
return {
|
resShipmentOrder.push(queryRes);
|
||||||
...resShipmentOrder,
|
|
||||||
...queryRes
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resShipmentOrder;
|
return resShipmentOrder;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 处理错误,例如记录日志或抛出异常
|
console.log('物流订单处理失败:', error); // 使用console.log代替this.log
|
||||||
throw new Error(`物流订单处理失败: ${error}`);
|
throw error;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -832,8 +826,7 @@ export class LogisticsService {
|
||||||
const address = shipments?.address;
|
const address = shipments?.address;
|
||||||
// 转换为RateTryRequest格式
|
// 转换为RateTryRequest格式
|
||||||
const r = {
|
const r = {
|
||||||
//shipCompany: 'UPSYYZ7000NEW', // 必填,但ShipmentFeeBookDTO中缺少
|
shipCompany: 'UPSYYZ7000NEW', // 必填,但ShipmentFeeBookDTO中缺少
|
||||||
shipCompany: data.courierCompany || "",
|
|
||||||
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
|
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
|
||||||
warehouseId: '25072621030107400060', // 可选,使用stockPointId转换
|
warehouseId: '25072621030107400060', // 可选,使用stockPointId转换
|
||||||
shipper: {
|
shipper: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue