diff --git a/package.json b/package.json index 04af0e6..5b2ab0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wms-pda", - "version": "1.0.134", + "version": "1.0.135", "private": true, "description": "天豹云仓 WMS_PDA(uni-app Vue2 + @vue/cli 4.5)", "scripts": { diff --git a/src/pages/warehouse/inventoryCount-comps/CountGoodsCard.vue b/src/pages/warehouse/inventoryCount-comps/CountGoodsCard.vue index 2ab92ae..3bbc29c 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountGoodsCard.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountGoodsCard.vue @@ -21,11 +21,12 @@ {{ row.subtitle }} 已盘记录 {{ row.recordCount || 0 }} 条 {{ locationText }} @@ -171,6 +172,12 @@ export default { color: #303133; } +/* 另一种账面口径提示(静态看当前库存 / 普通看基准快照) */ +.goods-card__metric--hint { + color: #b8811a; + font-size: 28rpx; +} + .goods-card__diff { margin-right: 20rpx; font-size: 34rpx; diff --git a/src/pages/warehouse/inventoryCount-comps/CountLocationDetail.vue b/src/pages/warehouse/inventoryCount-comps/CountLocationDetail.vue index 36df073..3d0fe72 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountLocationDetail.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountLocationDetail.vue @@ -71,11 +71,12 @@ 账面 {{ child.amounts.systemText }} + >{{ child.amounts.systemLabel || '账面' }} {{ child.amounts.systemText }} 实盘 {{ child.amounts.checkedText }} {{ child.amounts.diffText }} + {{ child.amounts.bookHint }} @@ -428,6 +429,13 @@ export default { font-weight: 600; } +/* 另一种账面口径提示(静态看当前库存 / 普通看基准快照) */ +.loc-detail__row-hint { + margin-right: 20rpx; + font-size: 26rpx; + color: #b8811a; +} + .loc-detail__row-diff--gain { color: #18a058; } diff --git a/src/pages/warehouse/inventoryCount-comps/CountRecordCard.vue b/src/pages/warehouse/inventoryCount-comps/CountRecordCard.vue index 55e319b..78fa70b 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountRecordCard.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountRecordCard.vue @@ -15,6 +15,7 @@ class="record-card__type" :class="item.typeClass" >{{ item.typeLabel }} + 静态 @@ -111,6 +112,11 @@ export default { background: #e8f7ee; } +.record-card__type--static { + color: #d46b08; + background: #fff4e6; +} + /* 第三行:左右结构 */ .record-card__body { margin-top: 20rpx; diff --git a/src/pages/warehouse/inventoryCount-comps/CountSummaryPanel.vue b/src/pages/warehouse/inventoryCount-comps/CountSummaryPanel.vue index 084d4fc..a2ce679 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountSummaryPanel.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountSummaryPanel.vue @@ -22,6 +22,10 @@ 盘点方式 {{ info.modeText || '--' }} + + 盘点性质 + {{ info.isStaticText }} + 状态 {{ info.statusText || '--' }} diff --git a/src/pages/warehouse/inventoryCount-comps/CountWorkCard.vue b/src/pages/warehouse/inventoryCount-comps/CountWorkCard.vue index e9efad5..c325fcb 100644 --- a/src/pages/warehouse/inventoryCount-comps/CountWorkCard.vue +++ b/src/pages/warehouse/inventoryCount-comps/CountWorkCard.vue @@ -15,7 +15,7 @@ - 账面数量 + {{ row.amount.systemLabel || '账面数量' }} {{ row.amount.systemText }} @@ -23,6 +23,7 @@ {{ row.amount.checkedText }} {{ row.amount.diffText }} + {{ row.amount.bookHint }} @@ -66,9 +67,10 @@ {{ child.statusText }} - 账面 {{ child.amount.systemText }} · 已盘 {{ child.amount.checkedText }} + {{ child.amount.systemLabel || '账面' }} {{ child.amount.systemText }} · 已盘 {{ child.amount.checkedText }} 实盘 {{ child.quantityText }} + {{ child.amount.bookHint }} @@ -275,6 +277,14 @@ export default { background: #f5f7fa; } +/* 另一种账面口径提示(静态看当前库存 / 普通看基准快照) */ +.work-card__book-hint { + width: 100%; + margin-top: 6rpx; + font-size: 26rpx; + color: #b8811a; +} + .work-card__input-row { margin-top: 20rpx; display: flex; @@ -389,6 +399,13 @@ export default { color: #606266; } +.work-child__hint { + margin-top: 4rpx; + margin-left: 16rpx; + font-size: 26rpx; + color: #b8811a; +} + .work-child__side .work-card__amount { margin-left: 16rpx; } diff --git a/src/pages/warehouse/inventoryCount-comps/countModel.js b/src/pages/warehouse/inventoryCount-comps/countModel.js index 9595491..d537b8c 100644 --- a/src/pages/warehouse/inventoryCount-comps/countModel.js +++ b/src/pages/warehouse/inventoryCount-comps/countModel.js @@ -284,6 +284,10 @@ export function normalizeCheckRecords(list, fallbackPage = 1) { const id = firstValue(source, ['id', 'check_id', 'checkId', 'task_id', 'taskId']) || `${fallbackPage}-${index + 1}`; const tone = statusTone(status); + // 静态盘点标记(0.3.310):仅商品盘点任务有效,库位盘点恒为 0 + const staticRaw = source.is_static !== undefined ? source.is_static : source.isStatic; + const hasStaticFlag = staticRaw !== undefined && staticRaw !== null && String(staticRaw).trim() !== ''; + const isStatic = hasStaticFlag && toBool(staticRaw); return { id, checkNo, @@ -293,6 +297,9 @@ export function normalizeCheckRecords(list, fallbackPage = 1) { typeText: composeType(typeValue, modeValue), typeLabel: typeText(typeValue), typeClass: typeTone(typeValue) ? `record-card__type--${typeTone(typeValue)}` : '', + isStatic, + hasStaticFlag, + isStaticText: hasStaticFlag ? (isStatic ? '静态' : '') : '', operator, progressText, status, @@ -326,6 +333,10 @@ export function normalizeCheckTaskInfo(check, storeNameFallback = '') { const creatorName = firstValue(source, ['creator_name', 'creatorName', 'creator']); const remark = firstValue(source, ['remark']); const tone = statusTone(status); + // 静态盘点标记(0.3.310):detail/workData 的 check 均返回;库位盘点恒为 0 + const staticRaw = source.is_static !== undefined ? source.is_static : source.isStatic; + const hasStaticFlag = staticRaw !== undefined && staticRaw !== null && String(staticRaw).trim() !== ''; + const isStatic = hasStaticFlag && toBool(staticRaw); return { id, checkNo, @@ -348,6 +359,9 @@ export function normalizeCheckTaskInfo(check, storeNameFallback = '') { creatorId, creatorName, remark, + isStatic, + hasStaticFlag, + isStaticText: hasStaticFlag ? (isStatic ? '静态盘点' : '普通盘点') : '', startTimeText: formatDateTime(firstValue(source, ['start_time', 'startTime'])), endTimeText: formatDateTime(firstValue(source, ['end_time', 'endTime'])), createTimeText: formatDateTime(firstValue(source, ['created_at', 'createdAt', 'create_time', 'createTime'])), @@ -492,6 +506,74 @@ export function isOpenCheckMode(mode) { return String(mode || '').trim().toLowerCase() === 'open'; } +/** 静态盘点标记归一化(兼容 1/'1'/true) */ +export function isStaticCheck(value) { + return toBool(value); +} + +/** + * 账面来源归一化(0.3.318): + * snapshot = 明细快照(静态盘点冻结基准);storage = 当前库存 wms_storage(普通盘点实时账面) + */ +export function normalizeBookSource(bookSource, isStatic) { + const key = String(bookSource || '').trim().toLowerCase(); + if (key === 'snapshot' || key === 'storage') return key; + return toBool(isStatic) ? 'snapshot' : 'storage'; +} + +/** + * 从作业行读取 0.3.318 账面字段(兼容驼峰) + * storage_quantity=当前 storage 账面;snapshot_quantity=明细快照;is_static/book_source=口径来源 + */ +function pickBookMeta(source, fallbackIsStatic) { + const obj = source && typeof source === 'object' ? source : {}; + const storageRaw = obj.storage_quantity !== undefined ? obj.storage_quantity : obj.storageQuantity; + const snapshotRaw = obj.snapshot_quantity !== undefined ? obj.snapshot_quantity : obj.snapshotQuantity; + const staticRaw = obj.is_static !== undefined ? obj.is_static : obj.isStatic; + const bookRaw = obj.book_source !== undefined ? obj.book_source : obj.bookSource; + const hasStaticFlag = staticRaw !== undefined && staticRaw !== null && String(staticRaw).trim() !== ''; + // 行级未带 is_static 时(如 space 视图 goods)用任务级标记兜底,避免静态任务误显「当前库存」 + const hasFallback = typeof fallbackIsStatic === 'boolean'; + const resolvedStatic = hasStaticFlag ? staticRaw : (hasFallback ? fallbackIsStatic : undefined); + return { + storageQuantity: toNumberOrNull(storageRaw), + snapshotQuantity: toNumberOrNull(snapshotRaw), + isStatic: hasStaticFlag || hasFallback ? toBool(resolvedStatic) : false, + hasStaticFlag: hasStaticFlag || hasFallback, + bookSource: normalizeBookSource(bookRaw, resolvedStatic) + }; +} + +/** + * 账面口径元信息:system_quantity 为本次参与差异计算的账面(静态=快照、普通=当前库存), + * storage_quantity / snapshot_quantity 为另一口径参考值,两者不一致时给出提示文案。 + */ +export function resolveBookMeta(systemQuantity, options = {}) { + const sys = toNumberOrNull(systemQuantity); + const storage = toNumberOrNull(options.storageQuantity); + const snapshot = toNumberOrNull(options.snapshotQuantity); + const source = normalizeBookSource(options.bookSource, options.isStatic); + const sourceText = source === 'snapshot' ? '快照' : '当前库存'; + let hint = ''; + if (sys !== null) { + if (source === 'snapshot') { + // 静态盘点:账面取快照,若当前库存已偏离(理论上盘点期间禁止出入库)则提示 + if (storage !== null && storage !== sys) hint = `当前库存 ${storage}`; + } else if (snapshot !== null && snapshot !== sys) { + // 普通盘点:账面取当前库存,补充展示审核时的基准快照 + hint = `基准快照 ${snapshot}`; + } + } + return { + bookSource: source, + bookSourceText: sourceText, + systemLabel: `账面(${sourceText})`, + bookHint: hint, + storageQuantity: storage, + snapshotQuantity: snapshot + }; +} + /** * 作业解析视图: * 库位任务(location)一律 location;商品任务(goods/store)默认 space,isGoods=true 时为 goods @@ -514,13 +596,15 @@ function toBool(value) { return key === '1' || key === 'true'; } -/** 库位明细是否已盘:有记录ID(record_ids)、盘点人或上报时间之一即视为已盘 */ +/** 库位明细是否已盘:有记录ID(record_ids)、盘点人、上报时间或状态为 checked 之一即视为已盘 */ function isCheckedLocation(loc) { if (!loc || typeof loc !== 'object') return false; const ids = Array.isArray(loc.record_ids) ? loc.record_ids.filter(id => id !== null && id !== undefined && id !== '') : []; return ids.length > 0 || !!firstValue(loc, ['checked_at', 'checkedAt']) - || !!firstValue(loc, ['checker_name', 'checkerName']); + || !!firstValue(loc, ['checker_name', 'checkerName']) + || String(loc.status || '').trim().toLowerCase() === 'checked' + || toBool(loc.is_checked); } /** 宫格格子里显示的短库位号(取末两段,如 E07-01-02-01 → 02-01) */ @@ -537,11 +621,14 @@ function toNumberString(value) { return num === null ? '' : String(num); } -/** 明盘数量块(盲盘返回 null,不展示任何数量) */ -function buildWorkAmount(systemQuantity, checkedQuantity, diffQuantity, open) { +/** 明盘数量块(盲盘返回 null,不展示任何数量) + * meta(0.3.318):storageQuantity / snapshotQuantity / isStatic / bookSource —— + * 账面 systemText 始终取接口 system_quantity(静态=快照、普通=当前库存),另一种口径仅作提示 */ +function buildWorkAmount(systemQuantity, checkedQuantity, diffQuantity, open, meta = {}) { if (!open) return null; const sys = toNumberOrNull(systemQuantity); const chk = toNumberOrNull(checkedQuantity); + const book = resolveBookMeta(sys, meta); // 差异统一以「实盘 - 账面」为准,避免后端 diff_quantity 与账面/实盘不一致(如未盘项返回 0) let diff = null; if (sys !== null && chk !== null) { @@ -558,7 +645,14 @@ function buildWorkAmount(systemQuantity, checkedQuantity, diffQuantity, open) { diffText: diff === null ? '' : (diff > 0 ? `盘盈 +${diff}` : (diff < 0 ? `盘亏 ${-diff}` : '账实相符')), diff, diffTone, - diffClass: diff === null ? '' : (diff > 0 ? 'work-card__diff--gain' : (diff < 0 ? 'work-card__diff--loss' : 'work-card__diff--match')) + diffClass: diff === null ? '' : (diff > 0 ? 'work-card__diff--gain' : (diff < 0 ? 'work-card__diff--loss' : 'work-card__diff--match')), + // 账面口径(0.3.318):标签 + 另一口径提示 + systemLabel: book.systemLabel, + bookSource: book.bookSource, + bookSourceText: book.bookSourceText, + bookHint: book.bookHint, + storageQuantity: book.storageQuantity, + snapshotQuantity: book.snapshotQuantity }; } @@ -583,7 +677,6 @@ function buildWorkUnit(detailId, location, currentQuantity, reported, stockId, s * 构造 check.report 入参(按 https 文档口径) * - space_id 必传(wms_location_space.id,兼容 spaceId/location_id/locationId 写法):库位一律按库位ID落库 * - location 降级为可选一致性校验(与 space_id 对应编码不一致返回 400) - * - detail_id 可选:库位明细行必传;商品模式(goods 视图行不返回明细ID)只传 id + stock_id + space_id,服务端反查明细 * - 商品明细行:stock_id 固定为明细商品(与 space_id 一起定位「库位+商品」) * - 库位明细行:必须带商品(stock_id 或 barcode 至少一项),space_id 对应编码须等于明细库位编码 * - 未知商品:只传 barcode(item_name 可选,缺省为条码) @@ -591,16 +684,13 @@ function buildWorkUnit(detailId, location, currentQuantity, reported, stockId, s */ export function buildReportParams(taskId, payload = {}) { const isEmpty = !!payload.isEmpty; + const detailId = Number(payload.detailId); const params = { id: Number(taskId), quantity: isEmpty ? 0 : Number(payload.quantity) }; - const detailIdRaw = payload.detailId !== undefined && payload.detailId !== null && String(payload.detailId).trim() !== '' - ? payload.detailId - : payload.detail_id; - if (detailIdRaw !== undefined && detailIdRaw !== null && String(detailIdRaw).trim() !== '') { - params.detail_id = Number(detailIdRaw); - } + // detail_id 可选(0.3.309):商品钻取上报可改传 stock_id + space_id 由服务端反查明细 + if (Number.isFinite(detailId) && detailId > 0) params.detail_id = detailId; // space_id 必传:兼容 spaceId/location_id/locationId 写法(取回接口 rows[].space_id、rows[].id、locations[].space_id 可直接回传) const spaceId = payload.spaceId !== undefined && payload.spaceId !== null && String(payload.spaceId).trim() !== '' ? payload.spaceId @@ -635,7 +725,7 @@ function joinText(parts, sep = ' · ') { } /** space 视图:行=库位,goods 为该库位下的任务商品(商品任务默认视图;作业列表按库位宫格展示,仅统计不可点击) */ -function normalizeSpaceWorkRow(item, index, open) { +function normalizeSpaceWorkRow(item, index, open, options = {}) { const source = item && typeof item === 'object' ? item : {}; const spaceCode = firstValue(source, ['space_code', 'spaceCode']) || `#${index + 1}`; // space 视图行:space_id 与 location_id 均等于既有 id(wms_location_space.id) @@ -646,13 +736,20 @@ function normalizeSpaceWorkRow(item, index, open) { const detailId = firstValue(good, ['detail_id', 'detailId']); const checkedRaw = good.checked_quantity !== undefined ? good.checked_quantity : good.checkedQuantity; const done = String(good.status || '').trim().toLowerCase() === 'checked'; + const bookMeta = pickBookMeta(good, options.isStatic); return { key: `${spaceCode}-${detailId || goodIndex + 1}`, title: firstValue(good, ['item_name', 'itemName']) || '--', subtitle: joinText([firstValue(good, ['barcode']), firstValue(good, ['spec']), storeNameValue(good)]), statusText: done ? '已盘' : '未盘', statusClass: done ? 'work-card__tag--done' : 'work-card__tag--todo', - amount: buildWorkAmount(good.system_quantity !== undefined ? good.system_quantity : good.systemQuantity, checkedRaw, null, open), + amount: buildWorkAmount( + good.system_quantity !== undefined ? good.system_quantity : good.systemQuantity, + checkedRaw, + null, + open, + bookMeta + ), quantityText: '', unit: buildWorkUnit(detailId, spaceCode, checkedRaw, done, firstValue(good, ['stock_id', 'stockId']), rowSpaceId) }; @@ -699,12 +796,10 @@ function normalizeSpaceWorkRow(item, index, open) { }; } -/** goods 视图:行=商品(后端不再返回行级 detail_id,跳转/上报改用 stock_id),locations 为按库位聚合的作业记录(商品任务的 is_goods=true) */ -function normalizeGoodsWorkRow(item, index, open) { +/** goods 视图:行=商品,locations 为按库位聚合的作业记录(商品任务的 is_goods=true) */ +function normalizeGoodsWorkRow(item, index, open, options = {}) { const source = item && typeof item === 'object' ? item : {}; const detailId = firstValue(source, ['detail_id', 'detailId']); - // 行级明细ID 已不再返回,商品模式以 stock_id 定位(workDataDetail / report 均传 id + stock_id) - const stockId = firstValue(source, ['stock_id', 'stockId']); const checkedRaw = source.checked_quantity !== undefined ? source.checked_quantity : source.checkedQuantity; const rawLocations = Array.isArray(source.locations) ? source.locations : []; const children = rawLocations.map((row, locIndex) => { @@ -727,6 +822,11 @@ function normalizeGoodsWorkRow(item, index, open) { }; }); const checkedNumber = toNumberOrNull(checkedRaw); + // 账面口径(0.3.318):is_static/book_source/storage_quantity/snapshot_quantity + const bookMeta = pickBookMeta(source, options.isStatic); + const stockIdValue = firstValue(source, ['stock_id', 'stockId']); + // 行唯一键:0.3.309 起 goods 视图行不再返回 detail_id,优先用 stock_id + const rowKey = stockIdValue || detailId || `${index + 1}`; // 行级商品主图(goods 视图行级 images 仍为商品主图) const imageList = Array.isArray(source.images) ? source.images.filter(Boolean) : []; // 作业记录条数(locations[].record_ids 汇总)——已盘判断与概况展示用 @@ -739,10 +839,10 @@ function normalizeGoodsWorkRow(item, index, open) { const done = status === 'checked' || recordCount > 0 || (checkedNumber !== null && checkedNumber > 0); const reported = done; return { - key: `goods-${stockId || index + 1}`, + key: `goods-${rowKey}`, view: 'goods', detailId: detailId ? String(detailId) : '', - stockId: stockId || '', + stockId: stockIdValue === '' || stockIdValue === undefined || stockIdValue === null ? '' : String(stockIdValue), title: firstValue(source, ['item_name', 'itemName']) || '--', subtitle: joinText([firstValue(source, ['barcode']), firstValue(source, ['spec']), storeNameValue(source)]), statusText: done ? '已盘' : '未盘', @@ -752,11 +852,18 @@ function normalizeGoodsWorkRow(item, index, open) { source.system_quantity !== undefined ? source.system_quantity : source.systemQuantity, done ? checkedRaw : null, done ? (source.diff_quantity !== undefined ? source.diff_quantity : source.diffQuantity) : null, - open + open, + bookMeta ), quantityText: '', children, - unit: buildWorkUnit(detailId, '', checkedRaw, reported, stockId), + unit: buildWorkUnit(detailId, '', checkedRaw, reported, firstValue(source, ['stock_id', 'stockId'])), + // 账面口径字段(商品作业页 / 商品卡片展示用) + isStatic: bookMeta.isStatic, + hasStaticFlag: bookMeta.hasStaticFlag, + bookSource: bookMeta.bookSource, + storageQuantity: bookMeta.storageQuantity, + snapshotQuantity: bookMeta.snapshotQuantity, // 列表行(CountGoodsCard)与商品作业页(概况带入路由)用的字段:一行一个商品,操作剥离到操作页 images: imageList, image: imageList[0] || '', @@ -865,14 +972,14 @@ function normalizeLocationWorkRow(item, index, open) { }; } -/** 作业数据行归一化(view: space / goods / location) */ -export function normalizeWorkRows(rows, view, mode) { +/** 作业数据行归一化(view: space / goods / location;options.isStatic 为任务级静态标记兜底) */ +export function normalizeWorkRows(rows, view, mode, options = {}) { if (!Array.isArray(rows)) return []; const open = isOpenCheckMode(mode); return rows.map((item, index) => { - if (view === 'goods') return normalizeGoodsWorkRow(item, index, open); + if (view === 'goods') return normalizeGoodsWorkRow(item, index, open, options); if (view === 'location') return normalizeLocationWorkRow(item, index, open); - return normalizeSpaceWorkRow(item, index, open); + return normalizeSpaceWorkRow(item, index, open, options); }); } @@ -890,9 +997,9 @@ export function normalizeLocationWorkDetail(payload, mode) { * 单库位作业数据归一化(stock.check.workDataSpaceDetails,rows 只有该库位一行) * 返回结构与 workData space 视图单行一致;rows 为空时返回 null。 */ -export function normalizeSpaceWorkDetail(rows, mode) { +export function normalizeSpaceWorkDetail(rows, mode, options = {}) { if (!Array.isArray(rows) || !rows.length) return null; - return normalizeWorkRows(rows.slice(0, 1), 'space', mode)[0] || null; + return normalizeWorkRows(rows.slice(0, 1), 'space', mode, options)[0] || null; } /** @@ -951,25 +1058,40 @@ export function normalizeGoodsRecords(rows) { /** * 单条明细的作业数据(stock.check.workDataDetail)→ 商品明细概况 - * 用于商品作业页:传 id + stock_id(商品钻取),明细由接口反查得出 - * 商品钻取返回:check_id/stock_id/item_code/item_name/spec/store_id/store_name/barcode/images(商品主图) - * + summary(仅明盘:system_quantity 账面快照合计/checked_quantity 实盘合计/diff_quantity/is_diff) - * + rows[](每库位:detail_id/location_code/checked_at/checker_name/record_ids/images, - * 明盘另含 system_quantity 当前账面/snapshot_quantity 账面快照/checked_quantity 实盘/diff_quantity) - * 兼容旧口径(扁平 system_quantity/checked_quantity + locations[]);库位行(商品信息在 goods 子列表里)取 goods 首项兜底 + * 兼容两种结构: + * - 商品钻取(0.3.309+):{ check_id, stock_id, ..., summary{ system_quantity/checked_quantity/diff_quantity }, rows[] } + * rows[] 每个库位一行:detail_id/space_id/location_code/system_quantity/checked_quantity/diff_quantity/record_ids/... + * 0.3.318 起顶层增加 is_static/book_source,rows[] 增加 storage_quantity(另有 snapshot_quantity) + * - 旧单行结构:顶层 system_quantity/checked_quantity/diff_quantity + locations[](每库位 quantity) + * 库位行(商品信息在 goods 子列表里)也兼容:信息取 goods 首项兜底 */ -export function normalizeGoodsDetailInfo(row, mode) { +export function normalizeGoodsDetailInfo(row, mode, options = {}) { const source = row && typeof row === 'object' && !Array.isArray(row) ? row : {}; if (!Object.keys(source).length) return null; - const summary = source.summary && typeof source.summary === 'object' && !Array.isArray(source.summary) ? source.summary : {}; + const summarySource = source.summary && typeof source.summary === 'object' && !Array.isArray(source.summary) + ? source.summary : null; + const drillRows = Array.isArray(source.rows) ? source.rows : null; + const isDrillLayout = !!summarySource || !!drillRows; + // 商品级合计:钻取结构取 summary,旧结构取顶层 + const systemRaw = isDrillLayout + ? (summarySource ? summarySource.system_quantity : undefined) + : (source.system_quantity !== undefined ? source.system_quantity : source.systemQuantity); + const checkedRaw = isDrillLayout + ? (summarySource ? summarySource.checked_quantity : undefined) + : (source.checked_quantity !== undefined ? source.checked_quantity : source.checkedQuantity); + const diffRaw = isDrillLayout + ? (summarySource ? summarySource.diff_quantity : undefined) + : (source.diff_quantity !== undefined ? source.diff_quantity : source.diffQuantity); // 行内只要带了任一数量字段就按明盘口径构建(任务 mode 可能没取到/缺失,别把盈亏丢掉) const quantityFields = [ + systemRaw, checkedRaw, diffRaw, source.system_quantity, source.checked_quantity, source.diff_quantity, - source.systemQuantity, source.checkedQuantity, source.diffQuantity, - summary.system_quantity, summary.checked_quantity, summary.diff_quantity + source.systemQuantity, source.checkedQuantity, source.diffQuantity ]; const hasQuantity = quantityFields.some(value => value !== undefined && value !== null && value !== ''); const open = isOpenCheckMode(mode) || hasQuantity; + // 账面口径(0.3.318):顶层 is_static/book_source + const bookMeta = pickBookMeta(source, options.isStatic); // 库位行形态:商品信息/图片取 goods 首项兜底 const firstGoods = Array.isArray(source.goods) && source.goods.length ? (source.goods[0] || {}) : {}; const pickText = keys => firstValue(source, keys) || firstValue(firstGoods, keys) || ''; @@ -983,10 +1105,27 @@ export function normalizeGoodsDetailInfo(row, mode) { // 库位明细(每库位一行:账面 / 实盘 / 盈亏),顺便汇总记录条数与最近上报时间 // 未盘点库位是任务范围占位:保留展示以便看到待盘库位,但实盘按 -- 处理、不参与盈亏、不计入记录条数 - // 商品钻取用 rows,旧口径用 locations - const rawLocations = Array.isArray(source.rows) - ? source.rows + const rawLocations = isDrillLayout + ? (drillRows || []) : (Array.isArray(source.locations) ? source.locations : []); + // 商品级另一种口径合计(含未盘库位,避免账面/当前库存合计只统计已盘行) + const rowBookTotals = rawLocations.reduce((acc, item) => { + const book = pickBookMeta(item); + if (book.storageQuantity !== null) acc.storage = (acc.storage === null ? 0 : acc.storage) + book.storageQuantity; + if (book.snapshotQuantity !== null) acc.snapshot = (acc.snapshot === null ? 0 : acc.snapshot) + book.snapshotQuantity; + return acc; + }, { storage: null, snapshot: null }); + const pageDetailId = pickText(['detail_id', 'detailId']); + // 全部库位(含未盘占位行)的明细ID映射:商品作业页按库位上报时定位 detail_id + const allLocations = rawLocations.map((item, index) => { + const loc = item && typeof item === 'object' ? item : {}; + return { + key: `all-loc-${index + 1}`, + detailId: firstValue(loc, ['detail_id', 'detailId']) || pageDetailId, + spaceId: firstValue(loc, ['space_id', 'location_id', 'locationId', 'spaceId']) || '', + locationCode: firstValue(loc, ['location_code', 'locationCode']) || '' + }; + }); let recordCount = 0; let lastCheckedAt = ''; const locations = rawLocations.map((item, index) => { @@ -995,26 +1134,31 @@ export function normalizeGoodsDetailInfo(row, mode) { const locationCode = firstValue(loc, ['location_code', 'locationCode']) || ''; const locationName = firstValue(loc, ['location_name', 'locationName']) || ''; const spaceId = firstValue(loc, ['space_id', 'location_id', 'locationId', 'spaceId']); + // 钻取结构每个库位有自己的明细ID(report 按 detail_id + stock_id + space_id 定位) + const rowDetailId = firstValue(loc, ['detail_id', 'detailId']) || pageDetailId; const recordIds = Array.isArray(loc.record_ids) ? loc.record_ids.filter(id => id !== null && id !== undefined && id !== '') : []; - // 账面:优先 snapshot_quantity(盘点开始时的账面快照,与 summary 口径一致),旧口径用 system_quantity - const systemRaw = loc.snapshot_quantity !== undefined && loc.snapshot_quantity !== null - ? loc.snapshot_quantity - : (loc.system_quantity !== undefined ? loc.system_quantity : loc.systemQuantity); - const systemQuantity = toNumberOrNull(systemRaw); - // 实盘:商品钻取用 checked_quantity,旧口径用 quantity;未盘库位后端可能回 0,直接展示会算出「账实相符」,因此按未盘置空 - const quantityRaw = loc.checked_quantity !== undefined && loc.checked_quantity !== null - ? loc.checked_quantity - : (loc.quantity !== undefined && loc.quantity !== null ? loc.quantity : loc.checkedQuantity); - const quantity = checked ? toNumberOrNull(quantityRaw) : null; + const rowBook = pickBookMeta(loc); + const systemQuantity = toNumberOrNull(loc.system_quantity !== undefined ? loc.system_quantity : loc.systemQuantity); + // 实盘:旧结构为 quantity,钻取结构为 checked_quantity;未盘库位后端可能回 0,直接展示会算出「账实相符」,因此按未盘置空 + const quantity = checked ? toNumberOrNull( + loc.quantity !== undefined + ? loc.quantity + : (loc.checked_quantity !== undefined ? loc.checked_quantity : loc.checkedQuantity) + ) : 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 = checked && systemQuantity !== null && quantity !== null ? quantity - systemQuantity : null; + const rowBookInfo = resolveBookMeta(systemQuantity, rowBook); + if (checked) { + recordCount += recordIds.length; + if (checkedAt && checkedAt > lastCheckedAt) lastCheckedAt = checkedAt; + } + const diff = systemQuantity === null || quantity === null ? null : quantity - systemQuantity; return { key: `loc-${locationCode || index + 1}`, - // 该库位是否已盘(占位行 checked=false:实盘 --、不可删除) + // 该库位是否已盘(未盘占位行 checked=false:实盘 --、不可删除) checked, + // 该库位对应的盘点明细ID(多库位商品上报时按行回传) + detailId: rowDetailId, // 左滑删除用:整库位的记录 ID 列表(recordDelete 支持数组) recordIds, recordId: recordIds.length === 1 ? recordIds[0] : '', @@ -1024,6 +1168,9 @@ export function normalizeGoodsDetailInfo(row, mode) { locationId: spaceId || '', systemQuantity, quantity, + // 账面口径(0.3.318):当前 storage 账面 / 明细快照 + storageQuantity: rowBook.storageQuantity, + snapshotQuantity: rowBook.snapshotQuantity, title: locationName || locationCode || '未指定库位', subtitle: joinText([ checkerName ? `盘点人 ${checkerName}` : '', @@ -1039,6 +1186,8 @@ export function normalizeGoodsDetailInfo(row, mode) { // 明细面板展示:账面 / 实盘 / 盈亏(账面>0 时高亮,方便找账面库位) amounts: systemQuantity === null && quantity === null ? null : { systemText: systemQuantity === null ? '--' : String(systemQuantity), + systemLabel: rowBookInfo.systemLabel, + bookHint: rowBookInfo.bookHint, checkedText: quantity === null ? '--' : String(quantity), diffText: diff === null ? '' : (diff > 0 ? `盘盈 +${diff}` : (diff < 0 ? `盘亏 ${-diff}` : '账实相符')), diffTone: diff === null ? '' : (diff > 0 ? 'gain' : (diff < 0 ? 'loss' : 'match')), @@ -1048,18 +1197,15 @@ export function normalizeGoodsDetailInfo(row, mode) { }; }); - const systemQuantityRaw = summary.system_quantity !== undefined && summary.system_quantity !== null - ? summary.system_quantity - : (source.system_quantity !== undefined ? source.system_quantity : source.systemQuantity); - const checkedQuantityRaw = summary.checked_quantity !== undefined && summary.checked_quantity !== null - ? summary.checked_quantity - : (source.checked_quantity !== undefined ? source.checked_quantity : source.checkedQuantity); - const diffQuantityRaw = summary.diff_quantity !== undefined && summary.diff_quantity !== null - ? summary.diff_quantity - : (source.diff_quantity !== undefined ? source.diff_quantity : source.diffQuantity); + const summaryBook = resolveBookMeta(toNumberOrNull(systemRaw), { + isStatic: bookMeta.isStatic, + bookSource: bookMeta.bookSource, + storageQuantity: bookMeta.storageQuantity !== null ? bookMeta.storageQuantity : rowBookTotals.storage, + snapshotQuantity: bookMeta.snapshotQuantity !== null ? bookMeta.snapshotQuantity : rowBookTotals.snapshot + }); return { - detailId: pickText(['detail_id', 'detailId']), + detailId: pageDetailId || (locations[0] && locations[0].detailId) || '', stockId: stockIdRaw === undefined || stockIdRaw === null ? '' : String(stockIdRaw), itemName: pickText(['item_name', 'itemName']), itemCode: pickText(['item_code', 'itemCode']), @@ -1069,10 +1215,24 @@ export function normalizeGoodsDetailInfo(row, mode) { images, image: images[0] || '', status: String(source.status || '').trim().toLowerCase(), - systemQuantity: toNumberOrNull(systemQuantityRaw), - checkedQuantity: toNumberOrNull(checkedQuantityRaw), - amount: buildWorkAmount(systemQuantityRaw, checkedQuantityRaw, diffQuantityRaw, open), + // 账面口径(0.3.318):静态盘点取快照、普通盘点取当前库存;另一口径仅作提示 + isStatic: bookMeta.isStatic, + hasStaticFlag: bookMeta.hasStaticFlag, + bookSource: bookMeta.bookSource, + bookSourceText: summaryBook.bookSourceText, + storageQuantity: summaryBook.storageQuantity, + snapshotQuantity: summaryBook.snapshotQuantity, + systemQuantity: toNumberOrNull(systemRaw), + checkedQuantity: toNumberOrNull(checkedRaw), + amount: buildWorkAmount(systemRaw, checkedRaw, diffRaw, open, { + isStatic: bookMeta.isStatic, + bookSource: bookMeta.bookSource, + storageQuantity: summaryBook.storageQuantity, + snapshotQuantity: summaryBook.snapshotQuantity + }), locations, + // 全部库位(含未盘)——仅用于按库位定位明细ID,不用于列表展示 + allLocations, recordCount, locationCodes: locations.map(item => item.locationCode).filter(Boolean), checkers, diff --git a/src/pages/warehouse/inventoryCountDetail.vue b/src/pages/warehouse/inventoryCountDetail.vue index 8f47049..6cb494b 100644 --- a/src/pages/warehouse/inventoryCountDetail.vue +++ b/src/pages/warehouse/inventoryCountDetail.vue @@ -635,20 +635,21 @@ export default { this._pendingWorkRefresh = true; uni.navigateTo({ url }); }, - // ===== 商品视图(goods):点击进入商品作业页(只传 task_id + stock_id,明细由服务端反查) ===== + // ===== 商品视图(goods):点击进入商品作业页(0.3.309 起行内不再有 detail_id,优先按 stock_id 进入) ===== handleGoodsOpen(row) { if (!row || !this.taskId) return; - if (!row.stockId) { - uni.showToast({ title: '缺少商品库存ID', icon: 'none' }); + const params = [`task_id=${encodeURIComponent(this.taskId)}`]; + if (row.detailId) { + params.push(`detail_id=${encodeURIComponent(row.detailId)}`); + } else if (row.stockId) { + params.push(`stock_id=${encodeURIComponent(row.stockId)}`); + } else { + uni.showToast({ title: '缺少盘点明细ID', icon: 'none' }); return; } - const params = [ - `task_id=${encodeURIComponent(this.taskId)}`, - `stock_id=${encodeURIComponent(row.stockId)}` - ].join('&'); // 从商品作业页返回后刷新列表(已盘状态/记录数已变化) this._pendingWorkRefresh = true; - uni.navigateTo({ url: `/pages/warehouse/inventoryCountGoods?${params}` }); + uni.navigateTo({ url: `/pages/warehouse/inventoryCountGoods?${params.join('&')}` }); }, // 刷新/分页后保证存在有效选中项(无选中时不高亮任何格子) ensureLocationSelection() { @@ -692,7 +693,9 @@ export default { this.taskInfo = normalizeCheckTaskInfo(payload.check, this.routeStoreName); } const rows = extractListPayload(payload, response); - this.workList = normalizeWorkRows(rows, this.workView, this.taskInfo.mode); + this.workList = normalizeWorkRows(rows, this.workView, this.taskInfo.mode, { + isStatic: this.taskInfo.hasStaticFlag ? this.taskInfo.isStatic : undefined + }); this.workTotal = resolveListTotal(payload, response, rows); const pageNo = Number(payload?.page); this.workPage = Number.isFinite(pageNo) && pageNo > 0 ? pageNo : targetPage; diff --git a/src/pages/warehouse/inventoryCountGoods.vue b/src/pages/warehouse/inventoryCountGoods.vue index 7811866..e4836bc 100644 --- a/src/pages/warehouse/inventoryCountGoods.vue +++ b/src/pages/warehouse/inventoryCountGoods.vue @@ -54,9 +54,10 @@ {{ goodsMetaText }} - 账面 {{ systemQuantityValue }} + {{ systemLabel }} {{ systemQuantityValue }} 已盘 {{ checkedTotalText }} {{ diffText }} + {{ bookHintText }} @@ -124,6 +125,7 @@ import { normalizeScanResult, extractObjectPayload, normalizeGoodsDetailInfo, + isStaticCheck, buildReportParams } from './inventoryCount-comps/countModel.js'; @@ -139,7 +141,14 @@ function EMPTY_GOODS_INFO() { systemQuantity: null, checkedQuantity: null, amount: null, + // 账面口径(0.3.318):静态盘点取快照、普通盘点取当前库存 + isStatic: false, + bookSource: '', + storageQuantity: null, + snapshotQuantity: null, locations: [], + // 全部库位(含未盘)的明细ID映射:按库位上报时定位 detail_id + allLocations: [], recordCount: 0, locationCodes: [], lastCheckedAtText: '' @@ -155,7 +164,20 @@ function resolveSystemQuantity(goodsInfo) { return sys === null || sys === undefined ? null : Number(sys); } -/** 是否已盘(有已盘库位明细/作业记录;未盘占位行不算) */ +/** 账面口径标签:静态盘点=账面(快照)、普通盘点=账面(当前库存) */ +function resolveSystemLabel(goodsInfo) { + const amount = (goodsInfo || {}).amount; + if (amount && amount.systemLabel) return amount.systemLabel; + return (goodsInfo || {}).isStatic ? '账面(快照)' : '账面(当前库存)'; +} + +/** 另一种口径提示(静态看当前库存 / 普通看基准快照,不一致时才提示) */ +function resolveBookHint(goodsInfo) { + const amount = (goodsInfo || {}).amount; + return amount && amount.bookHint ? amount.bookHint : ''; +} + +/** 是否已盘(有作业记录或已盘库位;未盘占位行不算) */ function resolveHasChecked(goodsInfo) { const info = goodsInfo || {}; if (Number(info.recordCount) > 0) return true; @@ -187,11 +209,11 @@ function resolveDiffText(goodsInfo) { /** * 商品作业页(goods 视图;从盘点作业商品列表点击/扫码进入) - * 入参:**只传 id** —— task_id(盘点任务ID)+ stock_id(商品库存ID);明细由服务端反查 + * 入参:**只传 id** —— task_id(盘点任务ID)+ detail_id(盘点明细ID)或 stock_id(商品库存ID) * 数据: - * - stock.check.workDataDetail(id + stock_id)→ 商品钻取数据,含商品信息/主图/账面/已盘/差异 + rows(每库位:账面/实盘/盘点人/时间/记录ID/照片) - * - stock.check.detail(仅主表 check)→ 任务状态 / 盘点模式 - * 能力:扫码/输入库位 → 底部抽屉选库位 + 录数量(check.report:id + stock_id + space_id,不传 detail_id);库位记录可左滑删除(recordDelete) + * - stock.check.workDataDetail(id + stock_id / detail_id)→ 商品钻取数据:summary(商品级账面/已盘/差异)+ rows(按库位分行) + * - stock.check.detail(仅主表 check)→ 任务状态 / 盘点模式 / 是否静态盘点 + * 能力:扫码/输入库位 → 底部抽屉选库位 + 录数量(check.report);库位记录可左滑删除(recordDelete) */ export default { components: { @@ -202,8 +224,10 @@ export default { data() { return { taskId: '', + detailId: '', + // 商品库存ID(0.3.309 起 goods 行不再返回 detail_id,改用 stock_id 进入) stockId: '', - taskInfo: { status: '', mode: '', type: '' }, + taskInfo: { status: '', mode: '', type: '', isStatic: false, hasStaticFlag: false }, goodsInfo: EMPTY_GOODS_INFO(), loading: false, refreshing: false, @@ -234,6 +258,13 @@ export default { systemQuantityValue() { return resolveSystemQuantity(this.goodsInfo); }, + // 账面口径标签(快照 / 当前库存)与另一种口径提示 + systemLabel() { + return resolveSystemLabel(this.goodsInfo); + }, + bookHintText() { + return resolveBookHint(this.goodsInfo); + }, // 已盘合计(接口 checked_quantity,缺失时用库位明细合计;未盘显示 --) checkedTotalText() { if (!this.hasChecked) return '--'; @@ -265,15 +296,15 @@ export default { }, // CountLocationDetail 只需要 row 结构(概况在卡片,children = 库位明细:账面/实盘/盈亏) detailRow() { - if (!this.stockId) return null; + if (!this.detailId && !this.stockId && !this.goodsInfo.stockId) return null; const locations = this.goodsInfo.locations || []; const meta = []; const codes = this.goodsInfo.locationCodes || []; if (codes.length) meta.push({ label: '库位', value: codes.length === 1 ? codes[0] : `${codes.length} 个` }); if (this.goodsInfo.lastCheckedAtText) meta.push({ label: '最近上报', value: this.goodsInfo.lastCheckedAtText }); return { - key: `goods-${this.stockId}`, - detailId: '', + key: `goods-${this.detailId || this.stockId || this.goodsInfo.stockId}`, + detailId: this.detailId, title: '', subtitle: '', statusText: '', @@ -287,8 +318,9 @@ export default { } }, onLoad(options = {}) { - // 页面只需两个 id:task_id(任务ID)+ stock_id(商品库存ID) + // 页面需 task_id +(detail_id 或 stock_id):商品明细由接口反查 this.taskId = String(options.task_id || options.taskId || options.id || '').trim(); + this.detailId = String(options.detail_id || options.detailId || '').trim(); this.stockId = String(options.stock_id || options.stockId || '').trim(); this.loadAll(); @@ -390,14 +422,15 @@ export default { this.showEntryPopup = false; this.pendingLocation = ''; }, - /** 抽屉确认:库位 + 数量 → check.report(商品模式只传任务ID + stock_id,不传 detail_id) */ + /** 抽屉确认:库位 + 数量 → check.report(多库位商品按所选库位取对应明细ID) */ async handleEntryConfirm(payload) { if (!payload || !payload.location) return; const ok = await this.submitReport({ + detailId: this.resolveLocationDetailId(payload), location: payload.location, spaceId: payload.locationId, quantity: payload.quantity, - stockId: this.goodsInfo.stockId || this.stockId + stockId: this.goodsInfo.stockId }); // 成功才收起抽屉并清空顶部关键字,失败保留输入便于重试 if (ok) { @@ -405,12 +438,26 @@ export default { this.closeEntryPopup(); } }, - /** 上报(check.report:id=盘点任务,stock_id=商品,space_id=库位;明细由服务端反查) */ + /** 按库位定位盘点明细ID(同一商品多库位时每个库位一条明细) */ + resolveLocationDetailId(payload) { + const target = payload || {}; + const spaceId = target.locationId !== undefined && target.locationId !== null ? String(target.locationId).trim() : ''; + const code = String(target.location || '').trim(); + const candidates = [] + .concat(Array.isArray(this.goodsInfo.allLocations) ? this.goodsInfo.allLocations : []) + .concat(Array.isArray(this.goodsInfo.locations) ? this.goodsInfo.locations : []); + const matched = candidates.find(loc => { + const locSpaceId = String(loc.spaceId || loc.locationId || '').trim(); + if (spaceId && locSpaceId && locSpaceId === spaceId) return true; + return !!code && String(loc.locationCode || '').trim() === code; + }); + return (matched && matched.detailId) || this.detailId; + }, + /** 上报(check.report:detail_id=该库位明细,location=库位) */ async submitReport(payload) { if (!this.editable || this.submitting) return false; - const stockId = String((payload && payload.stockId) || '').trim(); - if (!stockId) { - uni.showToast({ title: '缺少商品库存ID(stock_id)', icon: 'none' }); + if (!payload || (!payload.detailId && !payload.stockId)) { + uni.showToast({ title: '缺少盘点明细ID', icon: 'none' }); return false; } const location = String(payload.location || '').trim(); @@ -431,10 +478,11 @@ export default { this.submitting = true; try { const response = await this.$http('check.report', buildReportParams(this.taskId, { + detailId: payload.detailId, location, spaceId, quantity, - stockId, + stockId: payload.stockId, barcode: this.goodsInfo.barcode, itemName: this.goodsInfo.itemName })); @@ -567,7 +615,10 @@ export default { this.taskInfo = { status: String(check.status || '').trim().toLowerCase(), mode: String(check.mode || '').trim().toLowerCase(), - type: check.type || '' + type: check.type || '', + // 静态盘点:账面取明细快照;普通盘点取当前库存(0.3.318) + isStatic: isStaticCheck(check.is_static !== undefined ? check.is_static : check.isStatic), + hasStaticFlag: (check.is_static !== undefined ? check.is_static : check.isStatic) !== undefined }; return this.taskInfo; } catch (error) { @@ -575,30 +626,40 @@ export default { return null; } }, - /** 商品钻取数据(stock.check.workDataDetail:id + stock_id,明细由服务端反查)——含商品信息/主图/账面/已盘/差异 + rows 库位明细 */ + /** 商品明细(stock.check.workDataDetail:id + stock_id / detail_id,兼容 summary+rows 钻取结构)——含商品信息/主图/账面/已盘/差异 + 各库位明细 */ async loadInfo() { - const stockId = Number(this.stockId); - if (!Number.isFinite(stockId) || stockId <= 0) { - this.loadError = '缺少商品库存ID'; - uni.showToast({ title: this.loadError, icon: 'none' }); - return null; - } const taskId = Number(this.taskId); if (!Number.isFinite(taskId) || taskId <= 0) { this.loadError = '缺少盘点任务ID'; uni.showToast({ title: this.loadError, icon: 'none' }); return null; } + const detailId = Number(this.detailId); + const routeStockId = Number(this.stockId); + const knownStockId = Number(this.goodsInfo.stockId); + const stockId = Number.isFinite(knownStockId) && knownStockId > 0 + ? knownStockId + : (Number.isFinite(routeStockId) && routeStockId > 0 ? routeStockId : 0); + const params = { id: taskId }; + if (Number.isFinite(detailId) && detailId > 0) params.detail_id = detailId; + if (stockId > 0) params.stock_id = stockId; + if (!params.detail_id && !params.stock_id) { + this.loadError = '缺少盘点明细ID/商品库存ID'; + uni.showToast({ title: this.loadError, icon: 'none' }); + return null; + } this.loading = true; try { - const response = await this.$http('check.workDataDetail', { id: taskId, stock_id: stockId }); + const response = await this.$http('check.workDataDetail', params); if (response?.flag === 'failure') { this.goodsInfo = EMPTY_GOODS_INFO(); this.loadError = response.message || '盘点明细加载失败'; uni.showToast({ title: this.loadError, icon: 'none' }); return null; } - const info = normalizeGoodsDetailInfo(extractObjectPayload(response), this.taskInfo.mode); + const info = normalizeGoodsDetailInfo(extractObjectPayload(response), this.taskInfo.mode, { + isStatic: this.taskInfo.hasStaticFlag ? this.taskInfo.isStatic : undefined + }); if (info) this.goodsInfo = Object.assign({}, this.goodsInfo, info); this.loadError = ''; return this.goodsInfo; @@ -745,6 +806,13 @@ export default { color: #e64340; } +/* 另一种账面口径提示(静态看当前库存 / 普通看基准快照) */ +.inv-goods-card__hint { + margin-right: 20rpx; + font-size: 28rpx; + color: #b8811a; +} + .inv-goods-tip { margin: 0 12rpx 16rpx; padding: 24rpx; diff --git a/src/pages/warehouse/inventoryCountSpace.vue b/src/pages/warehouse/inventoryCountSpace.vue index e64eaec..86d7af9 100644 --- a/src/pages/warehouse/inventoryCountSpace.vue +++ b/src/pages/warehouse/inventoryCountSpace.vue @@ -61,6 +61,7 @@ import { extractObjectPayload, extractListPayload, normalizeSpaceWorkDetail, + isStaticCheck, buildReportParams } from './inventoryCount-comps/countModel.js'; @@ -81,7 +82,7 @@ export default { return { taskId: '', locationId: '', - taskInfo: { status: '', mode: '' }, + taskInfo: { status: '', mode: '', isStatic: false, hasStaticFlag: false }, row: null, loading: false, refreshing: false, @@ -327,7 +328,10 @@ export default { const check = extractObjectPayload(response).check || {}; this.taskInfo = { status: String(check.status || '').trim().toLowerCase(), - mode: String(check.mode || '').trim().toLowerCase() + mode: String(check.mode || '').trim().toLowerCase(), + // 静态盘点:账面取明细快照;普通盘点取当前库存(0.3.318) + isStatic: isStaticCheck(check.is_static !== undefined ? check.is_static : check.isStatic), + hasStaticFlag: (check.is_static !== undefined ? check.is_static : check.isStatic) !== undefined }; return this.taskInfo; } catch (error) { @@ -382,7 +386,9 @@ export default { } const payload = extractObjectPayload(response); const rows = extractListPayload(payload, response); - this.row = normalizeSpaceWorkDetail(rows, this.taskInfo.mode); + this.row = normalizeSpaceWorkDetail(rows, this.taskInfo.mode, { + isStatic: this.taskInfo.hasStaticFlag ? this.taskInfo.isStatic : undefined + }); this.applyLocalQuantities(); this.loadError = this.row ? '' : '该库位暂无任务商品'; return this.row;