商品标记「不用发货」统一改称「虚拟商品」

products.no_need_ship 的业务含义统一表述为「虚拟商品」,仅改文案与注释,
字段名与行为不变:

- 商品列表列头改为「虚拟商品」,标签显示「虚拟」;编辑面板开关标签同步
- 契约、模型、迁移注释、前端类型注释统一措辞
- 订单库存(orderStock)与 WMS 推送(orderWms)的注释与错误提示改为
  「虚拟商品」,提示语保持原有可操作建议
- 单测用例描述同步更新

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-24 01:29:27 +08:00
parent 2b2ea066ea
commit 4c2ff95507
8 changed files with 20 additions and 20 deletions

View File

@ -496,7 +496,7 @@ module.exports = {
is_shelf_life_mgmt: { type: 'string', description: '是否保质期管理:Y/N' },
is_batch_mgmt: { type: 'string', description: '是否批次管理:Y/N' },
is_order_unique_gift: { type: 'integer', description: '是否订单唯一赠品:1 是(整单只落一行、数量 1)0 否,默认 0' },
no_need_ship: { type: 'integer', description: '?????1 ????/??????? WMS?0 ???? 0' },
no_need_ship: { type: 'integer', description: '虚拟商品:1 是(不锁/不扣库存、不推 WMS)0 否,默认 0' },
barcode: { type: 'string', description: '条码' },
brand_name: { type: 'string', description: '品牌名称' },
image: { type: 'string', description: '图片URL(主图,取 images 首张)' },
@ -556,7 +556,7 @@ module.exports = {
is_shelf_life_mgmt: { type: 'string', description: '是否保质期管理:Y/N,默认N' },
is_batch_mgmt: { type: 'string', description: '是否批次管理:Y/N,默认N' },
is_order_unique_gift: { type: 'integer', description: '是否订单唯一赠品:1 是(整单只落一行、数量 1)0 否,默认 0' },
no_need_ship: { type: 'integer', description: '?????1 ????/??????? WMS?0 ???? 0' },
no_need_ship: { type: 'integer', description: '虚拟商品:1 是(不锁/不扣库存、不推 WMS)0 否,默认 0' },
tag_price: { type: 'number', description: '标价' },
retail_price: { type: 'number', required: true, description: '零售价' },
cost_price: { type: 'number', description: '成本价' },
@ -589,7 +589,7 @@ module.exports = {
is_shelf_life_mgmt: { type: 'string', description: '是否保质期管理:Y/N' },
is_batch_mgmt: { type: 'string', description: '是否批次管理:Y/N' },
is_order_unique_gift: { type: 'integer', description: '是否订单唯一赠品:1 是(整单只落一行、数量 1)0 否,默认 0' },
no_need_ship: { type: 'integer', description: '?????1 ????/??????? WMS?0 ???? 0' },
no_need_ship: { type: 'integer', description: '虚拟商品:1 是(不锁/不扣库存、不推 WMS)0 否,默认 0' },
tag_price: { type: 'number', description: '标价' },
retail_price: { type: 'number', description: '零售价' },
cost_price: { type: 'number', description: '成本价' },

View File

@ -41,7 +41,7 @@ module.exports = app => {
type: TINYINT,
allowNull: false,
defaultValue: 0,
comment: '不用发货:1 是(不锁/不扣库存、不推 WMS) 0 否',
comment: '虚拟商品:1 是(不锁/不扣库存、不推 WMS) 0 否',
},
barcode: { type: STRING(100), comment: '条码' },
image: { type: STRING(255), comment: '图片(主图,取 images 首张)' },

View File

@ -99,7 +99,7 @@ class OrderWmsService extends Service {
}
/**
* 过滤掉「不用发货」商品(虚拟商品)的明细行
* 过滤掉虚拟商品的明细行
*
* 这类商品(products.no_need_ship=1)不进入 WMS 报文,也不在仓库侧产生作业。
* @param {Object} order 订单(需含 principal_id)
@ -369,10 +369,10 @@ class OrderWmsService extends Service {
const client = new QimenWmsClient(api, this.app);
const allItems = itemRows.map(item => item.get({ plain: true }));
// 「不用发货」商品(虚拟商品)不推 WMS;若整单都是这类商品,没有可推的明细
// 虚拟商品不推 WMS;若整单都是这类商品,没有可推的明细
const items = await this.filterShippableItems(order, allItems);
if (!items.length) {
const message = '订单明细全部为「不用发货」商品,无需推送仓库:请取消该单,或改为手工发货';
const message = '订单明细全部为虚拟商品,无需推送仓库:请取消该单,或改为手工发货';
await order.update({
wms_push_result: { ...base, success: false, failureKind: 'virtual_items', message },
});

View File

@ -55,7 +55,7 @@ async function loadOrderLines(ctx, order, transaction) {
const or = [];
if (codes.length) or.push({ item_code: { [Op.in]: codes } });
if (ids.length) or.push({ id: { [Op.in]: ids } });
// 同时按编码与已回填的商品ID查,才能拿到「不用发货」标记(虚拟商品不参与锁/扣库存)
// 同时按编码与已回填的商品ID查,才能拿到「虚拟商品」标记(虚拟商品不参与锁/扣库存)
const products = or.length
? await ctx.model.Product.findAll({
where: { principal_id: order.principal_id, [Op.or]: or },
@ -107,7 +107,7 @@ async function execute(ctx, order, action, options = {}) {
const transaction = options.transaction || await ctx.model.transaction();
try {
const lines = await loadOrderLines(ctx, order, transaction);
// 「不用发货」商品是虚拟商品:不锁、不扣库存(明细仍保留在订单里,只是不参与库存动作)
// 虚拟商品:不锁、不扣库存(明细仍保留在订单里,只是不参与库存动作)
const shippable = lines.filter(l => !l.no_need_ship);
const hit = shippable.filter(l => l.product_id && l.plan_qty > 0);
// 仅把「未匹配到系统商品」的明细计入 skippedLines(数量为空/0 的明细直接忽略,属数据异常)
@ -116,7 +116,7 @@ async function execute(ctx, order, action, options = {}) {
const virtualOnly = shippable.length === 0 && lines.length > 0;
if (virtualOnly) {
if (action === 'lock') {
throw new Error('订单明细全部为「不用发货」商品,无需锁定库存:请取消该单,或改为手工发货');
throw new Error('订单明细全部为虚拟商品,无需锁定库存:请取消该单,或改为手工发货');
}
// 释放/扣减时没有可操作明细:只清锁定标记,避免卡住状态流转
await ctx.model[orderModelName(order.status)].update(

View File

@ -1,7 +1,7 @@
'use strict';
/**
* 商品增加「不用发货」标记。
* 商品增加「虚拟商品」标记。
*
* 1 表示该商品是虚拟商品(虚拟发货、服务、赠品等):订单命中后
* - 审核时不再锁定库存、发货确认也不扣减库存;
@ -13,7 +13,7 @@ module.exports = {
type: Sequelize.TINYINT,
allowNull: false,
defaultValue: 0,
comment: '不用发货:1 是(不锁/不扣库存、不推 WMS) 0 否',
comment: '虚拟商品:1 是(不锁/不扣库存、不推 WMS) 0 否',
});
},

View File

@ -86,7 +86,7 @@ describe('test/app/service/orderWms.test.js', () => {
});
});
describe('test/app/service/orderWms 不用发货商品过滤', () => {
describe('test/app/service/orderWms 虚拟商品过滤', () => {
function createFilterService(products) {
const service = Object.create(OrderWmsService.prototype);
service.app = {
@ -106,7 +106,7 @@ describe('test/app/service/orderWms 不用发货商品过滤', () => {
return service;
}
it('按商品ID或商品编码命中「不用发货」时排除该明细', async () => {
it('按商品ID或商品编码命中虚拟商品时排除该明细', async () => {
const service = createFilterService([
{ id: 11, item_code: 'VIRTUAL-1', no_need_ship: 1 },
{ id: 12, item_code: 'REAL-1', no_need_ship: 0 },
@ -119,7 +119,7 @@ describe('test/app/service/orderWms 不用发货商品过滤', () => {
assert.deepStrictEqual(result.map(item => item.id), [ 2 ]);
});
it('没有「不用发货」商品时原样返回', async () => {
it('没有虚拟商品时原样返回', async () => {
const service = createFilterService([{ id: 12, item_code: 'REAL-1', no_need_ship: 0 }]);
const items = [{ id: 1, product_id: 12, item_code: 'REAL-1' }];
const result = await service.filterShippableItems({ principal_id: 5 }, items);

View File

@ -39,7 +39,7 @@ export interface ProductItem {
is_batch_mgmt: string
/** 是否订单唯一赠品:1 是(整单只落一行、数量 1)0 否 */
is_order_unique_gift: number
/** 不用发货:1 是(不锁/不扣库存、不推 WMS)0 否 */
/** 虚拟商品:1 是(不锁/不扣库存、不推 WMS)0 否 */
no_need_ship: number
tag_price: number | string | null
retail_price: number | string
@ -102,7 +102,7 @@ export interface ProductPayload {
is_batch_mgmt?: string
/** 是否订单唯一赠品:1 是(整单只落一行、数量 1)0 否 */
is_order_unique_gift?: number
/** 不用发货:1 是(不锁/不扣库存、不推 WMS)0 否 */
/** 虚拟商品:1 是(不锁/不扣库存、不推 WMS)0 否 */
no_need_ship?: number
tag_price?: number | null
retail_price: number

View File

@ -630,9 +630,9 @@ onMounted(async () => {
<span v-else class="muted">-</span>
</template>
</el-table-column>
<el-table-column label="不用发货" width="100" align="center">
<el-table-column label="虚拟商品" width="100" align="center">
<template #default="{ row }">
<el-tag v-if="Number(row.no_need_ship) === 1" type="info" size="small">免发货</el-tag>
<el-tag v-if="Number(row.no_need_ship) === 1" type="info" size="small">虚拟</el-tag>
<span v-else class="muted">-</span>
</template>
</el-table-column>
@ -1024,7 +1024,7 @@ onMounted(async () => {
</div>
<div class="task-panel__field task-panel__field--control">
<span class="task-panel__field-label">不用发货</span>
<span class="task-panel__field-label">虚拟商品</span>
<div class="task-panel__field-form task-panel__field-form--row">
<el-form-item prop="no_need_ship">
<el-switch v-model="form.no_need_ship" :active-value="1" :inactive-value="0" />