同步计费优化

This commit is contained in:
luojiaquan
2026-10-16 10:59:59 +08:00
parent 2689138b6a
commit 132688b9cf
10 changed files with 305 additions and 109 deletions
@@ -182,8 +182,12 @@ function submit(skipConfirm) {
const q = query.value || {}
const codes = Array.isArray(q.customerCodes) ? q.customerCodes.filter(v => v != null && String(v).trim() !== '') : []
const keywords = Array.isArray(q.customerKeywords) ? q.customerKeywords.filter(v => v != null && String(v).trim() !== '') : []
if ((!codes.length && !keywords.length) || !q.beginTime || !q.endTime) {
proxy.$modal.msgError('请先输入客户并选择提货时间')
const identifiers = Array.isArray(q.orderIdentifiers)
? q.orderIdentifiers.filter(v => v != null && String(v).trim() !== '')
: []
// 与查询同口径:有单号即可同步;无单号时必须客户 + 提货时间
if (!identifiers.length && ((!codes.length && !keywords.length) || !q.beginTime || !q.endTime)) {
proxy.$modal.msgError('请输入单号,或先输入客户并选择提货时间')
return
}
const start = () => {
@@ -209,7 +213,7 @@ function submit(skipConfirm) {
orderId: q.orderId || undefined,
orgOrderId: q.orgOrderId || undefined,
transferOrderId: q.transferOrderId || undefined,
batchSize: 50
batchSize: 100
}).then(res => {
const asyncTaskId = res.data?.asyncTaskId || res.data
if (!asyncTaskId) {
@@ -131,7 +131,7 @@ const searchColumns = [
label: '单号',
prop: 'orderIdentifiers',
component: 'textarea',
placeholder: '订单号/运单号/转单号,一行一个,支持数万个',
placeholder: '订单号/运单号/转单号,一行一个,单次最多 1 万个',
props: {
rows: 2,
autosize: { minRows: 1, maxRows: 4 },
@@ -215,8 +215,8 @@ function rowKey(row) {
return (row && (row.orderId || row.transferOrderId || row.orgOrderId)) || ''
}
/** 单次查询可接受的单号上限(后端按 900/批分批走索引,过高会明显增加等待时间) */
const MAX_ORDER_IDENTIFIERS = 50000
/** 单次查询/同步可接受的单号上限(后端按 900/批分批走索引,另有服务端 20 万防 OOM 硬兜底) */
const MAX_ORDER_IDENTIFIERS = 10000
/** 产品检测走单条 SQL(Oracle IN 上限 1000),与后端保持一致 */
const MAX_PRODUCT_CHECK_IDENTIFIERS = 1000
@@ -265,11 +265,23 @@ function queryList(params) {
function openFilterSync() {
const q = buildFilterQuery()
if (!(q.customerKeywords && q.customerKeywords.length) || !q.beginTime || !q.endTime) {
ElMessage.warning('按条件同步计费需先输入客户并选择提货时间')
const identifierCount = (q.orderIdentifiers || []).length
const hasIdentifier = identifierCount > 0
const hasCustomer = !!(q.customerKeywords && q.customerKeywords.length)
const hasTime = !!q.beginTime && !!q.endTime
// 与查询同口径:有单号即可同步;无单号时必须客户+提货时间
if (!hasIdentifier && !(hasCustomer && hasTime)) {
ElMessage.warning('请输入单号,或选择客户和提货时间后再同步计费')
return
}
proxy.$modal.confirm('确认按当前筛选分页查询并异步同步计费?', '二次确认').then(() => {
if (identifierCount > MAX_ORDER_IDENTIFIERS) {
ElMessage.warning(`单次最多同步 ${MAX_ORDER_IDENTIFIERS} 个单号,当前 ${identifierCount} 个,请减少后再同步`)
return
}
const tip = hasIdentifier && !(hasCustomer && hasTime)
? `将按 ${identifierCount} 个单号查询匹配订单并异步同步计费,确认继续?`
: '确认按当前筛选分页查询并异步同步计费?'
proxy.$modal.confirm(tip, '二次确认').then(() => {
syncDialogRef.value?.open(q, true)
}).catch(() => {})
}