WMS_MAIN/app/model/wave_batch.js
liufumingren 68dbf65c77 feat: 波次复核开始时间回写与统计/防覆盖修复
- 波次策略列表 order.wave.waveStrategyList 成功响应新增 info.order_count(当前查询条件下全部策略命中订单去重总数,新增 getWaveStrategyMatchedOrderCountTotal,与行级统计同口径,统计失败安全降级为 0)

- 拣货任务 wms_wave_pick_task.finish_time 防覆盖:两处写入改为 CASE WHEN finish_time IS NULL,只记第一次

- 波次复核开始时间:新增迁移 20260908120000(wms_wave_batch 新增 recheck_start_time 字段,已在开发/生产执行)、模型字段同步、scanOrder 各成功分支首次回写(新增 markWaveRecheckStart,仅 IS NULL 时写入,回写失败不影响扫描主流程)

- 同步 methods/system.json 与 methods/changes/system.json 接口文档及变更记录(docMeta.version 更新至 0.3.101)

- 新增 recheckOrder-scanOrder-recheckStartTime HTTP 行为验证脚本与验证报告
2026-09-08 16:36:57 +08:00

202 lines
4.8 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: '拣货员',
},
claim_operator: {
type: STRING(50),
allowNull: true,
comment: '领料人',
},
claim_time: {
type: DATE,
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: '校验结果',
},
recheck_start_time: {
type: DATE,
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;
};