WMS_MAIN/database/migrations/20260825170000-add-receiver-info-to-wms-order-stockout.js
liufumingren b07d7bca33 feat(stockout): 出库单转订单全链路(receiverInfo 落库、出库单默认快递、updateInfo、TRANSFERRED)
- toOrder:create_channel=STOCKOUT、库存锁转移、收货必填校验、同快递/兜底平台、转单后置 TRANSFERRED(禁止一键出库)

- stockout.create:解析 receiverInfo 13 字段落库,快递兜底改用出库单默认快递(stockout_default_express_code,默认 ZT 自提)

- 新增 storage.stockout.updateInfo:收货/地址/快递/平台修改,仅 CREATED/PENDING,收货缺失禁止提交

- 迁移:wms_order_stockout 新增 receiver_* 13 列、order_status 增 TRANSFERRED、source_platform 两列

- 附带:storeWarehouse.createUser、奇门取消订单配送表幂等、express_platform Uint64 打包、方法与变更文档同步
2026-08-25 23:40:42 +08:00

67 lines
2.8 KiB
JavaScript
Raw Permalink 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 TABLE = 'wms_order_stockout';
/**
* 为出库单主表添加收件人信息字段(对应奇门 stockout.create 报文 receiverInfo 节点)。
*
* 字段与奇门 receiverInfo 一一对应,列名统一加 receiver_ 前缀避免与订单表口径混淆。
*/
module.exports = {
up: async (queryInterface, Sequelize) => {
const columns = await queryInterface.describeTable(TABLE);
const receiverColumns = [
{ name: 'receiver_company', type: Sequelize.STRING(200), comment: '收件人公司名称(receiverInfo.company)' },
{ name: 'receiver_name', type: Sequelize.STRING(50), comment: '收件人姓名(receiverInfo.name)' },
{ name: 'receiver_zip_code', type: Sequelize.STRING(50), comment: '收件人邮编(receiverInfo.zipCode)' },
{ name: 'receiver_tel', type: Sequelize.STRING(50), comment: '收件人固定电话(receiverInfo.tel)' },
{ name: 'receiver_mobile', type: Sequelize.STRING(50), comment: '收件人移动电话(receiverInfo.mobile)' },
{ name: 'receiver_email', type: Sequelize.STRING(50), comment: '收件人电子邮箱(receiverInfo.email)' },
{ name: 'receiver_country_code', type: Sequelize.STRING(50), comment: '收件人国家二字码(receiverInfo.countryCode)' },
{ name: 'receiver_province', type: Sequelize.STRING(50), comment: '收件人省份(receiverInfo.province)' },
{ name: 'receiver_city', type: Sequelize.STRING(50), comment: '收件人城市(receiverInfo.city)' },
{ name: 'receiver_area', type: Sequelize.STRING(50), comment: '收件人区域(receiverInfo.area)' },
{ name: 'receiver_town', type: Sequelize.STRING(50), comment: '收件人村镇(receiverInfo.town)' },
{ name: 'receiver_detail_address', type: Sequelize.STRING(200), comment: '收件人详细地址(receiverInfo.detailAddress)' },
{ name: 'receiver_id', type: Sequelize.STRING(50), comment: '收件人证件号(receiverInfo.id)' },
];
for (const item of receiverColumns) {
if (!columns[item.name]) {
await queryInterface.addColumn(TABLE, item.name, {
type: item.type,
allowNull: true,
comment: item.comment,
});
}
}
},
down: async queryInterface => {
const columns = await queryInterface.describeTable(TABLE);
const receiverColumnNames = [
'receiver_company',
'receiver_name',
'receiver_zip_code',
'receiver_tel',
'receiver_mobile',
'receiver_email',
'receiver_country_code',
'receiver_province',
'receiver_city',
'receiver_area',
'receiver_town',
'receiver_detail_address',
'receiver_id',
];
for (const name of receiverColumnNames) {
if (columns[name]) {
await queryInterface.removeColumn(TABLE, name);
}
}
},
};