WMS_MAIN/app/model/after_sale_reply.js
liufumingren 806e739267 feat(inbox): v2 规则引擎完善(help 指令/建单开关/系统回复)并修复拦截日志误写仓库 ID
- functions.js: 拦截/取消拦截波次感知写订单日志 businessId 误用仓库 ID,改为订单 ID
  (生产订单 JY2026091813795 已发起拦截但订单详情查不到拦截日志的根因)
- rules/v2/processor/config/functionSync: 新增 help 指令、create_work_order=0 时跳过
  工单登记、系统级回复与无单号提示、白名单范围修正
- after_sale_reply 模型 + 6 个迁移: create_work_order 字段与相关配置种子
- return_unpack: 列表 count 统计修复、分页排序追加主键防重漏行、视频附加 camera_name
- methods/system.json + changes + sync 脚本: 接口文档与权限同步
2026-09-18 22:38:57 +08:00

88 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
module.exports = app => {
const { STRING, BIGINT, TINYINT, TEXT, DATE } = app.Sequelize;
const AfterSaleReply = app.model.define('afterSaleReply', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
defaultValue: null,
comment: '仓库ID(NULL=系统级默认回复;非NULL=仓库级自定义回复,覆盖系统级)',
},
sub_type_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '售后子类型ID(关联 wms_after_sale_sub_type.id)',
},
reply: {
type: TEXT,
allowNull: false,
comment: '自定义回复文案(支持换行,可含占位符)',
},
is_reply: {
type: TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '是否回复:1=命中后回复,0=静默不回复',
},
create_work_order: {
type: TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '是否登记工单:1=执行函数处理(可能建工单,默认),0=仅回复不执行函数',
},
no_number_hint: {
type: STRING(500),
allowNull: true,
defaultValue: null,
comment: '未取到单据号时的引导语(如:请提供运单号;为空则用默认引导语)',
},
is_enabled: {
type: TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '是否启用:1=启用,0=停用(停用视为未设置,回退系统级)',
},
created_at: {
type: DATE,
comment: '创建时间',
},
updated_at: {
type: DATE,
comment: '更新时间',
},
}, {
tableName: 'wms_after_sale_reply',
underscored: true,
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
paranoid: false,
comment: '售后自定义回复表(仓库级覆盖系统级)',
indexes: [
{
unique: true,
fields: [ 'warehouse_id', 'sub_type_id' ],
name: 'uk_warehouse_sub_type',
},
{
fields: [ 'sub_type_id' ],
name: 'idx_sub_type_id',
},
{
fields: [ 'is_enabled' ],
name: 'idx_is_enabled',
},
],
});
return AfterSaleReply;
};