feat: 库内拦截确认同步推进订单 step=4 + outbound_status=fin

confirmIntercept + interceptScan 确认拦截后:
- step = 4(配送中)
- outbound_status = 'fin'(出库完成)
- intercept_status = intercepted_at_warehouse
This commit is contained in:
liufumingren 2026-08-12 23:35:38 +08:00
parent 7a74130219
commit c84d5ac4ae
2 changed files with 19 additions and 1 deletions

View File

@ -901,6 +901,16 @@ class InboxFunctionsService extends Service {
// 第四步:批量创建工单(初始状态 pending,后续根据通知结果升级)
const creatorLabel = [ groupName, userName ].filter(Boolean).join('-') || 'AI系统';
// 获取原消息内容,写入工单明细
let interceptMsgContent = '';
try {
const iid = ctx.inboxContext?.inbound_message_id;
if (iid) {
const imsg = await ctx.model.InboxMessage.findByPk(iid, { attributes: [ 'content' ], raw: true });
if (imsg && imsg.content) interceptMsgContent = String(imsg.content);
}
} catch (e) { /* ignore */ }
const createdNos = [];
const waybillToAsNo = {}; // waybill_id → after_sale_no 映射
for (const e of toCreate) {
@ -910,6 +920,7 @@ class InboxFunctionsService extends Service {
`运单号: ${e.waybill_code}`,
`快递公司: ${e.logistics_name || '未知'}`,
reason ? `拦截原因: ${reason}` : '',
interceptMsgContent ? `原消息: ${interceptMsgContent}` : '',
].filter(Boolean).join('\n');
await ctx.service.systems.afterSale.create({

View File

@ -3600,6 +3600,8 @@ class RecheckOrderService extends OrderBaseService {
const now = new Date();
const updateValues = {
intercept_status: 'intercepted_at_warehouse',
step: 4,
outbound_status: 'fin',
updated_at: now,
};
const updateResult = await orderModel.update(updateValues, {
@ -3800,7 +3802,12 @@ class RecheckOrderService extends OrderBaseService {
if (order) {
await orderModel.update(
{ intercept_status: 'intercepted_at_warehouse', updated_at: now },
{
intercept_status: 'intercepted_at_warehouse',
step: 4,
outbound_status: 'fin',
updated_at: now,
},
{ where: orderWhere }
);