WMS_MAIN/app/model/wave_batch.js
liufumingren 90d5701a53 feat(wave): item_detail_machine 改 TEXT 并新增波次自动终结
- wms_wave_batch.item_detail_machine VARCHAR(1024) -> TEXT, 兼容多商品长结构标识
- 新增 wave_batch_closure 服务: 扫描活动波次(0/1)中订单已全部离开待处理表的波次并收敛 wave_status=5
- 新增 sync_finished_wave_batch 定时任务与执行日志缓存
2026-08-21 02:20:17 +08:00

186 lines
4.5 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/wave_batch.js
'use strict';
module.exports = app => {
const { BIGINT, INTEGER, STRING, TEXT, DATE, TINYINT, BOOLEAN } = app.Sequelize;
const WaveBatch = app.model.define('wms_wave_batch', {
wave_id: {
type: BIGINT,
primaryKey: true,
autoIncrement: true,
allowNull: false,
comment: '波次ID',
},
wave_no: {
type: STRING(50),
allowNull: false,
comment: '波次编号,如WAVE202401001',
},
wave_type: {
type: TINYINT,
allowNull: false,
defaultValue: 1,
comment: '波次类型:1-团购 2-散单',
},
wave_status: {
type: TINYINT,
allowNull: false,
defaultValue: 0,
comment: '波次状态:-1-已取消 0-自动加团中 1-已就绪 2-已打印 3-拣货中 4-拣货完成 5-复核完成 6-打包完成',
},
total_orders: {
type: INTEGER,
allowNull: true,
defaultValue: 0,
comment: '总订单数',
},
processed_orders: {
type: INTEGER,
allowNull: true,
defaultValue: 0,
comment: '已处理订单数',
},
picking_operator: {
type: STRING(50),
allowNull: true,
comment: '拣货员',
},
picking_start_time: {
type: DATE,
allowNull: true,
comment: '拣货开始时间',
},
picking_end_time: {
type: DATE,
allowNull: true,
comment: '拣货结束时间',
},
print_operator: {
type: STRING(50),
allowNull: true,
comment: '打印员',
},
print_time: {
type: DATE,
allowNull: true,
comment: '打印时间',
},
print_count: {
type: INTEGER,
allowNull: true,
defaultValue: 0,
comment: '打印次数',
},
check_operator: {
type: STRING(50),
allowNull: true,
comment: '校验员',
},
check_time: {
type: DATE,
allowNull: true,
comment: '校验时间',
},
check_result: {
type: TINYINT,
allowNull: true,
comment: '校验结果',
},
priority: {
type: TINYINT,
allowNull: true,
defaultValue: 5,
comment: '优先级 1-5',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '仓库ID',
},
creator: {
type: STRING(50),
allowNull: false,
comment: '创建人',
},
create_time: {
type: DATE,
allowNull: true,
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间',
},
update_time: {
type: DATE,
allowNull: true,
comment: '更新时间',
},
item_detail_machine: {
type: TEXT,
allowNull: true,
comment: '抓取结构token:v1|item_part_type|item_part|distinguish_express|logistics_name|item_snapshot_key(TEXT 以容纳多商品订单的长结构标识)',
},
item_part_type: {
type: STRING(32),
allowNull: true,
comment: '结构来源类型:items_hash/items',
},
item_part: {
type: STRING(255),
allowNull: true,
comment: '结构主键(items_hash或items摘要)',
},
distinguish_express: {
type: BOOLEAN,
allowNull: false,
defaultValue: 0,
comment: '是否区分快递 0否1是',
},
logistics_name: {
type: STRING(128),
allowNull: true,
comment: '快递名称(区分快递时参与匹配)',
},
item_snapshot_key: {
type: STRING(1024),
allowNull: true,
comment: '结构快照键(多商品订单的快照键,最长 1024)',
},
}, {
tableName: 'wms_wave_batch',
timestamps: false,
underscored: false,
indexes: [
{
name: 'idx_wave_status',
fields: [ 'wave_status', 'create_time' ],
},
{
name: 'idx_wave_no',
fields: [ 'wave_no' ],
},
{
name: 'idx_warehouse',
fields: [ 'warehouse_id', 'wave_status' ],
},
{
name: 'idx_creator',
fields: [ 'creator', 'create_time' ],
},
{
name: 'idx_wave_fast_group',
fields: [ 'warehouse_id', 'wave_type', 'wave_status', 'item_part_type', 'item_part', 'distinguish_express', 'logistics_name' ],
},
{
name: 'idx_wave_snapshot_key',
fields: [{ name: 'item_snapshot_key', length: 191 }],
},
{
name: 'idx_wave_item_machine_prefix',
fields: [{ name: 'item_detail_machine', length: 191 }],
},
],
});
return WaveBatch;
};