- 新增出站回调 waybill.getreceive(注册到 callback_functions,管理端可勾选):
请求 { request: { waybill_codes: [...] } },响应裸数组/包装体均兼容,
1/0 与 Y/N 归一后回写 wms_order_express.is_galaxy_receive(按 warehouse_id 隔离)
- 回调签名新增 signMode=simple(MD5(appSecret+timestamp+bodyJson)),
waybill.getreceive 使用该口径,与仓库通知协议一致;其它事件默认口径不变
- 新增 waybill.warehouse.updateReceive / updateReceiveTaskProgress:
复用导出的异步任务ID与进度模式(前缀 waybill_receive_),单批 10 单自动切批;
支持 waybillCodes 或与 waybill.warehouse.list 一致的 where 条件圈选(上限 5000);
仓库未配置外部接口时直接失败,不创建任务
- 抽出 buildListQueryWhere / resolveWaybillCodesByWhere,列表与批量更新共用筛选口径
- order_express:is_back / is_intercept / is_galaxy_receive 补默认值 N
- 迁移:存量 NULL 回填为 N(Y 不动);三列分别建立单列索引(INPLACE + LOCK=NONE)
- 文档:methods/system.json(0.3.324)、变更记录、设计文档与出站回调说明同步
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
202 lines
4.5 KiB
JavaScript
202 lines
4.5 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 订单快递信息模型。
|
||
* @param {import('egg').Application} app Egg 应用实例。
|
||
* @return {import('sequelize').ModelCtor<import('sequelize').Model>} Sequelize 模型。
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, DATE, ENUM, INTEGER, TINYINT, TEXT } = app.Sequelize;
|
||
|
||
const OrderExpress = app.model.define('order_express', {
|
||
id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
allowNull: false,
|
||
comment: '主键ID',
|
||
},
|
||
waybill_code: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '运单号',
|
||
},
|
||
order_id: {
|
||
type: BIGINT(20),
|
||
allowNull: true,
|
||
comment: '订单ID',
|
||
},
|
||
create_at: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: '创建时间',
|
||
},
|
||
delete_at: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: '删除时间',
|
||
},
|
||
is_galaxy_receive: {
|
||
type: ENUM('Y', 'N'),
|
||
allowNull: true,
|
||
defaultValue: 'N',
|
||
comment: '是否揽收',
|
||
},
|
||
is_back: {
|
||
type: ENUM('Y', 'N'),
|
||
allowNull: true,
|
||
defaultValue: 'N',
|
||
comment: '是否退回',
|
||
},
|
||
is_intercept: {
|
||
type: ENUM('Y', 'N'),
|
||
allowNull: true,
|
||
defaultValue: 'N',
|
||
comment: '是否拦截',
|
||
},
|
||
logistics_code: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '物流编码',
|
||
},
|
||
logistics_interface_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: true,
|
||
comment: '物流接口ID',
|
||
},
|
||
logistics_name: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '物流名称',
|
||
},
|
||
logistics_interface_name: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '物流接口名称',
|
||
},
|
||
platform_code: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '平台编码',
|
||
},
|
||
business_key: {
|
||
type: INTEGER(3),
|
||
allowNull: true,
|
||
comment: '业务键',
|
||
},
|
||
status: {
|
||
type: TINYINT(1),
|
||
allowNull: true,
|
||
defaultValue: 0,
|
||
comment: '状态',
|
||
},
|
||
retry_count: {
|
||
type: TINYINT(3),
|
||
allowNull: true,
|
||
comment: '重试次数',
|
||
},
|
||
printinfo: {
|
||
type: TEXT('long'),
|
||
allowNull: true,
|
||
comment: '打印信息',
|
||
},
|
||
signature: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '签名信息',
|
||
},
|
||
encryptprintinfo: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '加密打印信息',
|
||
},
|
||
ver: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '打印版本号',
|
||
},
|
||
encryptedtoken: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '加密令牌',
|
||
},
|
||
print_history_id: {
|
||
type: STRING(64),
|
||
allowNull: true,
|
||
comment: 'OMS 打印记录ID(打印前换新 params 用)',
|
||
},
|
||
cai_niao_auth_info_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: true,
|
||
comment: '菜鸟授权网点ID(OMS 取号返回,打印按店铺分组用)',
|
||
},
|
||
warehouse_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: true,
|
||
comment: '仓库ID',
|
||
},
|
||
store_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: true,
|
||
comment: '货主ID',
|
||
},
|
||
delivery_order_code: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '发货单号',
|
||
},
|
||
source_order_codes: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '来源订单号集合',
|
||
},
|
||
package_material_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: true,
|
||
comment: '包材ID',
|
||
},
|
||
package_material_name_snapshot: {
|
||
type: STRING(128),
|
||
allowNull: true,
|
||
comment: '包材名称快照',
|
||
},
|
||
weighing_weight: {
|
||
type: INTEGER(11),
|
||
allowNull: true,
|
||
defaultValue: 0,
|
||
comment: '称重重量(g)',
|
||
},
|
||
}, {
|
||
tableName: 'wms_order_express',
|
||
freezeTableName: true,
|
||
underscored: true,
|
||
timestamps: false,
|
||
comment: '订单快递信息表',
|
||
indexes: [
|
||
{
|
||
name: 'uk_order_id_business_key',
|
||
unique: true,
|
||
fields: [ 'order_id', 'business_key' ],
|
||
},
|
||
{
|
||
name: 'idx_waybill_code',
|
||
fields: [ 'waybill_code' ],
|
||
},
|
||
{
|
||
name: 'idx_create_at',
|
||
fields: [ 'create_at' ],
|
||
},
|
||
{
|
||
name: 'idx_wms_order_express_package_material_id',
|
||
fields: [ 'package_material_id' ],
|
||
},
|
||
{
|
||
name: 'idx_warehouse_store',
|
||
fields: [ 'store_id', 'warehouse_id' ],
|
||
},
|
||
],
|
||
});
|
||
|
||
return OrderExpress;
|
||
};
|