diff --git a/backend/app/contract/index.js b/backend/app/contract/index.js index 35518f6..e7592bc 100644 --- a/backend/app/contract/index.js +++ b/backend/app/contract/index.js @@ -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: '成本价' }, diff --git a/backend/app/model/product.js b/backend/app/model/product.js index 003592c..572aba6 100644 --- a/backend/app/model/product.js +++ b/backend/app/model/product.js @@ -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 首张)' }, diff --git a/backend/app/service/orderWms.js b/backend/app/service/orderWms.js index c98398e..3b86655 100644 --- a/backend/app/service/orderWms.js +++ b/backend/app/service/orderWms.js @@ -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 }, }); diff --git a/backend/app/utils/orderStock.js b/backend/app/utils/orderStock.js index 34b80b6..aac43ff 100644 --- a/backend/app/utils/orderStock.js +++ b/backend/app/utils/orderStock.js @@ -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( diff --git a/backend/database/migrations/20261124010000-add-no-need-ship-to-products.js b/backend/database/migrations/20261124010000-add-no-need-ship-to-products.js index 3985c2e..20dcaa0 100644 --- a/backend/database/migrations/20261124010000-add-no-need-ship-to-products.js +++ b/backend/database/migrations/20261124010000-add-no-need-ship-to-products.js @@ -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 否', }); }, diff --git a/backend/test/app/service/orderWms.test.js b/backend/test/app/service/orderWms.test.js index cdd426e..b5bf4f1 100644 --- a/backend/test/app/service/orderWms.test.js +++ b/backend/test/app/service/orderWms.test.js @@ -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); diff --git a/frontend/src/api/product.ts b/frontend/src/api/product.ts index 4bf4cad..591f8af 100644 --- a/frontend/src/api/product.ts +++ b/frontend/src/api/product.ts @@ -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 diff --git a/frontend/src/views/Product/Index.vue b/frontend/src/views/Product/Index.vue index cf2b6b5..c8e842c 100644 --- a/frontend/src/views/Product/Index.vue +++ b/frontend/src/views/Product/Index.vue @@ -630,9 +630,9 @@ onMounted(async () => { - - + @@ -1024,7 +1024,7 @@ onMounted(async () => {
- 不用发货 + 虚拟商品