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

View File

@ -400,6 +400,7 @@ class StockTransactionService extends Service {
warehouseIds, warehouseIds,
stockIds: rawStockIds, stockIds: rawStockIds,
keyword, keyword,
ids,
transactionType, transactionType,
orderType, orderType,
orderNo, orderNo,
@ -482,6 +483,15 @@ class StockTransactionService extends Service {
replacements.stockIds = normalizedStockIds; 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) { if (transactionType) {
whereClauses.push('t.transaction_type = :transactionType'); whereClauses.push('t.transaction_type = :transactionType');
@ -644,6 +654,7 @@ class StockTransactionService extends Service {
warehouseIds, warehouseIds,
stockIds: rawStockIds, stockIds: rawStockIds,
keyword, keyword,
ids,
transactionType, transactionType,
orderType, orderType,
orderNo, orderNo,
@ -722,6 +733,15 @@ class StockTransactionService extends Service {
replacements.stockIds = normalizedStockIds; 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) { if (transactionType) {
whereClauses.push('t.transaction_type = :transactionType'); whereClauses.push('t.transaction_type = :transactionType');
replacements.transactionType = String(transactionType).trim(); replacements.transactionType = String(transactionType).trim();