From 3cf709c196176b5a7ce66b5a8cd9ebbcc7dcf52a Mon Sep 17 00:00:00 2001 From: liufumingren Date: Wed, 28 Oct 2026 00:08:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=9B=98=E7=82=B9):=20=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=A1=B5=E5=B1=95=E7=A4=BA=E6=9C=AA=E7=9B=98?= =?UTF-8?q?=E5=BA=93=E4=BD=8D=E5=8D=A0=E4=BD=8D=E8=A1=8C=EF=BC=8C=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E5=BE=85=E7=9B=98=E5=BA=93=E4=BD=8D=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - normalizeGoodsDetailInfo 不再过滤未盘库位:每个库位带 checked 标记, 未盘行实盘按 -- 展示(后端 quantity 回 0,直接用会误算「账实相符」),不参与盈亏 - recordCount / lastCheckedAt 仍只统计真实作业记录,口径不变 - 商品作业页 resolveHasChecked 改为「有记录 或 存在已盘库位」, 避免占位行导致卡片误显示已盘 0 - 「共 N 条」按已盘库位数统计,未盘占位行不计入 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../warehouse/inventoryCount-comps/countModel.js | 13 ++++++++----- src/pages/warehouse/inventoryCountGoods.vue | 10 ++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/pages/warehouse/inventoryCount-comps/countModel.js b/src/pages/warehouse/inventoryCount-comps/countModel.js index 78fe026..1b021cf 100644 --- a/src/pages/warehouse/inventoryCount-comps/countModel.js +++ b/src/pages/warehouse/inventoryCount-comps/countModel.js @@ -971,26 +971,29 @@ export function normalizeGoodsDetailInfo(row, mode) { const checkers = Array.isArray(checkersRaw) ? checkersRaw.filter(Boolean).join('、') : String(checkersRaw || ''); // 库位明细(每库位一行:账面 / 实盘 / 盈亏),顺便汇总记录条数与最近上报时间 - // 未盘点库位只是任务范围占位(record_ids 空且无盘点人/上报时间),不作为「盘点记录」展示 + // 未盘点库位是任务范围占位:保留展示以便看到待盘库位,但实盘按 -- 处理、不参与盈亏、不计入记录条数 const rawLocations = Array.isArray(source.locations) ? source.locations : []; - const checkedLocations = rawLocations.filter(isCheckedLocation); let recordCount = 0; let lastCheckedAt = ''; - const locations = checkedLocations.map((item, index) => { + const locations = rawLocations.map((item, index) => { const loc = item && typeof item === 'object' ? item : {}; + const checked = isCheckedLocation(loc); const locationCode = firstValue(loc, ['location_code', 'locationCode']) || ''; const locationName = firstValue(loc, ['location_name', 'locationName']) || ''; const spaceId = firstValue(loc, ['space_id', 'location_id', 'locationId', 'spaceId']); const recordIds = Array.isArray(loc.record_ids) ? loc.record_ids.filter(id => id !== null && id !== undefined && id !== '') : []; const systemQuantity = toNumberOrNull(loc.system_quantity !== undefined ? loc.system_quantity : loc.systemQuantity); - const quantity = toNumberOrNull(loc.quantity); + // 未盘库位的 quantity 后端会回 0,直接展示会算出「账实相符」,因此按未盘置空 + const quantity = checked ? toNumberOrNull(loc.quantity) : null; const checkedAt = firstValue(loc, ['checked_at', 'checkedAt']); const checkerName = firstValue(loc, ['checker_name', 'checkerName']); recordCount += recordIds.length; if (checkedAt && checkedAt > lastCheckedAt) lastCheckedAt = checkedAt; - const diff = systemQuantity === null || quantity === null ? null : quantity - systemQuantity; + const diff = checked && systemQuantity !== null && quantity !== null ? quantity - systemQuantity : null; return { key: `loc-${locationCode || index + 1}`, + // 该库位是否已盘(占位行 checked=false:实盘 --、不可删除) + checked, // 左滑删除用:整库位的记录 ID 列表(recordDelete 支持数组) recordIds, recordId: recordIds.length === 1 ? recordIds[0] : '', diff --git a/src/pages/warehouse/inventoryCountGoods.vue b/src/pages/warehouse/inventoryCountGoods.vue index 97527d1..8c056a5 100644 --- a/src/pages/warehouse/inventoryCountGoods.vue +++ b/src/pages/warehouse/inventoryCountGoods.vue @@ -155,11 +155,12 @@ function resolveSystemQuantity(goodsInfo) { return sys === null || sys === undefined ? null : Number(sys); } -/** 是否已盘(有库位明细/作业记录) */ +/** 是否已盘(有已盘库位明细/作业记录;未盘占位行不算) */ function resolveHasChecked(goodsInfo) { const info = goodsInfo || {}; - if (Array.isArray(info.locations) && info.locations.length) return true; - return Number(info.recordCount) > 0; + if (Number(info.recordCount) > 0) return true; + const locations = Array.isArray(info.locations) ? info.locations : []; + return locations.some(item => item && item.checked); } /** 已盘合计:优先接口 checked_quantity,缺失时用库位明细合计 */ @@ -278,7 +279,8 @@ export default { statusText: '', statusClass: '', meta, - goodsCount: locations.length, + // 「共 N 条」按实际已盘库位数统计(未盘占位行不计入) + goodsCount: locations.filter(item => item && item.checked).length, unknownCount: 0, children: locations };