WMS_MAIN/app/model/order_item_sn.js
liufumingren 9af7dcf8fb feat(storeWarehouse): 签约关系接口配置按货主开放接口落库且回调地址统一取配置
- storeWarehouse.store.saveApiConfig:新增 resolveContractApiInterfaceType,
  interface_type_id=3(OPEN_API_WAREHOUSE 仓库开放接口)自动映射为 2(OPEN_API 货主开放接口)落库,
  不再要求当前主体为仓库(货主可维护自身签约关系下的接口配置)
- callback_url 不再取入参(含 callbackUrl 别名),统一写入 config.openapi.defaultCallbackUrl(新增配置项,默认空)
- storeWarehouse.store.listApiConfig:interface_type_id 过滤同步映射(传 3 按 2 查询)
- 文档:methods/system.json 升级 0.3.350、methods/changes/system.json 变更记录、docs/openapi-callback-events.md 回调地址来源说明
- 测试:saveApiConfig 新增 4 条用例(3→2 落库、忽略入参回调地址、默认值未配置、货主主体可保存、缺失类型 404),listApiConfig 新增 1 条过滤映射用例

同时提交工作区其余在制品改动:
- waybill:移除 wms_order_express_trace 模型并新增 drop 迁移,轨迹查询/取号/打印链路调整
- order:订单 SN 编码(order_item_sn / order_item_sn_log / sn_code_rule、has_sn_item 回填迁移),pendingOrder/recheckOrder/wave/base 调整
- express_platform、order_async、order_export、order_storage_allocation、storage.report、stock_store 配套修复
- lib:新增 jd_client,调整 qimen_client、callback_functions 及配套测试

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-14 17:14:04 +08:00

121 lines
3.0 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.

// app/model/order_item_sn.js
'use strict';
module.exports = app => {
const { BIGINT, STRING, INTEGER, DATE } = app.Sequelize;
const OrderItemSn = app.model.define('wms_order_item_sn', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '主键ID',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '仓库ID',
},
store_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
comment: '货主ID(复核落库时从订单冗余,便于按货主隔离查询)',
},
order_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '订单ID,逻辑关联分仓订单主表,不做物理外键',
},
order_item_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '订单明细ID,逻辑关联分仓订单明细表,不做物理外键',
},
sn_code: {
type: STRING(512),
allowNull: false,
comment: 'SN编码(支持链接/二维码内容,最长512字符)',
},
sn_status: {
type: STRING(32),
allowNull: false,
defaultValue: 'BOUND',
comment: 'SN状态:BOUND/VERIFIED/RETURNED/REISSUED/INVALID',
},
verify_status: {
type: STRING(32),
allowNull: false,
defaultValue: 'UNVERIFIED',
comment: '核验状态:UNVERIFIED/PASS/FAIL',
},
bound_at: {
type: DATE,
allowNull: true,
comment: '绑定时间',
},
verified_at: {
type: DATE,
allowNull: true,
comment: '核验时间',
},
returned_at: {
type: DATE,
allowNull: true,
comment: '退回时间',
},
reissued_at: {
type: DATE,
allowNull: true,
comment: '重发时间',
},
version: {
type: INTEGER.UNSIGNED,
allowNull: false,
defaultValue: 1,
comment: '版本号',
},
created_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
updated_at: {
type: DATE,
allowNull: false,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
comment: '更新时间',
},
}, {
tableName: 'wms_order_item_sn',
timestamps: false,
comment: '订单明细SN当前关系与状态表',
indexes: [
{
name: 'uk_wms_order_item_sn_warehouse_sn_code',
unique: true,
fields: [ 'warehouse_id', 'sn_code' ],
},
{
name: 'idx_wms_order_item_sn_order_id',
fields: [ 'order_id' ],
},
{
name: 'idx_wms_order_item_sn_order_item_id',
fields: [ 'order_item_id' ],
},
{
name: 'idx_wms_order_item_sn_sn_code',
fields: [ 'sn_code' ],
},
{
name: 'idx_wms_order_item_sn_store_id',
fields: [ 'store_id' ],
},
],
});
return OrderItemSn;
};