Compare commits
4 Commits
02596feb3d
...
da4208707d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da4208707d | ||
|
|
0b77a1c63e | ||
|
|
de9eb2b657 | ||
|
|
59bd112893 |
@ -60,6 +60,7 @@ class PoloApiClient {
|
||||
},
|
||||
content: formBody,
|
||||
});
|
||||
|
||||
console.log('formBody', formBody);
|
||||
let result;
|
||||
if (Buffer.isBuffer(response.data)) {
|
||||
@ -71,6 +72,7 @@ class PoloApiClient {
|
||||
} else {
|
||||
result = response.data;
|
||||
}
|
||||
await this.ctx.app.setCacheAsync('PoloApiresult', JSON.stringify(result), 3600);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -11,49 +11,12 @@ class OrderPrintService extends OrderBaseService {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
const _noNeedLogin = '';
|
||||
const _noNeedRight = 'getWavePrintData,getWavePlatformPrintData,unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
const _noNeedLog = 'getWavePrintData,unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
const _noNeedAuth = 'getWavePrintData,getWavePlatformPrintData,unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
const _noNeedRight = 'getWavePlatformPrintData,unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
const _noNeedLog = 'unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
const _noNeedAuth = 'getWavePlatformPrintData,unlockWavePlatformPrintDataByGroup,getOrderPrintData,getPrintDataByWaybillCodes';
|
||||
this.systemInit(_noNeedLogin, _noNeedRight, _noNeedLog, _noNeedAuth);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取波次打印数据。
|
||||
*
|
||||
* method 层仅负责参数解构与边界校验,具体业务查询由 systems 层实现。
|
||||
* 返回结果中的 ext 会同时包含 missing_wave_ids 与 filtered_wave_ids。
|
||||
*
|
||||
* @param {Object} data 请求体。
|
||||
* @param {Array<number|string>} data.wave_ids 波次ID数组。
|
||||
* @param {number|string} data.warehouse_id 仓库ID。
|
||||
* @return {Promise<Object>} 统一 success 包装的打印数据结果。
|
||||
*/
|
||||
async getWavePrintData(data = {}) {
|
||||
const requestData = this.isPlainObject(data) ? data : {};
|
||||
const {
|
||||
wave_ids: waveIds,
|
||||
warehouse_id: warehouseId,
|
||||
} = requestData;
|
||||
|
||||
if (!Array.isArray(waveIds) || waveIds.length === 0) {
|
||||
throw new Error('wave_ids 必填,且必须为非空数组');
|
||||
}
|
||||
|
||||
if (warehouseId === undefined || warehouseId === null || String(warehouseId).trim() === '') {
|
||||
throw new Error('warehouse_id 必填');
|
||||
}
|
||||
|
||||
const result = await this.service.systems.orderPrint.getWavePrintData({
|
||||
waveIds,
|
||||
warehouseId,
|
||||
});
|
||||
|
||||
return this.success('ok', {
|
||||
data: result,
|
||||
code: 200,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取波次平台打印中间态数据。
|
||||
*
|
||||
|
||||
@ -2095,44 +2095,36 @@ class RecheckOrderService extends OrderBaseService {
|
||||
}
|
||||
);
|
||||
|
||||
const taskId = Number(
|
||||
let resolvedTaskId = Number(
|
||||
(Array.isArray(taskRows) && taskRows.length > 0 ? taskRows[0]?.task_id : 0)
|
||||
);
|
||||
|
||||
if (taskId <= 0) {
|
||||
// 团购模式(pick_mode=1/5)回退:wms_wave_pick_task_order 无记录时,
|
||||
// 通过订单所属波次查找关联的拣货任务
|
||||
if (resolvedTaskId <= 0) {
|
||||
resolvedTaskId = await this._resolveTaskIdByWaveFallback(orderId, warehouseId);
|
||||
}
|
||||
|
||||
if (resolvedTaskId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查该任务下是否所有订单都已复核完成
|
||||
const unreviewedRows = await ctx.model.query(
|
||||
`SELECT COUNT(*) AS cnt
|
||||
FROM wms_wave_pick_task_order
|
||||
WHERE task_id = :taskId
|
||||
AND warehouse_id = :warehouseId
|
||||
AND review_status != 1`,
|
||||
{
|
||||
replacements: { taskId, warehouseId },
|
||||
type: ctx.model.QueryTypes.SELECT,
|
||||
}
|
||||
);
|
||||
const allReviewed = await this._checkTaskOrdersAllReviewed(resolvedTaskId, warehouseId);
|
||||
|
||||
const unreviewedCount = Number(
|
||||
(Array.isArray(unreviewedRows) && unreviewedRows.length > 0 ? unreviewedRows[0]?.cnt : 0)
|
||||
);
|
||||
|
||||
if (unreviewedCount > 0) {
|
||||
if (!allReviewed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 任务下所有订单均已复核完成,更新任务状态为复核通过,并解绑车任务(失败不影响主流程)
|
||||
try {
|
||||
await this.unbindCartForTask(taskId, warehouseId, operatorUserId);
|
||||
await this.unbindCartForTask(resolvedTaskId, warehouseId, operatorUserId);
|
||||
ctx.logger.info(
|
||||
`[confirmRecheck] 车任务解绑成功, taskId=${taskId}, orderId=${orderId}, operatorUserId=${operatorUserId}`
|
||||
`[confirmRecheck] 车任务解绑成功, taskId=${resolvedTaskId}, orderId=${orderId}, operatorUserId=${operatorUserId}`
|
||||
);
|
||||
} catch (unbindError) {
|
||||
ctx.logger.warn(
|
||||
`[confirmRecheck] 解绑车任务失败(复核已成功), taskId=${taskId}, orderId=${orderId}, error=${unbindError.message}`
|
||||
`[confirmRecheck] 解绑车任务失败(复核已成功), taskId=${resolvedTaskId}, orderId=${orderId}, error=${unbindError.message}`
|
||||
);
|
||||
}
|
||||
|
||||
@ -2155,12 +2147,122 @@ class RecheckOrderService extends OrderBaseService {
|
||||
WHERE id = :taskId
|
||||
AND warehouse_id = :warehouseId`,
|
||||
{
|
||||
replacements: { taskId, warehouseId, operatorUserId, operatorName, now },
|
||||
replacements: { taskId: resolvedTaskId, warehouseId, operatorUserId, operatorName, now },
|
||||
type: ctx.model.QueryTypes.UPDATE,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 团购模式(pick_mode=1/5)回退:通过订单的波次 ID 查找关联的拣货任务 ID。
|
||||
* wms_wave_pick_task_order 在团购模式下无记录,需要绕道 wave 关联表。
|
||||
*
|
||||
* @param {number} orderId 订单ID。
|
||||
* @param {number} warehouseId 仓库ID。
|
||||
* @return {Promise<number>} 任务ID,未找到返回 0。
|
||||
*/
|
||||
async _resolveTaskIdByWaveFallback(orderId, warehouseId) {
|
||||
const { ctx } = this;
|
||||
|
||||
// 查订单所属 wave_id
|
||||
const orderModel = await this.getOrderModelByTableType('current', warehouseId);
|
||||
const order = await orderModel.findOne({
|
||||
where: { id: orderId, warehouse_id: warehouseId },
|
||||
attributes: [ 'id', 'wave_id' ],
|
||||
raw: true,
|
||||
});
|
||||
const orderWaveId = Number(order?.wave_id || 0);
|
||||
if (orderWaveId <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 通过 wave_id 查拣货任务(仅限团购模式 pick_mode=1/5)
|
||||
const taskWaveRows = await ctx.model.query(
|
||||
`SELECT DISTINCT t.id AS task_id, t.pick_mode
|
||||
FROM wms_wave_pick_task_wave tw
|
||||
INNER JOIN wms_wave_pick_task t
|
||||
ON t.id = tw.task_id AND t.warehouse_id = :warehouseId
|
||||
WHERE tw.wave_id = :waveId
|
||||
AND tw.warehouse_id = :warehouseId
|
||||
AND t.pick_mode IN (1, 5)
|
||||
LIMIT 1`,
|
||||
{
|
||||
replacements: { waveId: orderWaveId, warehouseId },
|
||||
type: ctx.model.QueryTypes.SELECT,
|
||||
}
|
||||
);
|
||||
|
||||
const fallbackTaskId = Number(
|
||||
(Array.isArray(taskWaveRows) && taskWaveRows.length > 0 ? taskWaveRows[0]?.task_id : 0)
|
||||
);
|
||||
|
||||
if (fallbackTaskId <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 检查波次下所有订单是否均已复核完成(团购模式以订单表 recheck_status 为准)
|
||||
const unreviewedInWave = await orderModel.count({
|
||||
where: {
|
||||
wave_id: orderWaveId,
|
||||
warehouse_id: warehouseId,
|
||||
recheck_status: { [ctx.app.Sequelize.Op.ne]: 'fin' },
|
||||
},
|
||||
});
|
||||
|
||||
return unreviewedInWave === 0 ? fallbackTaskId : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查拣货任务下是否所有订单均已复核完成。
|
||||
* - 散单模式:检查 wms_wave_pick_task_order.review_status
|
||||
* - 团购模式:已由 _resolveTaskIdByWaveFallback 预先校验,此处直接返回 true
|
||||
*
|
||||
* @param {number} taskId 拣货任务ID。
|
||||
* @param {number} warehouseId 仓库ID。
|
||||
* @return {Promise<boolean>} 全部已复核返回 true。
|
||||
*/
|
||||
async _checkTaskOrdersAllReviewed(taskId, warehouseId) {
|
||||
const { ctx } = this;
|
||||
|
||||
// 先确认 wms_wave_pick_task_order 中是否有记录
|
||||
const totalRows = await ctx.model.query(
|
||||
`SELECT COUNT(*) AS cnt
|
||||
FROM wms_wave_pick_task_order
|
||||
WHERE task_id = :taskId
|
||||
AND warehouse_id = :warehouseId`,
|
||||
{
|
||||
replacements: { taskId, warehouseId },
|
||||
type: ctx.model.QueryTypes.SELECT,
|
||||
}
|
||||
);
|
||||
const totalCount = Number(
|
||||
(Array.isArray(totalRows) && totalRows.length > 0 ? totalRows[0]?.cnt : 0)
|
||||
);
|
||||
|
||||
if (totalCount > 0) {
|
||||
// 散单模式:检查是否有未复核的订单
|
||||
const unreviewedRows = await ctx.model.query(
|
||||
`SELECT COUNT(*) AS cnt
|
||||
FROM wms_wave_pick_task_order
|
||||
WHERE task_id = :taskId
|
||||
AND warehouse_id = :warehouseId
|
||||
AND review_status != 1`,
|
||||
{
|
||||
replacements: { taskId, warehouseId },
|
||||
type: ctx.model.QueryTypes.SELECT,
|
||||
}
|
||||
);
|
||||
const unreviewedCount = Number(
|
||||
(Array.isArray(unreviewedRows) && unreviewedRows.length > 0 ? unreviewedRows[0]?.cnt : 0)
|
||||
);
|
||||
return unreviewedCount === 0;
|
||||
}
|
||||
|
||||
// 团购模式(wms_wave_pick_task_order 无记录):
|
||||
// 已在 _resolveTaskIdByWaveFallback 中通过订单表的 recheck_status 校验通过
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新波次拣货任务订单的复核状态,并按任务维度检查是否需要解绑车任务。
|
||||
* 与单订单版本不同,本方法一次性更新所有相关任务订单的 review_status,
|
||||
@ -2220,10 +2322,20 @@ class RecheckOrderService extends OrderBaseService {
|
||||
}
|
||||
);
|
||||
|
||||
const taskIds = (Array.isArray(taskRows) ? taskRows : [])
|
||||
let taskIds = (Array.isArray(taskRows) ? taskRows : [])
|
||||
.map(r => Number(r.task_id || 0))
|
||||
.filter(id => id > 0);
|
||||
|
||||
// 团购模式(pick_mode=1/5)回退:wms_wave_pick_task_order 无记录时,
|
||||
// 通过订单的波次 ID 查找关联的拣货任务
|
||||
if (taskIds.length === 0 && orderIds.length > 0) {
|
||||
const firstOrderId = orderIds[0];
|
||||
const fallbackTaskId = await this._resolveTaskIdByWaveFallback(firstOrderId, warehouseId);
|
||||
if (fallbackTaskId > 0) {
|
||||
taskIds = [ fallbackTaskId ];
|
||||
}
|
||||
}
|
||||
|
||||
// 逐任务判断是否所有订单均已复核完成
|
||||
for (const taskId of taskIds) {
|
||||
const unreviewedRows = await ctx.model.query(
|
||||
@ -4422,41 +4534,33 @@ class RecheckOrderService extends OrderBaseService {
|
||||
(Array.isArray(taskRows) && taskRows.length > 0 ? taskRows[0]?.task_id : 0)
|
||||
);
|
||||
|
||||
if (taskId <= 0) {
|
||||
// 团购模式(pick_mode=1/5)回退:wms_wave_pick_task_order 无记录时,
|
||||
// 通过订单所属波次查找关联的拣货任务(回退查询使用独立连接,不参与当前事务)
|
||||
let resolvedTaskId = taskId;
|
||||
if (resolvedTaskId <= 0) {
|
||||
resolvedTaskId = await this._resolveTaskIdByWaveFallback(orderId, warehouseId);
|
||||
}
|
||||
|
||||
if (resolvedTaskId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 检查该任务下是否所有订单都已复核完成
|
||||
const unreviewedRows = await ctx.model.query(
|
||||
`SELECT COUNT(*) AS cnt
|
||||
FROM wms_wave_pick_task_order
|
||||
WHERE task_id = :taskId
|
||||
AND warehouse_id = :warehouseId
|
||||
AND review_status != 1`,
|
||||
{
|
||||
replacements: { taskId, warehouseId },
|
||||
type: ctx.model.QueryTypes.SELECT,
|
||||
transaction,
|
||||
}
|
||||
);
|
||||
const allReviewed = await this._checkTaskOrdersAllReviewed(resolvedTaskId, warehouseId);
|
||||
|
||||
const unreviewedCount = Number(
|
||||
(Array.isArray(unreviewedRows) && unreviewedRows.length > 0 ? unreviewedRows[0]?.cnt : 0)
|
||||
);
|
||||
|
||||
if (unreviewedCount > 0) {
|
||||
if (!allReviewed) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 任务下所有订单均已复核完成,解绑车任务
|
||||
try {
|
||||
await this._unbindCartForTaskInTransaction(taskId, warehouseId, operatorUserId, transaction);
|
||||
await this._unbindCartForTaskInTransaction(resolvedTaskId, warehouseId, operatorUserId, transaction);
|
||||
ctx.logger.info(
|
||||
`[batchQuickRecheck] 车任务解绑成功, taskId=${taskId}, orderId=${orderId}, operatorUserId=${operatorUserId}`
|
||||
`[batchQuickRecheck] 车任务解绑成功, taskId=${resolvedTaskId}, orderId=${orderId}, operatorUserId=${operatorUserId}`
|
||||
);
|
||||
} catch (unbindError) {
|
||||
ctx.logger.warn(
|
||||
`[batchQuickRecheck] 解绑车任务失败(复核已成功), taskId=${taskId}, orderId=${orderId}, error=${unbindError.message}`
|
||||
`[batchQuickRecheck] 解绑车任务失败(复核已成功), taskId=${resolvedTaskId}, orderId=${orderId}, error=${unbindError.message}`
|
||||
);
|
||||
}
|
||||
|
||||
@ -4479,7 +4583,7 @@ class RecheckOrderService extends OrderBaseService {
|
||||
WHERE id = :taskId
|
||||
AND warehouse_id = :warehouseId`,
|
||||
{
|
||||
replacements: { taskId, warehouseId, operatorUserId, operatorName, now },
|
||||
replacements: { taskId: resolvedTaskId, warehouseId, operatorUserId, operatorName, now },
|
||||
type: ctx.model.QueryTypes.UPDATE,
|
||||
transaction,
|
||||
}
|
||||
|
||||
@ -11519,14 +11519,13 @@ class WaveService extends OrderBaseService {
|
||||
}
|
||||
|
||||
// 通过绑定表判断车是否被其他活跃任务占用(不依赖 wms_pick_cart.current_task_id)
|
||||
// 仅以 wms_pick_task_cart_binding.is_active = 1 为准,不关联任务状态做二次过滤
|
||||
const bindingRows = await this.ctx.model.query(`
|
||||
SELECT b.task_id
|
||||
FROM wms_pick_task_cart_binding b
|
||||
INNER JOIN wms_wave_pick_task t ON t.id = b.task_id
|
||||
WHERE b.cart_id = :cartId
|
||||
AND b.warehouse_id = :warehouseId
|
||||
AND b.is_active = 1
|
||||
AND t.status IN (0, 1)
|
||||
LIMIT 1
|
||||
FOR UPDATE
|
||||
`, {
|
||||
@ -12808,7 +12807,7 @@ class WaveService extends OrderBaseService {
|
||||
}
|
||||
|
||||
const orderRows = await currentOrderModel.findAll({
|
||||
attributes: [ 'id', 'wave_id', 'sys_platform_code', 'source_platform_code' ],
|
||||
attributes: [ 'id', 'wave_id', 'sys_platform_code', 'source_platform_code', 'sys_logistics_code' ],
|
||||
where: {
|
||||
wave_id: {
|
||||
[Op.in]: normalizedWaveIds,
|
||||
@ -12836,6 +12835,7 @@ class WaveService extends OrderBaseService {
|
||||
id: orderId,
|
||||
sys_platform_code: String(row && row.sys_platform_code || ''),
|
||||
source_platform_code: String(row && row.source_platform_code || ''),
|
||||
sys_logistics_code: String(row && row.sys_logistics_code || ''),
|
||||
});
|
||||
}
|
||||
|
||||
@ -12863,7 +12863,21 @@ class WaveService extends OrderBaseService {
|
||||
|
||||
let rowIndex = 0;
|
||||
for (const waveId of normalizedWaveIds) {
|
||||
const orderRowsByWave = waveOrderRowsMap.get(waveId) || [];
|
||||
const rawOrderRows = waveOrderRowsMap.get(waveId) || [];
|
||||
// 按平台+快递排序:同平台、同快递订单聚合在一起,确保 wave_index 连续分配
|
||||
const orderRowsByWave = [ ...rawOrderRows ].sort((a, b) => {
|
||||
const platformA = String(
|
||||
(a && a.sys_platform_code) || (a && a.source_platform_code) || ''
|
||||
).trim().toLowerCase();
|
||||
const platformB = String(
|
||||
(b && b.sys_platform_code) || (b && b.source_platform_code) || ''
|
||||
).trim().toLowerCase();
|
||||
if (platformA !== platformB) return platformA.localeCompare(platformB);
|
||||
const logisticsA = String((a && a.sys_logistics_code) || '').trim().toLowerCase();
|
||||
const logisticsB = String((b && b.sys_logistics_code) || '').trim().toLowerCase();
|
||||
if (logisticsA !== logisticsB) return logisticsA.localeCompare(logisticsB);
|
||||
return (Number(a && a.id) || 0) - (Number(b && b.id) || 0);
|
||||
});
|
||||
const platformsIndexMap = new Map();
|
||||
const platformSequenceMap = new Map();
|
||||
for (const orderRow of orderRowsByWave) {
|
||||
|
||||
@ -1050,6 +1050,7 @@ class DeliveryOrderService extends Service {
|
||||
isUrgency,
|
||||
invoiceFlag,
|
||||
receiverInfo,
|
||||
sourceOrderCode
|
||||
} = deliveryOrder;
|
||||
|
||||
const policyConfig = await this.getStoreWarehousePolicyConfig(info.storeId, info.warehouseId);
|
||||
@ -1083,7 +1084,7 @@ class DeliveryOrderService extends Service {
|
||||
create_at: createTime ? new Date(createTime) : new Date(),
|
||||
place_order_time: placeOrderTime ? new Date(placeOrderTime) : null,
|
||||
pay_time: payTime ? new Date(payTime) : null,
|
||||
pay_no: payNo || '',
|
||||
pay_no: payNo || sourceOrderCode || '',
|
||||
shop_nick: shopNick,
|
||||
seller_nick: sellerNick,
|
||||
buyer_nick: buyerNick,
|
||||
|
||||
@ -59,7 +59,7 @@ const WAYBILL_ORDER_DELIVERY_MIN_ATTRIBUTES = Object.freeze([
|
||||
'extend_props',
|
||||
'buyer_nick',
|
||||
'pay_no',
|
||||
'from_key'
|
||||
'from_key',
|
||||
]);
|
||||
|
||||
class ExpressService extends Service {
|
||||
@ -2273,18 +2273,42 @@ class ExpressService extends Service {
|
||||
const normalizedOrders = Array.isArray(bizcontent && bizcontent.orders)
|
||||
? bizcontent.orders
|
||||
: [];
|
||||
const dispatchPayloads = this.shouldDispatchWaybillAsyncPerOrder(normalizedPlatformCode) && normalizedOrders.length > 1
|
||||
? normalizedOrders.map(order => ({
|
||||
|
||||
// 需要逐单调用的平台(cainiao/pdd):拆分为逐单 payload,并发调用
|
||||
if (this.shouldDispatchWaybillAsyncPerOrder(normalizedPlatformCode) && normalizedOrders.length > 1) {
|
||||
const perOrderPayloads = normalizedOrders.map(order => ({
|
||||
...bizcontent,
|
||||
orders: [ order ],
|
||||
}))
|
||||
: [ bizcontent ];
|
||||
}));
|
||||
|
||||
for (const payload of dispatchPayloads) {
|
||||
const dispatchResult = await dispatchMethod.call(expressPlatformService, payload);
|
||||
if (dispatchResult && typeof dispatchResult === 'object' && dispatchResult.flag === 'failure') {
|
||||
throw new Error(dispatchResult.message || normalizedPlatformCode + '接口调用失败');
|
||||
const perOrderResults = await Promise.all(
|
||||
perOrderPayloads.map(payload =>
|
||||
dispatchMethod.call(expressPlatformService, payload).then(
|
||||
dispatchResult => ({ payload, dispatchResult, error: null }),
|
||||
error => ({ payload, dispatchResult: null, error })
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
// 检查是否有失败结果;取第一个失败原因作为异常抛出
|
||||
const firstFailure = perOrderResults.find(
|
||||
item => item.error
|
||||
|| (item.dispatchResult && typeof item.dispatchResult === 'object' && item.dispatchResult.flag === 'failure')
|
||||
);
|
||||
if (firstFailure) {
|
||||
const failureMessage = firstFailure.error
|
||||
? (firstFailure.error.message || String(firstFailure.error))
|
||||
: (firstFailure.dispatchResult && firstFailure.dispatchResult.message);
|
||||
throw new Error(failureMessage || normalizedPlatformCode + '接口调用失败');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 非逐单平台:保持原有单次批量调用
|
||||
const dispatchResult = await dispatchMethod.call(expressPlatformService, bizcontent);
|
||||
if (dispatchResult && typeof dispatchResult === 'object' && dispatchResult.flag === 'failure') {
|
||||
throw new Error(dispatchResult.message || normalizedPlatformCode + '接口调用失败');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2462,7 +2486,7 @@ class ExpressService extends Service {
|
||||
[Op.in]: [ 1, 2, 3, 4 ],
|
||||
},
|
||||
},
|
||||
attributes: [ 'id', 'sys_platform_code', 'logistics_code', 'sys_platform_name', 'logistics_name', 'store_id','pay_no','from_key' ],
|
||||
attributes: [ 'id', 'sys_platform_code', 'logistics_code', 'sys_platform_name', 'logistics_name', 'store_id', 'pay_no', 'from_key' ],
|
||||
raw: true,
|
||||
});
|
||||
|
||||
@ -2483,7 +2507,7 @@ class ExpressService extends Service {
|
||||
[Op.in]: [ 4 ],
|
||||
},
|
||||
},
|
||||
attributes: [ 'id', 'sys_platform_code', 'logistics_code', 'sys_platform_name', 'logistics_name', 'store_id','pay_no','from_key' ],
|
||||
attributes: [ 'id', 'sys_platform_code', 'logistics_code', 'sys_platform_name', 'logistics_name', 'store_id', 'pay_no', 'from_key' ],
|
||||
raw: true,
|
||||
});
|
||||
}
|
||||
@ -2621,15 +2645,18 @@ class ExpressService extends Service {
|
||||
...expressInterface,
|
||||
} : null;
|
||||
|
||||
for (const batch of batches) {
|
||||
// 异步不阻塞调用 createWaybillCode,快速返回结果给前端,后续的订单处理和异常回写都在 createWaybillCode 内部完成。
|
||||
if (pipelineOptions.awaitTasks) {
|
||||
await this.asyncTask(batch, {
|
||||
// 各批次并发执行:同组内不同批次的订单相互独立,无重叠,可安全并发
|
||||
if (pipelineOptions.awaitTasks) {
|
||||
await Promise.all(batches.map(batch =>
|
||||
this.asyncTask(batch, {
|
||||
...groupedOrder.options,
|
||||
trace_id: traceId,
|
||||
warehouse_id: warehouseId,
|
||||
}, matchedPlatformWithRequestCode, expressInterfaceConfig);
|
||||
} else {
|
||||
}, matchedPlatformWithRequestCode, expressInterfaceConfig)
|
||||
));
|
||||
} else {
|
||||
// 非等待模式:fire-and-forget,所有批次同时触发
|
||||
for (const batch of batches) {
|
||||
this.asyncTask(batch, {
|
||||
...groupedOrder.options,
|
||||
trace_id: traceId,
|
||||
@ -2799,7 +2826,10 @@ class ExpressService extends Service {
|
||||
const { app, ctx } = this;
|
||||
const { Op } = app.Sequelize;
|
||||
const orderExpressModel = ctx.model && ctx.model.OrderExpress;
|
||||
const currentWarehouseId = this.getCurrentWarehouseId();
|
||||
const currentWarehouseId = Number(
|
||||
(listByWarehousePlatformCode && listByWarehousePlatformCode.warehouse_id)
|
||||
|| this.getCurrentWarehouseId()
|
||||
);
|
||||
if (!orderExpressModel
|
||||
|| typeof orderExpressModel.findAll !== 'function'
|
||||
|| typeof orderExpressModel.update !== 'function'
|
||||
@ -3152,7 +3182,7 @@ class ExpressService extends Service {
|
||||
business_key: order.business_key,
|
||||
status: 0,
|
||||
retry_count: 0,
|
||||
warehouse_id: this.getCurrentWarehouseId(),
|
||||
warehouse_id: currentWarehouseId,
|
||||
store_id: order.store_id || null,
|
||||
logistics_code: (listByWarehousePlatformCode && listByWarehousePlatformCode.sys_express_code) || '',
|
||||
delivery_order_code: (orderDeliveryMap.get(order.order_id) && orderDeliveryMap.get(order.order_id).delivery_order_code) || null,
|
||||
|
||||
@ -920,21 +920,87 @@ class ExpressPlatformService extends MainService {
|
||||
});
|
||||
console.log("分配运单号结果",result);
|
||||
|
||||
if (result && result.code !== '10000') {
|
||||
const postOrderErrorMessage = String(
|
||||
result.submessage || result.message || '菠萝派平台接口调用失败'
|
||||
).trim();
|
||||
this.ctx.logger.error('[expressPlatform.polyapi] PolyAPI 返回业务失败', {
|
||||
traceId,
|
||||
code: result.code,
|
||||
message: postOrderErrorMessage,
|
||||
response: result,
|
||||
});
|
||||
// 清洗本批次全部订单资源,然后抛出
|
||||
const allFailedOrders = this.buildFailedOrderCleanupList(orders);
|
||||
await this.cleanupFailedWaybillOrders(allFailedOrders, `PostOrder业务失败: ${postOrderErrorMessage}`);
|
||||
throw new Error(`菠萝派平台接口返回错误信息:${postOrderErrorMessage},原始错误信息: \`\`\`${JSON.stringify(result)}\`\`\``);
|
||||
} else if (result && result.code === '10000') {
|
||||
// 统一处理:不再依赖顶层 code,直接从 results 逐条提取 issuccess 和 submessage
|
||||
{
|
||||
// 逐条检查 issuccess,将平台返回的业务失败项单独提取,避免因 logisticno 为空被误判为"运单号为空"
|
||||
const allResults = Array.isArray(result.results) ? result.results : [];
|
||||
const itemFailedList = [];
|
||||
const itemSuccessList = [];
|
||||
for (const item of allResults) {
|
||||
const isSuccess = String(item.issuccess || '') === '1';
|
||||
if (isSuccess) {
|
||||
itemSuccessList.push(item);
|
||||
} else {
|
||||
itemFailedList.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 逐条失败项:按 submessage 分组,每组使用各自的失败原因
|
||||
if (itemFailedList.length > 0) {
|
||||
// 按 submessage 分组
|
||||
const reasonGroups = new Map();
|
||||
for (const failedItem of itemFailedList) {
|
||||
const itemReason = String(
|
||||
failedItem.submessage || failedItem.message || failedItem.subcode || '平台返回逐条业务失败'
|
||||
).trim();
|
||||
if (!reasonGroups.has(itemReason)) {
|
||||
reasonGroups.set(itemReason, []);
|
||||
}
|
||||
reasonGroups.get(itemReason).push(failedItem);
|
||||
}
|
||||
|
||||
this.ctx.logger.error('[expressPlatform.polyapi] results 中存在逐条业务失败项', {
|
||||
traceId,
|
||||
totalCount: allResults.length,
|
||||
failedCount: itemFailedList.length,
|
||||
successCount: itemSuccessList.length,
|
||||
reasonGroups: Array.from(reasonGroups.keys()),
|
||||
sampleFailItem: JSON.stringify(itemFailedList.slice(0, 3)),
|
||||
});
|
||||
|
||||
// 逐组清理
|
||||
for (const [ groupReason, groupItems ] of reasonGroups) {
|
||||
const itemFailedOrders = [];
|
||||
for (const failedItem of groupItems) {
|
||||
const [ , order_id, business_key ] = String(failedItem.orderno || '').split('_');
|
||||
const orderId = Number(order_id) || 0;
|
||||
const businessKey = Number(business_key) || 0;
|
||||
if (!orderId || !businessKey) continue;
|
||||
|
||||
let storeId = 0;
|
||||
let warehouseId = 0;
|
||||
for (const order of Array.isArray(orders) ? orders : []) {
|
||||
const orderDelivery = order && order.order_delivery;
|
||||
const oId = Number(orderDelivery && orderDelivery.id) || 0;
|
||||
const bk = Number(order && order.business_key) || 0;
|
||||
if (oId === orderId && bk === businessKey) {
|
||||
storeId = Number(orderDelivery && orderDelivery.store_id) || 0;
|
||||
warehouseId = Number(orderDelivery && orderDelivery.warehouse_id) || 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
itemFailedOrders.push({
|
||||
order_id: orderId,
|
||||
business_key: businessKey,
|
||||
warehouse_id: warehouseId,
|
||||
store_id: storeId,
|
||||
});
|
||||
}
|
||||
if (itemFailedOrders.length > 0) {
|
||||
await this.cleanupFailedWaybillOrders(itemFailedOrders, groupReason);
|
||||
}
|
||||
}
|
||||
|
||||
// 全部订单都失败则抛出
|
||||
if (itemSuccessList.length === 0) {
|
||||
const firstReason = Array.from(reasonGroups.keys())[0] || '平台返回逐条业务失败';
|
||||
throw new Error(firstReason);
|
||||
}
|
||||
}
|
||||
|
||||
// 仅用成功的 items 继续处理
|
||||
result.results = itemSuccessList;
|
||||
|
||||
const resolveWaybillCode = item => String(item && (item.waybill_code || item.logisticno) || '').trim();
|
||||
let successUpdates = [];
|
||||
switch (listByWarehousePlatformCode.platform_code) {
|
||||
|
||||
@ -413,10 +413,12 @@ async function syncManualOrdersInternal(service, groupedOrder = {}, context = {}
|
||||
|
||||
const waybillCodeMap = await buildOrderWaybillCodeMapInternal(service, orderIds);
|
||||
|
||||
// dispatch前最终去重,防止同一orderId在列表中重复导致并发双扣
|
||||
const uniqueOrderIds = [ ...new Set(orderIds) ];
|
||||
const progressCacheKey = getSyncOrderIdsProgressCacheKey(context.request_id);
|
||||
const syncResults = [];
|
||||
for (let i = 0; i < orderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = orderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
for (let i = 0; i < uniqueOrderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = uniqueOrderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
const batchResults = await Promise.all(batch.map(orderId => {
|
||||
const dispathedOrderRow = orderMap.get(orderId);
|
||||
if (!dispathedOrderRow) {
|
||||
@ -842,10 +844,12 @@ async function finalizeLocalChannelOrdersInternal(service, createChannel, groupe
|
||||
|
||||
void orderItemRows;
|
||||
|
||||
// dispatch前最终去重,防止同一orderId在列表中重复导致并发双扣
|
||||
const uniqueOrderIds = [ ...new Set(orderIds) ];
|
||||
const progressCacheKey = getSyncOrderIdsProgressCacheKey(context.request_id);
|
||||
const syncResults = [];
|
||||
for (let i = 0; i < orderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = orderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
for (let i = 0; i < uniqueOrderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = uniqueOrderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
const batchResults = await Promise.all(batch.map(orderId => {
|
||||
const dispathedOrderRow = orderMap.get(orderId);
|
||||
if (!dispathedOrderRow) {
|
||||
@ -1208,9 +1212,11 @@ async function syncQmOrdersInternal(service, groupedOrder = {}, context = {}) {
|
||||
|
||||
const qimenClient = service.app.qimenClient;
|
||||
const progressCacheKey = getSyncOrderIdsProgressCacheKey(context.request_id);
|
||||
// dispatch前最终去重,防止同一orderId在列表中重复导致并发双扣
|
||||
const uniqueOrderIds = [ ...new Set(orderIds) ];
|
||||
const qimenResults = [];
|
||||
for (let i = 0; i < orderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = orderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
for (let i = 0; i < uniqueOrderIds.length; i += DISPATCH_BATCH_SIZE) {
|
||||
const batch = uniqueOrderIds.slice(i, i + DISPATCH_BATCH_SIZE);
|
||||
const batchResults = await Promise.all(batch.map(orderId => {
|
||||
// 分发时二次检查:orderRow 不在 map 中则跳过
|
||||
const dispathedOrderRow = orderMap.get(orderId);
|
||||
|
||||
@ -456,50 +456,6 @@ class OrderPrintSystemService extends OrderBaseService {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取波次打印数据。
|
||||
*
|
||||
* @param {Object} params 请求参数。
|
||||
* @param {Array<number|string>} params.waveIds 波次ID数组。
|
||||
* @param {number|string} params.warehouseId 仓库ID。
|
||||
* @return {Promise<Object>} 通用打印数据结构。
|
||||
*/
|
||||
async getWavePrintData(params = {}) {
|
||||
const requestParams = this.isPlainObject(params) ? params : {};
|
||||
const {
|
||||
waveIds,
|
||||
warehouseId,
|
||||
} = requestParams;
|
||||
|
||||
const normalizedWaveIds = this.normalizeWaveIds(waveIds);
|
||||
if (normalizedWaveIds.length === 0) {
|
||||
throw new Error('wave_ids 必填,且必须为非空数组');
|
||||
}
|
||||
|
||||
const normalizedWarehouseId = this.resolveWarehouseId(warehouseId);
|
||||
const waveRows = await this.queryWavesByIds(normalizedWarehouseId, normalizedWaveIds);
|
||||
if (waveRows.length === 0) {
|
||||
return this.buildEmptyResult(normalizedWaveIds);
|
||||
}
|
||||
|
||||
const hitWaveIdSet = new Set(waveRows.map(row => Number(row.wave_id)));
|
||||
const missingWaveIds = normalizedWaveIds.filter(waveId => !hitWaveIdSet.has(waveId));
|
||||
const hitWaveIds = normalizedWaveIds.filter(waveId => hitWaveIdSet.has(waveId));
|
||||
const orderRows = await this.queryOrdersByWaveIds(hitWaveIds, normalizedWarehouseId);
|
||||
const {
|
||||
validWaveIds,
|
||||
filteredWaveIds,
|
||||
} = this.filterFullyAssignedExpressWaves(hitWaveIds, orderRows);
|
||||
|
||||
return this.buildWavePrintResult({
|
||||
waveRows,
|
||||
orderRows,
|
||||
hitWaveIds: validWaveIds,
|
||||
missingWaveIds,
|
||||
filteredWaveIds,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取波次平台打印数据中间态。
|
||||
*
|
||||
@ -3324,138 +3280,6 @@ ${waveFilterSql}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成空结果结构。
|
||||
*
|
||||
* @param {Array<number>} normalizedWaveIds 规范化后的波次ID数组。
|
||||
* @return {Object} 空结果。
|
||||
*/
|
||||
buildEmptyResult(normalizedWaveIds = []) {
|
||||
return {
|
||||
summary: {
|
||||
total_waves: 0,
|
||||
total_orders: 0,
|
||||
},
|
||||
wave_list: [],
|
||||
ext: {
|
||||
missing_wave_ids: normalizedWaveIds,
|
||||
filtered_wave_ids: [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装通用波次打印返回结构。
|
||||
*
|
||||
* @param {Object} payload 聚合输入。
|
||||
* @param {Array<Object>} payload.waveRows 波次列表。
|
||||
* @param {Array<Object>} payload.orderRows 订单列表。
|
||||
* @param {Array<number>} payload.hitWaveIds 命中的波次ID数组。
|
||||
* @param {Array<number>} payload.missingWaveIds 未命中的波次ID数组。
|
||||
* @param {Array<Object>} payload.filteredWaveIds 被过滤的波次及原因。
|
||||
* @return {Object} 波次打印返回结果。
|
||||
*/
|
||||
buildWavePrintResult(payload = {}) {
|
||||
const {
|
||||
waveRows = [],
|
||||
orderRows = [],
|
||||
hitWaveIds = [],
|
||||
missingWaveIds = [],
|
||||
filteredWaveIds = [],
|
||||
} = this.isPlainObject(payload) ? payload : {};
|
||||
|
||||
const waveMetaMap = new Map();
|
||||
for (const row of waveRows) {
|
||||
const waveId = Number(row && row.wave_id || 0);
|
||||
if (!Number.isInteger(waveId) || waveId <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
waveMetaMap.set(waveId, {
|
||||
wave_id: waveId,
|
||||
wave_no: String(row && row.wave_no || '').trim(),
|
||||
});
|
||||
}
|
||||
|
||||
const groupedWaveMap = new Map();
|
||||
for (const waveId of hitWaveIds) {
|
||||
const waveMeta = waveMetaMap.get(waveId);
|
||||
if (!waveMeta) {
|
||||
continue;
|
||||
}
|
||||
|
||||
groupedWaveMap.set(waveId, {
|
||||
wave_id: waveMeta.wave_id,
|
||||
wave_no: waveMeta.wave_no,
|
||||
order_count: 0,
|
||||
orders: [],
|
||||
});
|
||||
}
|
||||
|
||||
for (const order of orderRows) {
|
||||
const waveId = Number(order && order.wave_id || 0);
|
||||
const groupedWave = groupedWaveMap.get(waveId);
|
||||
if (!groupedWave) {
|
||||
continue;
|
||||
}
|
||||
|
||||
groupedWave.orders.push({
|
||||
order_id: Number(order && order.id || 0),
|
||||
order_no: String(order && (order.delivery_order_code || order.source_order_codes) || '').trim(),
|
||||
wave_id: waveId,
|
||||
wave_no: String(order && order.wave_no || '').trim() || groupedWave.wave_no,
|
||||
receiver: {
|
||||
name: String(order && order.name || '').trim(),
|
||||
mobile: String(order && order.mobile || '').trim(),
|
||||
tel: String(order && order.tel || '').trim(),
|
||||
province: String(order && order.province || '').trim(),
|
||||
city: String(order && order.city || '').trim(),
|
||||
area: String(order && order.area || '').trim(),
|
||||
town: String(order && order.town || '').trim(),
|
||||
detail_address: String(order && order.detail_address || '').trim(),
|
||||
},
|
||||
channel: {
|
||||
sys_platform_code: String(order && order.sys_platform_code || '').trim(),
|
||||
sys_platform_name: String(order && order.sys_platform_name || '').trim(),
|
||||
logistics_name: String(order && order.logistics_name || '').trim(),
|
||||
},
|
||||
status: {
|
||||
order_status: String(order && order.status || '').trim(),
|
||||
outbound_status: String(order && order.outbound_status || '').trim(),
|
||||
print_status: String(order && order.print_status || '').trim(),
|
||||
},
|
||||
metrics: {
|
||||
items_count: Number(order && order.items_count || 0),
|
||||
items_total: Number(order && order.items_total || 0),
|
||||
items_weight: Number(order && order.items_weight || 0),
|
||||
},
|
||||
times: {
|
||||
create_at: order && order.create_at || null,
|
||||
pay_time: order && order.pay_time || null,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const waveList = Array.from(groupedWaveMap.values());
|
||||
waveList.sort((a, b) => String(a.wave_no || '').localeCompare(String(b.wave_no || '')));
|
||||
let totalOrders = 0;
|
||||
for (const wave of waveList) {
|
||||
wave.order_count = wave.orders.length;
|
||||
totalOrders += wave.order_count;
|
||||
}
|
||||
|
||||
return {
|
||||
summary: {
|
||||
total_waves: waveList.length,
|
||||
total_orders: totalOrders,
|
||||
},
|
||||
wave_list: waveList,
|
||||
ext: {
|
||||
missing_wave_ids: missingWaveIds,
|
||||
filtered_wave_ids: filteredWaveIds,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = OrderPrintSystemService;
|
||||
|
||||
@ -2418,8 +2418,7 @@ class PickSystemService extends Service {
|
||||
SELECT
|
||||
b.id,
|
||||
b.task_id,
|
||||
t.task_no,
|
||||
t.status AS task_status
|
||||
t.task_no
|
||||
FROM wms_pick_task_cart_binding b
|
||||
INNER JOIN wms_wave_pick_task t
|
||||
ON t.id = b.task_id
|
||||
@ -2442,7 +2441,6 @@ class PickSystemService extends Service {
|
||||
: null;
|
||||
if (cartActiveBinding) {
|
||||
const boundTaskId = Number(cartActiveBinding.task_id || 0);
|
||||
const boundTaskStatus = Number(cartActiveBinding.task_status || 0);
|
||||
if (boundTaskId === taskId) {
|
||||
throw this.createBusinessError('该任务已绑定此拣货车,无需重复绑定', 409, {
|
||||
task_id: taskId,
|
||||
@ -2450,14 +2448,13 @@ class PickSystemService extends Service {
|
||||
cart_code: targetCartCode,
|
||||
});
|
||||
}
|
||||
if ([ 0, 1 ].includes(boundTaskStatus)) {
|
||||
throw this.createBusinessError('该拣货车已绑定其他活动任务,请先解绑后再重新绑定', 409, {
|
||||
task_id: boundTaskId,
|
||||
task_no: String(cartActiveBinding.task_no || '').trim() || null,
|
||||
cart_id: targetCartId,
|
||||
cart_code: targetCartCode,
|
||||
});
|
||||
}
|
||||
// 车已有其他活跃绑定,无论旧任务状态如何均应阻止
|
||||
throw this.createBusinessError('该拣货车已绑定其他任务,请先解绑后再重新绑定', 409, {
|
||||
task_id: boundTaskId,
|
||||
task_no: String(cartActiveBinding.task_no || '').trim() || null,
|
||||
cart_id: targetCartId,
|
||||
cart_code: targetCartCode,
|
||||
});
|
||||
}
|
||||
|
||||
await ctx.model.query(`
|
||||
|
||||
@ -970,18 +970,6 @@
|
||||
],
|
||||
"type": "modified"
|
||||
},
|
||||
{
|
||||
"version": "2026.05.04-system-03",
|
||||
"date": "2026-05-04",
|
||||
"summary": "新增订单打印模块:按波次IDs获取打印数据并自动过滤未完全分配波次",
|
||||
"methods": [
|
||||
"order.print.getWavePrintData"
|
||||
],
|
||||
"notes": [
|
||||
"按波次IDs获取订单打印数据,内部去重并规范化 wave_ids,自动过滤快递未完全分配的波次;返回通过过滤的波次订单明细,按 wave_no 排序分组,并在 ext 中返回 missing_wave_ids 与 filtered_wave_ids。"
|
||||
],
|
||||
"type": "added"
|
||||
},
|
||||
{
|
||||
"version": "2026.05.04-system-02",
|
||||
"date": "2026-05-04",
|
||||
|
||||
@ -11055,251 +11055,6 @@
|
||||
"groupName": "打印模块",
|
||||
"module": "order.print",
|
||||
"list": [
|
||||
{
|
||||
"method": "order.print.getWavePrintData",
|
||||
"description": "按波次 IDs 获取订单打印数据,自动过滤快递未完全分配的波次,返回通过过滤的波次订单明细,按波次号分组",
|
||||
"isNeedAuth": false,
|
||||
"isNeedLogin": true,
|
||||
"headers": [
|
||||
{
|
||||
"name": "Authorization",
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "Bearer token"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"name": "warehouse_id",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"source": "body",
|
||||
"description": "仓库ID"
|
||||
},
|
||||
{
|
||||
"name": "wave_ids",
|
||||
"type": "array",
|
||||
"required": true,
|
||||
"source": "body",
|
||||
"description": "波次ID列表(支持数字或字符串,内部自动去重与归一化)"
|
||||
}
|
||||
],
|
||||
"response": [
|
||||
{
|
||||
"name": "summary",
|
||||
"type": "object",
|
||||
"description": "汇总信息",
|
||||
"children": [
|
||||
{
|
||||
"name": "total_waves",
|
||||
"type": "number",
|
||||
"description": "通过过滤的波次总数"
|
||||
},
|
||||
{
|
||||
"name": "total_orders",
|
||||
"type": "number",
|
||||
"description": "通过过滤的波次下订单总数"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "wave_list",
|
||||
"type": "array",
|
||||
"description": "波次列表(按 wave_no 排序)",
|
||||
"children": [
|
||||
{
|
||||
"name": "wave_id",
|
||||
"type": "number",
|
||||
"description": "波次ID"
|
||||
},
|
||||
{
|
||||
"name": "wave_no",
|
||||
"type": "string",
|
||||
"description": "波次号"
|
||||
},
|
||||
{
|
||||
"name": "order_count",
|
||||
"type": "number",
|
||||
"description": "该波次订单数"
|
||||
},
|
||||
{
|
||||
"name": "orders",
|
||||
"type": "array",
|
||||
"description": "订单明细列表(含 order_id、order_no、收件信息等字段)",
|
||||
"children": [
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "number",
|
||||
"description": "订单ID"
|
||||
},
|
||||
{
|
||||
"name": "order_no",
|
||||
"type": "string",
|
||||
"description": "订单号(delivery_order_code 或 source_order_codes)"
|
||||
},
|
||||
{
|
||||
"name": "receiver",
|
||||
"type": "object",
|
||||
"description": "收件信息",
|
||||
"children": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"description": "收件人姓名"
|
||||
},
|
||||
{
|
||||
"name": "mobile",
|
||||
"type": "string",
|
||||
"description": "手机号"
|
||||
},
|
||||
{
|
||||
"name": "tel",
|
||||
"type": "string",
|
||||
"description": "电话"
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "string",
|
||||
"description": "省"
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "string",
|
||||
"description": "市"
|
||||
},
|
||||
{
|
||||
"name": "area",
|
||||
"type": "string",
|
||||
"description": "区/县"
|
||||
},
|
||||
{
|
||||
"name": "town",
|
||||
"type": "string",
|
||||
"description": "镇/街道"
|
||||
},
|
||||
{
|
||||
"name": "detail_address",
|
||||
"type": "string",
|
||||
"description": "详细地址"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "channel",
|
||||
"type": "object",
|
||||
"description": "渠道信息",
|
||||
"children": [
|
||||
{
|
||||
"name": "sys_platform_code",
|
||||
"type": "string",
|
||||
"description": "平台编码"
|
||||
},
|
||||
{
|
||||
"name": "sys_platform_name",
|
||||
"type": "string",
|
||||
"description": "平台名称"
|
||||
},
|
||||
{
|
||||
"name": "logistics_name",
|
||||
"type": "string",
|
||||
"description": "快递名称"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "object",
|
||||
"description": "订单状态简要",
|
||||
"children": [
|
||||
{
|
||||
"name": "order_status",
|
||||
"type": "string",
|
||||
"description": "订单状态"
|
||||
},
|
||||
{
|
||||
"name": "outbound_status",
|
||||
"type": "string",
|
||||
"description": "出库状态"
|
||||
},
|
||||
{
|
||||
"name": "print_status",
|
||||
"type": "string",
|
||||
"description": "打印状态"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "metrics",
|
||||
"type": "object",
|
||||
"description": "数量度量",
|
||||
"children": [
|
||||
{
|
||||
"name": "items_count",
|
||||
"type": "number",
|
||||
"description": "商品种类数"
|
||||
},
|
||||
{
|
||||
"name": "items_total",
|
||||
"type": "number",
|
||||
"description": "商品总件数"
|
||||
},
|
||||
{
|
||||
"name": "items_weight",
|
||||
"type": "number",
|
||||
"description": "重量(单位 g)"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "times",
|
||||
"type": "object",
|
||||
"description": "时间字段",
|
||||
"children": [
|
||||
{
|
||||
"name": "create_at",
|
||||
"type": "string",
|
||||
"description": "创建时间"
|
||||
},
|
||||
{
|
||||
"name": "pay_time",
|
||||
"type": "string",
|
||||
"description": "支付时间"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ext",
|
||||
"type": "object",
|
||||
"description": "扩展字段",
|
||||
"children": [
|
||||
{
|
||||
"name": "missing_wave_ids",
|
||||
"type": "array",
|
||||
"description": "传入但不存在的 wave_id 列表"
|
||||
},
|
||||
{
|
||||
"name": "filtered_wave_ids",
|
||||
"type": "array",
|
||||
"description": "被过滤掉的波次(快递未完全分配),每项含 wave_id、wave_no、reason"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"errors": [
|
||||
{
|
||||
"code": "400",
|
||||
"description": "warehouse_id 或 wave_ids 缺失或格式错误"
|
||||
},
|
||||
{
|
||||
"code": "500",
|
||||
"description": "查询失败"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"method": "order.print.getWavePlatformPrintData",
|
||||
"description": "按波次 IDs 获取平台打印中间态数据,自动过滤快递未完全分配的波次,返回 waveGroups(波次 -> 平台 -> 订单)结构",
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
},
|
||||
"encryptedData": "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?v=11&pv=1",
|
||||
"signature": "MQktCwU3fF9H2C3PkcGm+eAtTIO/qOHVCUTfvbkxSVrM8VuyvYbq/Xkun4qItxUJuDsbl0oa1l8p1Wb2ZtMpQHgsOCMEQfeQrFZtzubYU1xayPv8+o4GYQ+GdPXueOJQ4hCyyrnGVjJSf/qV/LKWoUGsFrXN8jC1PapMdI93XEI=",
|
||||
"templateUrl": "https://file-link.pinduoduo.com/sto_one",
|
||||
|
||||
"userid": "",
|
||||
"ver": "11"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user