WMS_MAIN/database/migrations/20261002160000-add-is-empty-to-stock-check-record.js
liufumingren 9743416187 feat: 盘点作业数据接口改造与账面口径全量统一(可用+锁定)
- workData 三视图:goods 视图 locations=商品所在全部库位列表(明盘每库位 system_quantity 账面/quantity 盘点、盲盘只显示库位);space 视图同口径;新增 workDataSpaceDetails 分页版
- workDataDetail 增加 goods 分支(单行结构,复用视图构建器);detail 补 profit_total/loss_total 差异汇总
- 库位账面全量统一为 SUM(available_quantity+locked_quantity)(可用+锁定)并标记 locked_quantity:result/report/finish/detail/addDetail 拆行快照与作业视图一致
- 未盘行不误显盘亏:diff/is_diff 仅存在作业记录时计算
- 文档 methods/system.json 0.3.249 + changes 变更记录,开发/生产库已回填
2026-10-06 03:24:41 +08:00

26 lines
1.1 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_stock_check_record 新增 is_empty(TINYINT(1) NOT NULL DEFAULT 0):
* - is_empty=1 的记录表示「确认该库位为空」:stock_id=NULL、barcode=NULL、item_name=NULL、quantity=0;
* - 与商品记录互斥(应用层保证):标记空时删除该明细下商品记录;上报商品时删除该明细下空记录;
* - 空记录按(detail_id + is_empty=1 + location_code)应用层查重覆盖更新(唯一索引不约束 NULL 行)。
*/
const TABLE_NAME = 'wms_stock_check_record';
module.exports = {
up: async queryInterface => {
await queryInterface.sequelize.query(`
ALTER TABLE \`${TABLE_NAME}\`
ADD COLUMN \`is_empty\` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否空库位标记(1=确认为空,stock_id/barcode/item_name 均为空、quantity=0)' AFTER \`item_name\`
`);
},
down: async queryInterface => {
await queryInterface.removeColumn(TABLE_NAME, 'is_empty');
},
};