forked from yoone/API
1
0
Fork 0

Compare commits

..

No commits in common. "4eeda35c2d0e62d1020474cfc5fd754138c73030" and "7dc15319352300edba7de9e429230f502738f76f" have entirely different histories.

4 changed files with 17 additions and 31 deletions

View File

@ -27,9 +27,6 @@ export class QueryCustomerListDTO {
@ApiProperty()
customerId: number;
@ApiProperty()
phone: string;
}
export class CustomerTagDTO {

View File

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

View File

@ -28,17 +28,11 @@ export class CustomerService {
first_purchase_date,
customerId,
rate,
phone,
} = param;
const whereConds: string[] = [];
const havingConds: string[] = [];
// phone过滤
if (phone) {
whereConds.push(`o.billing LIKE '%${phone}%'`)
}
// 邮箱搜索
if (email) {
whereConds.push(`o.customer_email LIKE '%${email}%'`);

View File

@ -339,6 +339,8 @@ export class LogisticsService {
throw new Error('不支持的运单平台');
}
} catch (e) {
throw e;
}
@ -361,7 +363,12 @@ export class LogisticsService {
try {
resShipmentOrder = await this.mepShipment(data, order);
order.orderStatus = ErpOrderStatus.COMPLETED;
// 记录物流信息,并将订单状态转到完成,uniuni状态为SUCCESStms.freightwaves状态为00000200
if (resShipmentOrder.status === 'SUCCESS' || resShipmentOrder.code === '00000200') {
order.orderStatus = ErpOrderStatus.COMPLETED;
} else {
throw new Error('运单生成失败');
}
const dataSource = this.dataSourceManager.getDataSource('default');
let transactionError = undefined;
let shipmentId = undefined;
@ -460,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}`);
@ -725,18 +732,12 @@ export class LogisticsService {
};
// 添加运单
resShipmentOrder = await this.uniExpressService.createShipment(reqBody);
// 记录物流信息,并将订单状态转到完成,uniuni状态为SUCCESStms.freightwaves状态为00000200
if (resShipmentOrder.status !== 'SUCCESS') {
throw new Error('运单生成失败');
}
}
if (data.shipmentPlatform === 'freightwaves') {
// 根据TMS系统对接说明文档格式化参数
const reqBody: any = {
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany,
shipCompany: 'UPSYYZ7000NEW',
partnerOrderNumber: order.siteId + '-' + order.externalOrderId,
warehouseId: '25072621030107400060',
shipper: {
@ -803,10 +804,7 @@ export class LogisticsService {
resShipmentOrder = await this.freightwavesService.createOrder(reqBody); // 创建订单
//tms只返回了物流订单号需要查询一次来获取完整的物流信息
const queryRes = await this.freightwavesService.queryOrder({ shipOrderId: resShipmentOrder.shipOrderId }); // 查询订单
return {
...resShipmentOrder,
...queryRes
}
resShipmentOrder.push(queryRes);
}
return resShipmentOrder;
@ -817,7 +815,11 @@ export class LogisticsService {
}
/**
* ShipmentFeeBookDTO转换为freightwaves的RateTryRequest格式
* @param data ShipmentFeeBookDTO数据
* @returns RateTryRequest格式的数据
*/
/**
* ShipmentFeeBookDTO转换为freightwaves的RateTryRequest格式
* @param data ShipmentFeeBookDTO数据
@ -834,8 +836,7 @@ export class LogisticsService {
const address = shipments?.address;
// 转换为RateTryRequest格式
const r = {
// shipCompany: 'UPSYYZ7000NEW',
shipCompany: data.courierCompany,
shipCompany: 'UPSYYZ7000NEW', // 必填但ShipmentFeeBookDTO中缺少
partnerOrderNumber: `order-${Date.now()}`, // 必填,使用时间戳生成
warehouseId: '25072621030107400060', // 可选使用stockPointId转换
shipper: {