168 lines
3.9 KiB
JavaScript
168 lines
3.9 KiB
JavaScript
// app/model/picking_strategy.js
|
||
'use strict';
|
||
|
||
module.exports = app => {
|
||
const { BIGINT, INTEGER, STRING, TINYINT, BOOLEAN, JSON, TEXT, DATE } = app.Sequelize;
|
||
|
||
const PickingStrategy = app.model.define('wms_picking_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-团购',
|
||
},
|
||
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: '团购批次最大订单数(相同结构)',
|
||
},
|
||
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_picking_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 PickingStrategy;
|
||
};
|