From d518be2c368cabad97ac4bb3e0b3012273a091d2 Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Tue, 29 Sep 2026 15:55:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E7=9B=98=E7=82=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增库存盘点任务列表页与明细页(pages/warehouse/inventoryCount*.vue) - 注册盘点页面路由(pages.json) - 新增 stock.check 接口组:list/detail/report/finish/submit/cancel - 首页与快捷操作菜单新增「库存盘点」入口跳转 - 商品查询页库存改为可用数量+锁定数量计算展示 --- core/request/apis.js | 45 + pages.json | 14 + pages/home/edit-quick-actions.vue | 5 + pages/index/index.vue | 5 + pages/warehouse/inventoryCount.vue | 723 +++++++++++++++ pages/warehouse/inventoryCountDetail.vue | 1053 ++++++++++++++++++++++ pages/work/product/query.vue | 60 ++ 7 files changed, 1905 insertions(+) create mode 100644 pages/warehouse/inventoryCount.vue create mode 100644 pages/warehouse/inventoryCountDetail.vue diff --git a/core/request/apis.js b/core/request/apis.js index 9c0e441..61acbd7 100644 --- a/core/request/apis.js +++ b/core/request/apis.js @@ -427,6 +427,51 @@ export default { } } }, + /** 库存盘点 ↓ */ + check: { + // 盘点任务列表:按当前用户仓库限定范围,支持 status/store_id/keyword 筛选与分页 + list: { + path: "stock.check.list", + auth: true, + method: "POST", + isSystemApi: true + }, + // 盘点任务明细:返回主表 check + 全部明细 rows(含账面/实盘/差异数量) + detail: { + path: "stock.check.detail", + auth: true, + method: "POST", + isSystemApi: true + }, + // 盘点作业上报:单条明细实盘数量(quantity>=0 整数) + report: { + path: "stock.check.report", + auth: true, + method: "POST", + isSystemApi: true + }, + // 完成盘点作业:主表置 completed + finish: { + path: "stock.check.finish", + auth: true, + method: "POST", + isSystemApi: true + }, + // 提交审核:created/rejected → submitted + submit: { + path: "stock.check.submit", + auth: true, + method: "POST", + isSystemApi: true + }, + // 取消盘点任务:created/submitted/rejected → cancelled + cancel: { + path: "stock.check.cancel", + auth: true, + method: "POST", + isSystemApi: true + } + }, pick: { query: { path: "pick.query", diff --git a/pages.json b/pages.json index ddddbf6..ae49017 100644 --- a/pages.json +++ b/pages.json @@ -124,6 +124,20 @@ "titleNView": false } }, + { + "path" : "pages/warehouse/inventoryCount", + "style" : + { + "titleNView": false + } + }, + { + "path" : "pages/warehouse/inventoryCountDetail", + "style" : + { + "titleNView": false + } + }, { "path" : "pages/403", "style" : diff --git a/pages/home/edit-quick-actions.vue b/pages/home/edit-quick-actions.vue index 02f807b..8345e15 100644 --- a/pages/home/edit-quick-actions.vue +++ b/pages/home/edit-quick-actions.vue @@ -322,6 +322,7 @@ const isBlockRegistration = menuName === '拦截登记'; const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录')); const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录')); + const isInventoryCount = menuName === '库存盘点' || (menuName.includes('库存') && menuName.includes('盘点')) || menuName.includes('盘点'); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库')); @@ -342,6 +343,10 @@ this.$tools.routerTo('/pages/warehouse/inventoryTransfer'); return; } + if (isInventoryCount) { + this.$tools.routerTo('/pages/warehouse/inventoryCount'); + return; + } const targetPath = isGoodsQuery ? '/pages/work/product/query' : (isOrderPicking diff --git a/pages/index/index.vue b/pages/index/index.vue index b42e8e6..510a034 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1362,6 +1362,7 @@ const isBlockRegistration = menuName === '拦截登记'; const isPickingRecord = menuName === '拣货记录' || (menuName.includes('拣货') && menuName.includes('记录')); const isTransferRecord = menuName === '移库记录' || (menuName.includes('移库') && menuName.includes('记录')); + const isInventoryCount = menuName === '库存盘点' || (menuName.includes('库存') && menuName.includes('盘点')) || menuName.includes('盘点'); const rawPath = item?.component || item?.path || ''; const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : ''; const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库')); @@ -1386,6 +1387,10 @@ this.$tools.routerTo('/pages/warehouse/inventoryTransfer'); return; } + if (isInventoryCount) { + this.$tools.routerTo('/pages/warehouse/inventoryCount'); + return; + } const targetPath = isGoodsQuery ? '/pages/work/product/query' : (isOrderPicking diff --git a/pages/warehouse/inventoryCount.vue b/pages/warehouse/inventoryCount.vue new file mode 100644 index 0000000..66ef49e --- /dev/null +++ b/pages/warehouse/inventoryCount.vue @@ -0,0 +1,723 @@ + + + + + diff --git a/pages/warehouse/inventoryCountDetail.vue b/pages/warehouse/inventoryCountDetail.vue new file mode 100644 index 0000000..f4eef6f --- /dev/null +++ b/pages/warehouse/inventoryCountDetail.vue @@ -0,0 +1,1053 @@ + + + + + diff --git a/pages/work/product/query.vue b/pages/work/product/query.vue index 87d80ac..1cb78f7 100644 --- a/pages/work/product/query.vue +++ b/pages/work/product/query.vue @@ -1688,6 +1688,15 @@ return '--'; } + // 库存 = 可用数量 + 锁定数量 + const locked = this.getStorageLockedQuantity(item); + const available = this.getStorageAvailableQuantity(item, locked); + + if (available !== null || locked !== null) { + return (available === null ? 0 : available) + (locked === null ? 0 : locked); + } + + // 都拿不到时退回原始库存字段 return this.getValueOrDash( item.quantity ?? item.actual_quantity @@ -1696,6 +1705,57 @@ ?? item.qty ); }, + getStorageLockedQuantity(item) { + if (!item || typeof item !== 'object') { + return null; + } + + return this.toNumberOrNull( + item.locked_quantity + ?? item.lock_quantity + ?? item.frozen_quantity + ?? item.freeze_quantity + ); + }, + getStorageAvailableQuantity(item, locked = null) { + if (!item || typeof item !== 'object') { + return null; + } + + const available = this.toNumberOrNull( + item.available_quantity + ?? item.movable_quantity + ?? item.moveable_quantity + ?? item.can_move_quantity + ?? item.free_quantity + ?? item.usable_quantity + ); + if (available !== null) { + return available; + } + + // 没有可用数量字段时,用 库存 - 锁定 反推可用数量 + const quantity = this.toNumberOrNull( + item.quantity + ?? item.actual_quantity + ?? item.stock + ?? item.total_quantity + ?? item.qty + ); + if (quantity !== null && locked !== null) { + return quantity - locked; + } + + return null; + }, + toNumberOrNull(value) { + if (value === null || value === undefined || value === '') { + return null; + } + + const num = Number(value); + return Number.isNaN(num) ? null : num; + }, getStorageAvailableText(item) { if (!item || typeof item !== 'object') { return '--';