- 入库单、出库单控制器与模型(状态流转、审核、驳回换号、作废、删除约束) - 明细共用 stock_items:应/已数量、行级库存类型 ZP/CC、明细锁定 - lib/wms:单据类型常量(orderTypes)、奇门/openapi 客户端(qimenClient)、签名(sign) - 库存联动:utils/stock.js、utils/completeInbound.js(入库完成加库存,幂等) - 驳回换号:utils/rejectBillNo.js;旧 orders 模块同步调整 - 相关迁移:入库单 WMS 字段/审核/推送结果、明细计划与实际数量、单据类型落 WMS 编码、出库库存扣减标记等
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 入库单 WMS 推送结果留痕:
|
||
* - pushed_at:推送到外部仓库的时间
|
||
* - wms_push_result:外部仓返回结果(外部单号 / 返回码 / 消息 / 原始报文)JSON
|
||
* 幂等:仅当列不存在时才新增,适配已存在相关列的库。
|
||
*/
|
||
module.exports = {
|
||
async up(queryInterface, Sequelize) {
|
||
const { DATE, JSON } = Sequelize;
|
||
const cols = await queryInterface.describeTable('inbound_orders');
|
||
|
||
if (!cols.pushed_at) {
|
||
await queryInterface.addColumn('inbound_orders', 'pushed_at', {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: 'WMS 推送时间',
|
||
});
|
||
}
|
||
if (!cols.wms_push_result) {
|
||
await queryInterface.addColumn('inbound_orders', 'wms_push_result', {
|
||
type: JSON,
|
||
allowNull: true,
|
||
comment: 'WMS 推送结果(外部单号/返回码/消息/原始报文)',
|
||
});
|
||
}
|
||
},
|
||
|
||
async down(queryInterface) {
|
||
const cols = await queryInterface.describeTable('inbound_orders');
|
||
if (cols.wms_push_result) await queryInterface.removeColumn('inbound_orders', 'wms_push_result');
|
||
if (cols.pushed_at) await queryInterface.removeColumn('inbound_orders', 'pushed_at');
|
||
},
|
||
};
|