WMS_MAIN/app/model/wave_batch.js
liufumingren 763573ee41 feat(wms): 拦截订单门禁豁免、波次号原子取号、打印自定义区数量、拆包视频与商品复核字段
- pick: waveClaimScan 拦截订单整体跳过领料(不置 claim_status=fin,未打印不阻隔领料);query 领料前置校验仅统计非拦截未领料订单(拦截未领料不阻隔拣货);createWavePickTask 新增 excludeUnclaimed,普通波次(source=0)计算拣货数量(order_count/任务订单/筐)时剔除未领料订单
- wave: 波次号改为 wms_number_sequence 原子取号(upsert + LAST_INSERT_ID,seed 对齐当日历史最大序),wave_no 唯一索引 uniq_wave_no,并发撞号自动重取(最多 3 次)
- print: 面单自定义区首行「商品总数【n】」(items_total 优先),团购波次商品明细行尾「波次总单数×商品数量」
- returnUnpack: 列表新增 has_video/video_enable/videos 视频字段与筛选,补视频列表权限迁移
- stock: 商品新增 need_recheck(是否需要复核)字段,导入归一化与导出列支持,补迁移
- docs: 同步 methods/system.json 与 methods/changes/system.json 变更记录(恢复遗漏的已提交记录)
2026-08-23 14:31:49 +08:00

187 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: 'uniq_wave_no',
fields: [ 'wave_no' ],
unique: true,
},
{
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;
};