- 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>
178 lines
4.3 KiB
JavaScript
178 lines
4.3 KiB
JavaScript
// app/model/picking_strategy.js
|
||
'use strict';
|
||
|
||
/**
|
||
* 波次策略模型定义。
|
||
* @param {import('egg').Application} app Egg 应用实例
|
||
* @return {import('sequelize').ModelCtor<import('sequelize').Model>} 波次策略模型
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, INTEGER, STRING, TINYINT, BOOLEAN, JSON, TEXT, DATE } = app.Sequelize;
|
||
|
||
const WaveStrategy = app.model.define('wms_wave_strategy', {
|
||
id: {
|
||
type: INTEGER,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
allowNull: false,
|
||
comment: '策略ID',
|
||
},
|
||
strategy_name: {
|
||
type: STRING(100),
|
||
allowNull: false,
|
||
comment: '策略名称',
|
||
},
|
||
warehouse_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: false,
|
||
comment: '仓库ID',
|
||
},
|
||
strategy_type: {
|
||
type: TINYINT,
|
||
allowNull: false,
|
||
comment: '策略类型:1-散单 2-团购 3-SN(序列号管理,固定先拣后分)',
|
||
},
|
||
status: {
|
||
type: TINYINT,
|
||
allowNull: true,
|
||
defaultValue: 1,
|
||
comment: '状态:1-启用 0-停用',
|
||
},
|
||
order_min_sku: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 1,
|
||
comment: '订单最小SKU种类数',
|
||
},
|
||
order_max_sku: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 999,
|
||
comment: '订单最大SKU种类数',
|
||
},
|
||
order_min_qty: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 1,
|
||
comment: '订单最小商品总数',
|
||
},
|
||
order_max_qty: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 999,
|
||
comment: '订单最大商品总数',
|
||
},
|
||
min_same_structure: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 1,
|
||
comment: '最小相同结构订单数',
|
||
},
|
||
max_same_structure: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 999,
|
||
comment: '最大相同结构订单数',
|
||
},
|
||
require_same_express: {
|
||
type: BOOLEAN,
|
||
allowNull: true,
|
||
defaultValue: false,
|
||
comment: '是否要求相同快递',
|
||
},
|
||
allow_cross_owner: {
|
||
type: BOOLEAN,
|
||
allowNull: true,
|
||
defaultValue: true,
|
||
comment: '是否允许跨货主',
|
||
},
|
||
batch_mode: {
|
||
type: TINYINT,
|
||
allowNull: false,
|
||
comment: '拣货模式:1-单品单件 2-先拣后分 3-边拣边分 4-边拣边分H型 5-播种墙 6-流利架',
|
||
},
|
||
batch_max_orders: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 20,
|
||
comment: '批次最大订单数',
|
||
},
|
||
batch_max_skus: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 50,
|
||
comment: '批次最大SKU总数',
|
||
},
|
||
group_batch_max_orders: {
|
||
type: INTEGER,
|
||
allowNull: true,
|
||
defaultValue: 1,
|
||
comment: '团购批次最大订单数(相同结构)',
|
||
},
|
||
wave_prefix: {
|
||
type: STRING(5),
|
||
allowNull: true,
|
||
comment: '波次前缀(为空时回退仓库前缀)',
|
||
},
|
||
allowed_owners: {
|
||
type: JSON,
|
||
allowNull: true,
|
||
comment: '允许的货主ID列表',
|
||
},
|
||
allowed_expresses: {
|
||
type: JSON,
|
||
allowNull: true,
|
||
comment: '允许的快递编码列表',
|
||
},
|
||
allowed_provinces: {
|
||
type: JSON,
|
||
allowNull: true,
|
||
comment: '允许的省份列表',
|
||
},
|
||
allowed_platforms: {
|
||
type: JSON,
|
||
allowNull: true,
|
||
comment: '允许的平台列表',
|
||
},
|
||
description: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '策略描述',
|
||
},
|
||
creator_name: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '创建人姓名',
|
||
},
|
||
create_time: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
|
||
comment: '创建时间',
|
||
},
|
||
update_time: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
|
||
comment: '更新时间',
|
||
},
|
||
}, {
|
||
tableName: 'wms_wave_strategy',
|
||
timestamps: false,
|
||
underscored: false,
|
||
comment: '波次策略配置表',
|
||
indexes: [
|
||
{
|
||
name: 'idx_warehouse_type',
|
||
fields: [ 'warehouse_id', 'strategy_type', 'status' ],
|
||
},
|
||
{
|
||
name: 'idx_batch_mode',
|
||
fields: [ 'batch_mode', 'strategy_type' ],
|
||
},
|
||
],
|
||
});
|
||
|
||
return WaveStrategy;
|
||
};
|