oms/backend/database/migrations/20260913010000-inbound-order-wms-extra.js
liufumingren ec81f8b3cd feat(backend): 入库单/出库单全流程与 WMS 对接
- 入库单、出库单控制器与模型(状态流转、审核、驳回换号、作废、删除约束)
- 明细共用 stock_items:应/已数量、行级库存类型 ZP/CC、明细锁定
- lib/wms:单据类型常量(orderTypes)、奇门/openapi 客户端(qimenClient)、签名(sign)
- 库存联动:utils/stock.js、utils/completeInbound.js(入库完成加库存,幂等)
- 驳回换号:utils/rejectBillNo.js;旧 orders 模块同步调整
- 相关迁移:入库单 WMS 字段/审核/推送结果、明细计划与实际数量、单据类型落 WMS 编码、出库库存扣减标记等
2026-09-13 02:23:44 +08:00

40 lines
1.7 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.

'use strict';
/**
* 入库单补充 WMS entryorder.create 的结构化扩展字段:
* - related_orders:关联单据(relatedOrders),数组 [{ orderType, orderCode }]
* - sender_info:发件人信息(senderInfo 对象)
* - receiver_info:收件人信息(receiverInfo 对象)
* - extend_props:扩展属性(extendProps 对象 { key: value })
* 这些字段结构较复杂,用 JSON 列承载,推送时按 WMS 规范组装进报文。
*/
module.exports = {
async up(queryInterface, Sequelize) {
const { JSON } = Sequelize;
await queryInterface.addColumn('inbound_orders', 'related_orders', {
type: JSON, allowNull: true,
comment: '关联单据(WMS relatedOrders):[{ orderType: CG/DB/CK/RK, orderCode }]',
});
await queryInterface.addColumn('inbound_orders', 'sender_info', {
type: JSON, allowNull: true,
comment: '发件人信息(WMS senderInfo):{ company,name,zipCode,tel,mobile,email,countryCode,province,city,area,town,detailAddress }',
});
await queryInterface.addColumn('inbound_orders', 'receiver_info', {
type: JSON, allowNull: true,
comment: '收件人信息(WMS receiverInfo):{ company,name,zipCode,tel,mobile,email,countryCode,province,city,area,town,detailAddress }',
});
await queryInterface.addColumn('inbound_orders', 'extend_props', {
type: JSON, allowNull: true,
comment: '扩展属性(WMS extendProps):{ key: value }',
});
},
async down(queryInterface) {
const cols = await queryInterface.describeTable('inbound_orders');
for (const c of [ 'related_orders', 'sender_info', 'receiver_info', 'extend_props' ]) {
if (cols[c]) await queryInterface.removeColumn('inbound_orders', c);
}
},
};