feat(expressInterface): 快递接口新增物品描述 goods_description 并用于菜鸟面单
- wms_express_interface 新增 goods_description VARCHAR(255) NULL(迁移 20261118200000) - create/update 支持 goods_description(兼容 goodsDescription),最长 255 字符、允许为空 - list / listByWarehousePlatformCode 返回该字段 - 菜鸟电子面单 package_info.goods_description 改为读取接口配置,未配置时回退「化妆品」 - 同步 methods/system.json 与变更记录 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
b7feed7e76
commit
2c615cb4f8
@ -148,6 +148,11 @@ module.exports = app => {
|
||||
allowNull: true,
|
||||
comment: '产品编码',
|
||||
},
|
||||
goods_description: {
|
||||
type: STRING(255),
|
||||
allowNull: true,
|
||||
comment: '物品描述',
|
||||
},
|
||||
weight_type: {
|
||||
type: INTEGER(10),
|
||||
allowNull: true,
|
||||
|
||||
@ -278,6 +278,8 @@ class expressInterfaceService extends MainService {
|
||||
templateUrl: camelTemplateUrl,
|
||||
ext_data: extData,
|
||||
extData: camelExtData,
|
||||
goods_description: goodsDescription,
|
||||
goodsDescription: camelGoodsDescription,
|
||||
template_id: templateId,
|
||||
templateId: camelTemplateId,
|
||||
paymode,
|
||||
@ -328,6 +330,9 @@ class expressInterfaceService extends MainService {
|
||||
if (extData !== undefined || camelExtData !== undefined) {
|
||||
payload.ext_data = extData !== undefined ? extData : camelExtData;
|
||||
}
|
||||
if (goodsDescription !== undefined || camelGoodsDescription !== undefined) {
|
||||
payload.goods_description = goodsDescription !== undefined ? goodsDescription : camelGoodsDescription;
|
||||
}
|
||||
if (templateId !== undefined || camelTemplateId !== undefined) {
|
||||
payload.template_id = templateId !== undefined ? templateId : camelTemplateId;
|
||||
}
|
||||
|
||||
@ -2008,7 +2008,7 @@ class ExpressPlatformService extends MainService {
|
||||
name: item.item_name || '商品',
|
||||
count: item.plan_qty,
|
||||
})) || [],
|
||||
goods_description: '化妆品',
|
||||
goods_description: String(listByWarehousePlatformCode.goods_description || '').trim() || '化妆品',
|
||||
id: `${orderDelivery.warehouse_id}_${orderDelivery.id}_${order_tmp.business_key}`,
|
||||
length: Number(orderDelivery.length || 1),
|
||||
width: Number(orderDelivery.width || 1),
|
||||
|
||||
@ -762,6 +762,7 @@ class SettingExpressInterfaceService extends Service {
|
||||
town_name: this.normalizeOptionalText(row.town_name, 'town_name', 255),
|
||||
site_code: this.normalizeOptionalText(row.site_code, 'site_code', 255),
|
||||
product_type: this.normalizeOptionalText(row.product_type, 'product_type', 50),
|
||||
goods_description: this.normalizeOptionalText(row.goods_description, 'goods_description', 255),
|
||||
shop_name: this.normalizeOptionalText(
|
||||
(row.shop && row.shop.shop_name) || row.shop_name,
|
||||
'shop_name',
|
||||
@ -1087,7 +1088,7 @@ class SettingExpressInterfaceService extends Service {
|
||||
'sys_express_code',
|
||||
'sender_name', 'sender_tel', 'weight', 'viewer', 'client_id', 'is_share',
|
||||
'province_name', 'city_name', 'district_name', 'site_code',
|
||||
'product_type', 'weight_type', 'shop_name', 'address', 'town_name', 'ispickup', 'shipperno', 'template_url', 'ext_data', 'is_enabled',
|
||||
'product_type', 'goods_description', 'weight_type', 'shop_name', 'address', 'town_name', 'ispickup', 'shipperno', 'template_url', 'ext_data', 'is_enabled',
|
||||
],
|
||||
order: [[ 'weight', 'ASC' ], [ 'id', 'DESC' ]],
|
||||
offset,
|
||||
@ -1278,6 +1279,11 @@ class SettingExpressInterfaceService extends Service {
|
||||
town_name: this.normalizeOptionalText(data.town_name || data.townName, 'town_name', 255),
|
||||
site_code: this.normalizeOptionalText(data.site_code || data.siteCode, 'site_code', 255),
|
||||
product_type: this.normalizeOptionalText(data.product_type || data.productType, 'product_type', 50),
|
||||
goods_description: this.normalizeOptionalText(
|
||||
data.goods_description !== undefined ? data.goods_description : data.goodsDescription,
|
||||
'goods_description',
|
||||
255
|
||||
),
|
||||
shop_name: this.normalizeOptionalText(data.shop_name || data.shopName, 'shop_name', 255),
|
||||
};
|
||||
|
||||
@ -1361,6 +1367,8 @@ class SettingExpressInterfaceService extends Service {
|
||||
|| Object.prototype.hasOwnProperty.call(data, 'siteCode');
|
||||
const hasProductType = Object.prototype.hasOwnProperty.call(data, 'product_type')
|
||||
|| Object.prototype.hasOwnProperty.call(data, 'productType');
|
||||
const hasGoodsDescription = Object.prototype.hasOwnProperty.call(data, 'goods_description')
|
||||
|| Object.prototype.hasOwnProperty.call(data, 'goodsDescription');
|
||||
const hasShopName = Object.prototype.hasOwnProperty.call(data, 'shop_name')
|
||||
|| Object.prototype.hasOwnProperty.call(data, 'shopName');
|
||||
const hasExtData = Object.prototype.hasOwnProperty.call(data, 'ext_data')
|
||||
@ -1374,7 +1382,7 @@ class SettingExpressInterfaceService extends Service {
|
||||
&& !hasProviderType && !hasProviderId && !hasViewer && !hasClientId && !hasIsPickup
|
||||
&& !hasShipperNo && !hasTemplateUrl && !hasProvinceName && !hasCityName
|
||||
&& !hasDistrictName && !hasAddress && !hasTownName && !hasSiteCode
|
||||
&& !hasProductType && !hasShopName && !hasExtData && !hasIsEnabled) {
|
||||
&& !hasProductType && !hasGoodsDescription && !hasShopName && !hasExtData && !hasIsEnabled) {
|
||||
throw this.createError('至少需要提供一个可更新字段', 400);
|
||||
}
|
||||
|
||||
@ -1559,6 +1567,14 @@ class SettingExpressInterfaceService extends Service {
|
||||
updates.product_type = this.normalizeOptionalText(data.product_type || data.productType, 'product_type', 50);
|
||||
}
|
||||
|
||||
if (hasGoodsDescription) {
|
||||
updates.goods_description = this.normalizeOptionalText(
|
||||
data.goods_description !== undefined ? data.goods_description : data.goodsDescription,
|
||||
'goods_description',
|
||||
255
|
||||
);
|
||||
}
|
||||
|
||||
if (hasShopName) {
|
||||
updates.shop_name = this.normalizeOptionalText(data.shop_name || data.shopName, 'shop_name', 255);
|
||||
}
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* wms_express_interface 增加 goods_description 列(物品描述)。
|
||||
*
|
||||
* 背景:菜鸟等电子面单接口的 package_info.goods_description 需要按快递接口配置下发,
|
||||
* 原先在代码内硬编码为「化妆品」。现改为读取接口配置,未配置时仍回退到「化妆品」。
|
||||
*
|
||||
* 幂等:列存在性判断后再执行,重复运行安全。
|
||||
*/
|
||||
|
||||
const TABLE_NAME = 'wms_express_interface';
|
||||
const COLUMN_NAME = 'goods_description';
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* 执行迁移:新增 goods_description 列。
|
||||
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
|
||||
* @param {Object} Sequelize Sequelize 类型集合。
|
||||
* @return {Promise<void>} 无返回值。
|
||||
*/
|
||||
async up(queryInterface, Sequelize) {
|
||||
const { STRING } = Sequelize;
|
||||
const log = [];
|
||||
|
||||
const columns = await queryInterface.describeTable(TABLE_NAME);
|
||||
if (!columns || Object.keys(columns).length === 0) {
|
||||
throw new Error(`表 ${TABLE_NAME} 不存在,无法新增 ${COLUMN_NAME}`);
|
||||
}
|
||||
|
||||
if (!Object.prototype.hasOwnProperty.call(columns, COLUMN_NAME)) {
|
||||
await queryInterface.addColumn(TABLE_NAME, COLUMN_NAME, {
|
||||
type: STRING(255),
|
||||
allowNull: true,
|
||||
comment: '物品描述',
|
||||
});
|
||||
log.push({ action: 'add-column', columnName: COLUMN_NAME });
|
||||
} else {
|
||||
log.push({ action: 'skip-add-column', columnName: COLUMN_NAME, reason: 'exists' });
|
||||
}
|
||||
|
||||
console.log('[20261118200000-add-goods-description-to-express-interface] up results:', JSON.stringify(log));
|
||||
},
|
||||
|
||||
/**
|
||||
* 回滚迁移:移除 goods_description 列。
|
||||
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
|
||||
* @return {Promise<void>} 无返回值。
|
||||
*/
|
||||
async down(queryInterface) {
|
||||
const log = [];
|
||||
|
||||
const columns = await queryInterface.describeTable(TABLE_NAME);
|
||||
if (Object.prototype.hasOwnProperty.call(columns, COLUMN_NAME)) {
|
||||
await queryInterface.removeColumn(TABLE_NAME, COLUMN_NAME);
|
||||
log.push({ action: 'drop-column', columnName: COLUMN_NAME });
|
||||
}
|
||||
|
||||
console.log('[20261118200000-add-goods-description-to-express-interface] down results:', JSON.stringify(log));
|
||||
},
|
||||
};
|
||||
@ -1,4 +1,203 @@
|
||||
[
|
||||
{
|
||||
"version": "0.3.373-express-interface-goods-description",
|
||||
"date": "2026-11-18",
|
||||
"type": "updated",
|
||||
"summary": "???????? goods_description????????????? package_info.goods_description ????????????????????",
|
||||
"methods": [
|
||||
"setting.expressInterface.create",
|
||||
"setting.expressInterface.update",
|
||||
"setting.expressInterface.list",
|
||||
"setting.expressInterface.listByWarehousePlatformCode"
|
||||
],
|
||||
"notes": [
|
||||
"????wms_express_interface ?? goods_description VARCHAR(255) NULL COMMENT '????'??? 20261118200000-add-goods-description-to-express-interface.js??????",
|
||||
"???setting.expressInterface.create / update ?? goods_description??? goodsDescription???????? 255 ??????????????? 400?????????????",
|
||||
"???setting.expressInterface.list / update / listByWarehousePlatformCode ?? goods_description ???",
|
||||
"?????app/service/systems/express_platform.js ???? package_info.goods_description ?????????????????????????????"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.372-b2b-order-images",
|
||||
"date": "2026-11-18",
|
||||
"type": "added",
|
||||
"summary": "新增 order.updateB2bOrderImages:B2B 订单图片更新(wms_file_reference business_type=b2b_order),B2B 列表挂载 images",
|
||||
"methods": [
|
||||
"order.updateB2bOrderImages",
|
||||
"order.pendingOrder2b.list",
|
||||
"order.deliveryOrder2b.list"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:单订单全量覆盖更新 B2B 订单图片,入参 images 支持 { file_id, display_order } 或直接 file_id(兼容 file_ids/fileIds),传空数组清空;单订单最多 20 张,重复 file_id 去重,display_order 缺省按顺序补 0 起序号。",
|
||||
"落库口径:wms_file_reference.business_type=b2b_order、business_id=订单ID字符串、warehouse_id=当前仓库、display_order 控制顺序、created_by=操作人姓名;文件本体复用 wms_file,不做物理删除。business_type 常量集中登记在 app/lib/file_business_types.js(stock / stock_check_record / receivingItem / b2b_order)。",
|
||||
"校验:仅 B2B 订单(is_b2b=Y)且未取消;订单 current 优先、dispatch 兜底;文件必须属于当前仓库且未删除(B2B_IMAGE_FILE_INVALID);错误码前缀 B2B_IMAGE_ 由方法层统一转 failure 400。",
|
||||
"事务:关联 diff(删除/新增/更新顺序)在同一事务内完成,失败整体回滚。",
|
||||
"列表联动:order.pendingOrder2b.list / order.deliveryOrder2b.list 每行新增 images: [{ id, url, display_order }],按页一次性批量查询(FileReference include File),查询失败降级为空数组、不影响列表主流程。",
|
||||
"操作日志:ORDER_B2B_IMAGES(「更新B2B订单图片」,已在 app/dict/businessDict.js 登记),extras 带 image_count / added_file_ids / removed_file_ids。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.371-b2b-prep-drop-claim-guard",
|
||||
"date": "2026-11-18",
|
||||
"type": "updated",
|
||||
"summary": "order.startB2bPrep 新增作业前置条件:未打印、未分配储位、已拦截的订单不允许开始备货(领料不参与校验)",
|
||||
"methods": [
|
||||
"order.startB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"前置条件:intercept_status=none(未拦截)→ print_status=fin(已打印)→ storage_status=fin(已分配储位),任一不满足即 failure 400(错误码 B2B_PREP_NOT_READY)且不写入 wms_order_b2b、不写操作日志;data 回带 order_id / print_status / storage_status / intercept_status。",
|
||||
"领料(claim_status)不作为前置条件:领料仅由 pick.waveClaimScan 整波领单写入(要求订单 wave_id>0 且波次 source=0),B2B 订单已被强制排除在波次抓取之外、没有波次,claim_status 恒为 none,若把已领料列为前置条件会让所有 B2B 订单永久无法开始备货。",
|
||||
"已分配储位与已打印对 B2B 均可达:储位分配走 orderStorageAllocation.allocatePicking(订单级,不依赖波次、未排除 is_b2b),打印/手工运单号录入同样按订单维度、不依赖波次。",
|
||||
"幂等口径不变:同工号重复开始仍幂等成功,但同样先执行前置条件校验(备货中订单若被取消分配储位或改为拦截,重复开始会失败)。",
|
||||
"实现:app/service/systems/order/order_b2b.js 中 assertPrepStartReady 新增(实际路径 app/service/systems/order_b2b.js),loadPrepTargets 增加查询 print_status/storage_status/intercept_status,由 startOrdersB2bPrep 在「已完成/其他工号」校验之后、幂等分支之前调用;cancelB2bPrep / finishB2bPrep / pickupB2b 不受影响。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.369-b2b-op-guard",
|
||||
"date": "2026-11-18",
|
||||
"type": "updated",
|
||||
"summary": "反审回待审核、抓取散单、批量发货、克隆订单对 B2B 订单不再生效:命中 B2B 订单整批驳回并返回不生效提示",
|
||||
"methods": [
|
||||
"order.pendingOrder.reverseReviewOrder",
|
||||
"order.pendingOrder.cloneOrder",
|
||||
"order.wave.singleFetchByIds",
|
||||
"order.recheckOrder.batchQuickRecheck",
|
||||
"order.recheckOrder.batchQuickRecheckByWave"
|
||||
],
|
||||
"notes": [
|
||||
"口径:B2B 订单(wms_order_delivery.is_b2b=Y,NULL 存量行视为非 B2B)走备货/提货独立作业链路,不参与反审回待审核、抓取散单(按订单抓散单)、批量发货(快捷复核,含按波次)、克隆订单。",
|
||||
"驳回方式:入参/波次内命中任意 B2B 订单即整批驳回(与既有「锁单/拦截」部分跳过口径不同,不做部分处理),错误文案「B2B 订单不支持{操作}(订单[ID...]),操作不生效」,最多展示前 10 个订单 ID。",
|
||||
"order.pendingOrder.reverseReviewOrder:在运单号校验前先做 B2B 校验,命中时不改动 inspection_status/step/wave 关联。",
|
||||
"order.pendingOrder.cloneOrder:在可取消状态校验前做 B2B 校验,命中时不取消原单、不释放库存、不创建新单。",
|
||||
"order.wave.singleFetchByIds:原先的「排除 B2B 订单并返回 excluded_b2b_order_ids」改为整批驳回,响应移除 excluded_b2b_order_ids 字段(波次内不写入任何 B2B 订单)。",
|
||||
"order.recheckOrder.batchQuickRecheck / batchQuickRecheckByWave:批次内命中 B2B 订单直接抛错,不产生 success/failed 明细(SN 订单的原先部分失败口径不变)。",
|
||||
"实现:app/service/systemMethods/order/base.js#assertOrdersNotB2b 统一校验(isB2bOrderRow 判定 is_b2b=Y),由 pendingOrder.js#reverseReviewOrder / #cloneOrder、wave.js#singleFetchByIds、recheckOrder.js#batchQuickRecheck / #batchQuickRecheckByWave 调用。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.368",
|
||||
"date": "2026-11-17",
|
||||
"type": "updated",
|
||||
"summary": "order.finishB2bPrep 备货完成同步扣减库存,口径与拣货完成一致",
|
||||
"methods": [
|
||||
"order.finishB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"变更:备货完成(order.finishB2bPrep)在同一事务内同步执行库存出库,处理逻辑与拣货完成(systems/pick.js#wavePickTaskComplete、systemMethods/order/recheckOrder.js#_completePickForOrder)保持一致。",
|
||||
"扣减明细:按 wms_picking(order_id + warehouse_id + status=pending + deleted_at IS NULL,FOR UPDATE)汇总各 storage_id 数量 → 校验 wms_storage.locked_quantity 足够 → 同时扣减 locked_quantity 与 quantity → 写入 wms_storage_transaction(transaction_type=OUTBOUND、order_type=PICK_OUTBOUND、order_id=订单ID、remark=备货完成出库(B2B))→ wms_picking 置 fin。",
|
||||
"失败语义:任一 storage 锁定数量不足时整单失败(failure 400,data 带 storage_id/locked_quantity/deduction_quantity),备货完成不落库、库存不变。",
|
||||
"无 pending 拣货记录的订单(未走拣货流程或已扣减过)不做库存变更,备货仍正常完成,响应 stock_deducted_* 为空/0。",
|
||||
"响应新增 stock_deducted_storage_ids、stock_deducted_quantity 两个字段。",
|
||||
"实现位置:app/service/systems/order_b2b.js#completeB2bPrepStockOutbound(新抽取的库存扣减方法),由 #finishOrdersB2bPrep 在事务内调用。",
|
||||
"未改动订单主表 pick_status:备货完成只影响副表与库存,避免干扰拣货/复核状态机。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.367",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.pickupB2b:B2B 订单提货并记录提货时间(单订单)",
|
||||
"methods": [
|
||||
"order.pickupB2b"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:传入单个订单ID,把 wms_order_b2b.is_picked_up 置 Y、picked_up_at 置提交时刻,记录提货时间。",
|
||||
"校验:仅 B2B 订单(is_b2b=Y)、非已取消;要求备货已完成(prep_status=fin),否则 failure 400「订单未备货完成,不允许提货」;已提货幂等(already_picked_up=true,保留首次提货时间、不重复写日志)。",
|
||||
"单订单口径:只接受 1 个订单ID,同备货三接口一致(方法层 app/service/systemMethods/order/index.js#runB2bSingleOrderAction 与业务层 normalizeB2bOrderIds 双层拦截)。",
|
||||
"实现位置:app/service/systems/order_b2b.js#pickupOrdersB2b,出口 app/service/systemMethods/order/index.js#pickupB2b;操作码 ORDER_B2B_PICKUP 已在 app/dict/businessDict.js 登记为「B2B提货」。",
|
||||
"列表联动:order.pendingOrder2b.list / order.deliveryOrder2b.list 已输出 is_picked_up、picked_up_at 并支持 where.is_picked_up 筛选,提货后立即反映。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.366",
|
||||
"date": "2026-11-17",
|
||||
"type": "updated",
|
||||
"summary": "B2B 备货三接口改为单订单作业,禁止批量提交",
|
||||
"methods": [
|
||||
"order.startB2bPrep",
|
||||
"order.cancelB2bPrep",
|
||||
"order.finishB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"变更:order.startB2bPrep / order.cancelB2bPrep / order.finishB2bPrep 由批量口径收紧为单订单作业,method 层(runB2bSingleOrderAction)与业务层(normalizeB2bOrderIds)双层拦截,传多个订单ID直接 failure 400「备货作业仅支持单个订单,请单条提交」,data.order_ids 返回传入的多个订单ID。",
|
||||
"入参别名:ids / order_ids / orderIds / id / order_id / orderId 均支持单值或单元素数组,取值优先级同上。",
|
||||
"原因:备货为逐个订单的实际作业,批量提交会出现部分成功难以追溯;批量场景由前端按订单循环调用。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.365",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.cancelB2bUrgent:批量取消 B2B 订单加急(仅 B2B 订单生效)",
|
||||
"methods": [
|
||||
"order.cancelB2bUrgent"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:等价于 order.setB2bUrgent 传 is_urgent=N,内部强制把 is_urgent 覆盖为 N(调用方传 Y 也不会变成设置加急)。",
|
||||
"跳过口径:非 B2B 与已取消订单跳过并在 skipped_reasons 返回原因,单次上限 200 单;current 未命中时兜底 dispatch 分表。",
|
||||
"落库位置:wms_order_b2b.is_urgent 置 N,作业明细行缺失时补建;操作日志写 ORDER_B2B_SET_URGENT(说明「取消B2B订单加急」)。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.364",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.setB2bUrgent:批量设置 B2B 订单是否加急(仅 B2B 订单生效)",
|
||||
"methods": [
|
||||
"order.setB2bUrgent"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:批量设置/取消 B2B 订单加急标记,写入 wms_order_b2b.is_urgent(不修改订单主表 is_urgency),关联条件 warehouse_id + order_id,作业明细行缺失时补建。",
|
||||
"取值兼容:is_urgent 支持 Y/N、true/false、1/0、是/否,缺省 Y;非法取值直接报错。",
|
||||
"跳过口径:非 B2B(is_b2b != Y)与已取消(status=cancel)订单跳过并在 skipped_reasons 返回原因,单次上限 200 单;current 未命中时兜底查询 dispatch 分表,两表都查不到计入 not_found_order_ids。",
|
||||
"操作日志:每次设置写一条 ORDER_B2B_SET_URGENT(操作名称「设置B2B加急」)。列表联动:order.pendingOrder2b.list / order.deliveryOrder2b.list 的加急优先排序与 where.is_urgent 筛选立即生效。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.363",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.finishB2bPrep:B2B 订单备货完成,写入备注/总箱数/完成时间与用时",
|
||||
"methods": [
|
||||
"order.finishB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:必传 prep_remark(备货备注)与 total_box_count(总箱数),写入 prep_remark、total_box_count、prep_at(提交时刻)与 prep_duration_seconds(提交时刻 - prep_start_at 秒数,缺失时按 0),prep_status 置 fin。",
|
||||
"校验:仅 B2B 订单;prep_status 非 padding 返回「订单未处于备货中,不允许提交备货完成」;备货人工号与当前工号不一致返回「订单备货人为其他工号(xxx)」;备注为空或总箱数非正整数返回入参错误。",
|
||||
"操作日志:每个订单写一条 ORDER_B2B_PREP_FINISH(操作名称「备货完成」)。",
|
||||
"实现位置:app/service/systems/order_b2b.js#finishOrdersB2bPrep,出口 app/service/systemMethods/order/index.js#finishB2bPrep。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.362",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.cancelB2bPrep:取消 B2B 订单备货并重置备货人与时间",
|
||||
"methods": [
|
||||
"order.cancelB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:把 wms_order_b2b.prep_status 重置为 none,清空 prep_operator_id / prep_operator_name / prep_start_at / prep_at,prep_duration_seconds 置 0;不清空 prep_remark 与 total_box_count。",
|
||||
"校验:仅 B2B 订单;prep_status 非 padding 返回「订单未处于备货中,不允许取消备货」;备货人工号与当前工号不一致返回「订单备货人为其他工号(xxx)」。",
|
||||
"操作日志:每个订单写一条 ORDER_B2B_PREP_CANCEL(操作名称「取消备货」)。",
|
||||
"实现位置:app/service/systems/order_b2b.js#cancelOrdersB2bPrep,出口 app/service/systemMethods/order/index.js#cancelB2bPrep。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.361",
|
||||
"date": "2026-11-17",
|
||||
"type": "added",
|
||||
"summary": "新增 order.startB2bPrep:B2B 订单备货开始并记录备货人工号与开始时间",
|
||||
"methods": [
|
||||
"order.startB2bPrep"
|
||||
],
|
||||
"notes": [
|
||||
"新接口:传入订单ID,把 wms_order_b2b.prep_status 置为 padding,写入 prep_operator_id(当前登录工号)、prep_operator_name 与 prep_start_at(服务端当前时间);作业明细行缺失时按默认值补建。",
|
||||
"校验:仅 B2B 订单(is_b2b=Y,current 分表优先、dispatch 分表兜底),订单不存在或非 B2B 整单失败;prep_status=fin 返回「订单已备货完成,不允许重新开始备货」;已由其他工号开始返回「订单备货人为其他工号(xxx)」,同工号重复开始幂等成功(保留首次 prep_start_at)。",
|
||||
"操作日志:每个订单写一条 ORDER_B2B_PREP_START(操作名称「备货开始」),事务提交后写入,失败仅告警。",
|
||||
"实现位置:app/service/systems/order_b2b.js#startOrdersB2bPrep,出口 app/service/systemMethods/order/index.js#startB2bPrep。"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.3.360",
|
||||
"date": "2026-11-15",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -355,6 +355,26 @@ describe('test/app/service/systems/express_platform.cainiao.test.js', () => {
|
||||
assert.equal(bizBody.trade_order_info_dtos[0].template_url, DEFAULT_CAINIAO_TEMPLATE_URL);
|
||||
});
|
||||
|
||||
it('should use configured goods_description and fall back to default when empty', async () => {
|
||||
const { service, calls } = createCainiaoHarness();
|
||||
|
||||
const payload = buildPayload();
|
||||
payload.listByWarehousePlatformCode.goods_description = ' 化妆品套装 ';
|
||||
await service.cainiao(payload);
|
||||
|
||||
let requestBody = calls.curlOptions.options.data;
|
||||
let bizBody = JSON.parse(requestBody.param_waybill_cloud_print_apply_new_request);
|
||||
assert.equal(bizBody.trade_order_info_dtos[0].package_info.goods_description, '化妆品套装');
|
||||
|
||||
const fallbackPayload = buildPayload();
|
||||
fallbackPayload.listByWarehousePlatformCode.goods_description = '';
|
||||
await service.cainiao(fallbackPayload);
|
||||
|
||||
requestBody = calls.curlOptions.options.data;
|
||||
bizBody = JSON.parse(requestBody.param_waybill_cloud_print_apply_new_request);
|
||||
assert.equal(bizBody.trade_order_info_dtos[0].package_info.goods_description, '化妆品');
|
||||
});
|
||||
|
||||
it('should throw when taobao returns error_response', async () => {
|
||||
const { service } = createCainiaoHarness({
|
||||
responseData: {
|
||||
|
||||
@ -167,6 +167,7 @@ function createHarness(options = {}) {
|
||||
district_name: {},
|
||||
site_code: {},
|
||||
product_type: {},
|
||||
goods_description: {},
|
||||
weight_type: {},
|
||||
shop_name: {},
|
||||
address: {},
|
||||
@ -608,6 +609,7 @@ describe('test/app/service/systems/setting/expressInterface.test.js', () => {
|
||||
template_id: 1202,
|
||||
brandno: 'BRAND-SF',
|
||||
providertype: 'CAINIAO',
|
||||
goods_description: '化妆品',
|
||||
name: '顺丰接口',
|
||||
express_code: 'SF',
|
||||
platform_code: 'TB',
|
||||
@ -664,6 +666,8 @@ describe('test/app/service/systems/setting/expressInterface.test.js', () => {
|
||||
assert.equal(result.data[0].template_id, 1202);
|
||||
assert.equal(result.data[0].brandno, 'BRAND-SF');
|
||||
assert.equal(result.data[0].providertype, 'CAINIAO');
|
||||
assert.equal(result.data[0].goods_description, '化妆品');
|
||||
assert.equal(Object.prototype.hasOwnProperty.call(result.data[1], 'goods_description'), false);
|
||||
assert.equal(result.data[1].express_code, 'ZTO');
|
||||
assert.equal(result.data[1].brandno, 'BRAND-ZTO');
|
||||
assert.equal(result.data[2].express_code, 'YTO');
|
||||
@ -1021,6 +1025,47 @@ describe('test/app/service/systems/setting/expressInterface.test.js', () => {
|
||||
assert.equal(calls.cacheDeletes.includes('express_interface:warehouse:100000:platform:PDD'), true);
|
||||
});
|
||||
|
||||
it('should save trimmed goods_description on create', async () => {
|
||||
const { ctx, calls } = createHarness();
|
||||
const service = new SettingExpressInterfaceService(ctx);
|
||||
|
||||
const result = await service.create({
|
||||
name: '物品描述接口',
|
||||
express_code: 'SF',
|
||||
platform_code: 'TB',
|
||||
goodsDescription: ' 化妆品套装 ',
|
||||
});
|
||||
|
||||
assert.equal(calls.createPayload.goods_description, '化妆品套装');
|
||||
assert.equal(result.data.goods_description, '化妆品套装');
|
||||
});
|
||||
|
||||
it('should allow empty goods_description and reject value longer than 255', async () => {
|
||||
const { ctx, calls } = createHarness();
|
||||
const service = new SettingExpressInterfaceService(ctx);
|
||||
|
||||
const result = await service.update({
|
||||
id: 11,
|
||||
goods_description: '',
|
||||
});
|
||||
|
||||
assert.equal(calls.updatePayload.updates.goods_description, '');
|
||||
assert.equal(result.data.goods_description, '');
|
||||
|
||||
let error = null;
|
||||
try {
|
||||
await service.update({
|
||||
id: 11,
|
||||
goods_description: 'a'.repeat(256),
|
||||
});
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
assert.equal(error && error.code, 400);
|
||||
assert.equal(error && error.message, 'goods_description 长度不能超过 255');
|
||||
});
|
||||
|
||||
it('should sync token from shop access_token when updating shop_id', async () => {
|
||||
const { ctx, calls } = createHarness();
|
||||
const service = new SettingExpressInterfaceService(ctx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user