From af2d1c10c6978e82b73e4bb0eb7d6c558d4aa1d4 Mon Sep 17 00:00:00 2001 From: yueli Date: Thu, 10 Sep 2026 10:14:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(scrap):=20=E6=8A=A5=E5=BA=9F=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E9=A1=B5=E9=87=8D=E6=9E=84=E4=B8=BA=E3=80=8C=E6=8C=89?= =?UTF-8?q?=E5=8D=95=E6=89=AB=E7=A0=81=E6=89=A7=E8=A1=8C=E3=80=8D=EF=BC=8C?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E5=87=BA=E5=BA=93=E7=89=88=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit create.vue 由「直接报废」页(492 行)重写为按单执行页: · 顶部选择已批准申请单(scope=executable, status=1); · 载入 items_json 为待执行清单,逐项显示批准数量与已扫数量; · 扫码头按 (source_table, stock_id) 匹配批准明细, 不在单内或超批准量时红色 toast + 震动阻断,禁止入车; · 支持 ?requestId= 深链直达;提交实扫 payload 到 execute 接口。 审批页的「执行报废」由弹窗盲执行改为跳转本页(router.push + query.requestId), 移除 executeVisible/confirmExecute 等已失效代码;路由标题改为「按单报废执行」。 executeScrapByRequest 增加 items 参数。 --- inventory-web/src/api/scrap.ts | 14 +- inventory-web/src/router/index.ts | 2 +- .../views/operation/scrap/approval/index.vue | 57 +- .../src/views/operation/scrap/create.vue | 792 +++++++++++------- 4 files changed, 529 insertions(+), 336 deletions(-) diff --git a/inventory-web/src/api/scrap.ts b/inventory-web/src/api/scrap.ts index 946c3b5..92e0bfd 100644 --- a/inventory-web/src/api/scrap.ts +++ b/inventory-web/src/api/scrap.ts @@ -94,10 +94,18 @@ export function approveScrapRequest(id: number, data: { action: 'approve' | 'rej }) } -// 9. 按单报废执行(扣减库存) -export function executeScrapByRequest(id: number) { +// 9. 按单报废执行(提交实扫明细,扣减库存) +// items 必须是该申请单批准明细的子集,且累计数量不得超过批准数量 +export function executeScrapByRequest(id: number, items: Array<{ + source_table: string + stock_id: number + quantity: number + sku?: string + name?: string +}>) { return request({ url: `/v1/scrap/request/${id}/execute`, - method: 'post' + method: 'post', + data: { items } }) } diff --git a/inventory-web/src/router/index.ts b/inventory-web/src/router/index.ts index 7b60018..2257144 100644 --- a/inventory-web/src/router/index.ts +++ b/inventory-web/src/router/index.ts @@ -261,7 +261,7 @@ const routes: Array = [ path: 'create', name: 'ScrapCreate', component: () => import('@/views/operation/scrap/create.vue'), - meta: { title: '新建报废' } + meta: { title: '按单报废执行' } }, { path: 'apply', diff --git a/inventory-web/src/views/operation/scrap/approval/index.vue b/inventory-web/src/views/operation/scrap/approval/index.vue index 6bee467..cc8e85b 100644 --- a/inventory-web/src/views/operation/scrap/approval/index.vue +++ b/inventory-web/src/views/operation/scrap/approval/index.vue @@ -159,45 +159,18 @@ - - - - - - - - - - - - - - - - - -