oms/backend/app/model/orderStatusQueued.js
liufumingren 6c03a20364 feat(backend): 订单状态分表、WMS 推送与归档
- 新增 order_index 索引表 + 6 张同构状态表(待审核/异常/委外中/配送/已作废/已取消)与历史表,
  订单 ID 全局唯一,状态由业务事务推动:审核、驳回、取消、作废、恢复、归档
- 明细表 order_status_items、收件人文本智能解析、批量切换仓库/店铺并刷新快照
- WMS deliveryorder.create 推送(单条/批量)、推送失败定时重试、订单归档定时任务
- 迁移:建表、旧发货单数据迁入新表、菜单合并与迁移记录清理
- routes / swagger contract 补充订单状态接口

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-30 23:06:18 +08:00

24 lines
921 B
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.

'use strict';
const { businessFields } = require('../lib/orderFields');
const { ORDER_STATUS, ORDER_TABLE_BY_STATUS } = require('../lib/orderStatus');
/**
* 待推送订单表(order_status_queued)
*
* 审核通过(已校验明细/店铺并锁定库存)后进入本表,等待定时任务或手动「推送仓库」:
* - 推送成功 → 转入 order_status_outsourcing(委外中,等仓库回传发货确认)
* - 推送失败 → 转入 order_status_exception(异常,释放锁定库存,可转回待审核)
* @param {Egg.Application} app egg application
* @return {object} orderStatusQueued model
*/
module.exports = app => {
const tableName = ORDER_TABLE_BY_STATUS[ORDER_STATUS.QUEUED];
const OrderStatusQueued = app.model.define(tableName, businessFields(app.Sequelize, ORDER_STATUS.QUEUED), {
tableName,
comment: '订单-待推送',
});
return OrderStatusQueued;
};