feat: stock.transaction 新增 where.ids 精确筛选,支持导出选中记录

之前 where.ids 传入完全被忽略,导致导出内容与用户选中的记录不符。
queryList/exportList 现已支持 ids 数组精确筛选 wms_stock_transaction.id。
This commit is contained in:
liufumingren 2026-07-17 02:26:10 +08:00
parent 07f35c43bf
commit 04305fffd6
2 changed files with 28 additions and 0 deletions

View File

@ -38,6 +38,7 @@ class StockTransactionMethodService extends MainService {
store_ids: storeIds,
stock_ids: stockIds,
keyword,
ids,
transaction_type: transactionType,
order_type: orderType,
order_no: orderNo,
@ -67,6 +68,7 @@ class StockTransactionMethodService extends MainService {
storeIds,
stockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,
@ -109,6 +111,7 @@ class StockTransactionMethodService extends MainService {
stock_ids: stockIdsRaw,
stock_id: stockIdRaw,
keyword,
ids,
transaction_type: transactionType,
order_type: orderType,
order_no: orderNo,
@ -148,6 +151,7 @@ class StockTransactionMethodService extends MainService {
warehouseIds,
stockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,
@ -178,6 +182,7 @@ class StockTransactionMethodService extends MainService {
store_ids: storeIds,
stock_ids: stockIds,
keyword,
ids,
transaction_type: transactionType,
order_type: orderType,
order_no: orderNo,
@ -223,6 +228,7 @@ class StockTransactionMethodService extends MainService {
storeIds,
stockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,
@ -284,6 +290,7 @@ class StockTransactionMethodService extends MainService {
stock_ids: stockIdsRaw,
stock_id: stockIdRaw,
keyword,
ids,
transaction_type: transactionType,
order_type: orderType,
order_no: orderNo,
@ -337,6 +344,7 @@ class StockTransactionMethodService extends MainService {
warehouseIds,
stockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,

View File

@ -400,6 +400,7 @@ class StockTransactionService extends Service {
warehouseIds,
stockIds: rawStockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,
@ -482,6 +483,15 @@ class StockTransactionService extends Service {
replacements.stockIds = normalizedStockIds;
}
// 记录ID筛选(精确导出选中记录)
const normalizedIds = Array.isArray(ids)
? ids.map(item => Number(item)).filter(item => Number.isInteger(item) && item > 0)
: [];
if (normalizedIds.length > 0) {
whereClauses.push('t.id IN (:ids)');
replacements.ids = normalizedIds;
}
// 流水类型
if (transactionType) {
whereClauses.push('t.transaction_type = :transactionType');
@ -644,6 +654,7 @@ class StockTransactionService extends Service {
warehouseIds,
stockIds: rawStockIds,
keyword,
ids,
transactionType,
orderType,
orderNo,
@ -722,6 +733,15 @@ class StockTransactionService extends Service {
replacements.stockIds = normalizedStockIds;
}
// 记录ID筛选(精确导出选中记录)
const normalizedIds = Array.isArray(ids)
? ids.map(item => Number(item)).filter(item => Number.isInteger(item) && item > 0)
: [];
if (normalizedIds.length > 0) {
whereClauses.push('t.id IN (:ids)');
replacements.ids = normalizedIds;
}
if (transactionType) {
whereClauses.push('t.transaction_type = :transactionType');
replacements.transactionType = String(transactionType).trim();