// app/model/wave_batch.js 'use strict'; module.exports = app => { const { BIGINT, INTEGER, STRING, 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: STRING(1024), allowNull: true, comment: '抓取结构token:v1|item_part_type|item_part|distinguish_express|logistics_name|item_snapshot_key', }, 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: '结构快照键(与 item_detail_machine 一致,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; };