From 1e454d399c9829b966334bef2da68b2af7f0c0a5 Mon Sep 17 00:00:00 2001 From: liufumingren Date: Sat, 7 Nov 2026 05:40:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(waybill):=20=E5=BF=AB=E9=80=92=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=BC=BA=E5=A4=B1/=E6=9C=AA=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=E6=94=B9=E4=B8=BA=E3=80=8C=E5=8E=9F?= =?UTF-8?q?=E5=9B=A0=E5=9C=A8=E5=89=8D=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit WMS 会把失败原因写进订单操作日志并截断长文案,原来「未绑定到快递接口」在最前面、 真正原因(该平台暂无面单模板 / 没有该快递公司的模板)在末尾括号里,很容易被截掉, 运维看不出到底缺什么。改成: - 平台无任何模板:`平台1688(阿里巴巴)暂无面单模板(账号xxx):请到 OMS 店铺管理→ 外部打单平台→快递接口 点「从平台同步数据」,再为快递STO(申通快递)绑定` - 有模板但缺该快递公司:`平台TB(淘宝)没有快递JD(京东物流)的面单模板(账号xxx):…` - 有模板但该快递未绑定 / 重复绑定:同样把具体问题放在前面 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- backend/app/lib/waybillGet.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/app/lib/waybillGet.js b/backend/app/lib/waybillGet.js index ec0a8c2..7188bd8 100644 --- a/backend/app/lib/waybillGet.js +++ b/backend/app/lib/waybillGet.js @@ -283,7 +283,8 @@ async function buildTemplateMissingMessage(ctx, { account, platformCode, express const { name: expressName, exists: expressExists, disabled: expressDisabled } = await findExpressCode(ctx, expressCode, principalId); const expressLabel = labelWithName(expressCode, expressName); const accountText = account.account ? `账号${account.account}` : `账号#${account.id}`; - const head = `平台${platformLabel}快递${expressLabel}在${accountText}下未绑定到快递接口,请到 OMS 店铺管理→外部打单平台→快递接口 查看绑定对应的快递接口`; + // WMS 侧日志/页面会截断长文案,这里把「真正原因」放最前面,操作指引放后面 + const guide = 'OMS 店铺管理→外部打单平台→快递接口'; // 快递编码在系统字典与自定义字典里都没有:先让运营把编码建出来(否则绑定页也选不到它) if (!expressExists) { @@ -301,21 +302,26 @@ async function buildTemplateMissingMessage(ctx, { account, platformCode, express limit: 50, }); } catch (err) { - return head; + return `平台${platformLabel}快递${expressLabel}(${accountText})未绑定到快递接口:请到 ${guide} 绑定`; } - if (!rows.length) return `${head}(该平台暂无面单模板,请先点「从平台同步数据」)`; + // 该平台一条模板都没有:不是绑定漏了,而是店管家侧没有这个平台的电子面单模板 + if (!rows.length) { + return `平台${platformLabel}暂无面单模板(${accountText}):请到 ${guide} 点「从平台同步数据」,再为快递${expressLabel}绑定`; + } // 同一编码被多个模板绑定 → resolveByCode 视为未命中 const duplicated = rows.filter(row => String(row.custom_code || '').trim() === expressCode); if (duplicated.length > 1) { - return `平台${platformLabel}快递${expressLabel}在${accountText}下绑定了 ${duplicated.length} 个快递接口,请到 OMS 店铺管理→外部打单平台→快递接口 只保留一个后重试`; + return `平台${platformLabel}快递${expressLabel}(${accountText})绑定了 ${duplicated.length} 个快递接口:请到 ${guide} 只保留一个后重试`; } const codeKey = String(expressCode).trim().toUpperCase(); const hasSameCompany = rows.some(row => String(row.express_company_code || '').trim().toUpperCase() === codeKey); - if (!hasSameCompany) return `${head}(该平台暂无对应快递公司的模板,请先点「从平台同步数据」)`; - return head; + if (!hasSameCompany) { + return `平台${platformLabel}没有快递${expressLabel}的面单模板(${accountText}):请到 ${guide} 点「从平台同步数据」,再为该快递绑定`; + } + return `平台${platformLabel}快递${expressLabel}(${accountText})未绑定到快递接口:请到 ${guide} 选择对应模板绑定`; } /**