fix: scope smart loading recommendation requests
This commit is contained in:
@@ -760,8 +760,8 @@ describe('GlobalSmartLoadingView', () => {
|
||||
await button!.trigger('click')
|
||||
await flushPromises()
|
||||
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 2)
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 3)
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 2, { customerId: '', inboundCode: '' })
|
||||
expect(recommendSmartLoading).toHaveBeenCalledWith(plan.id, 3, { customerId: '', inboundCode: '' })
|
||||
expect(getSmartLoadingPlanByBooking).toHaveBeenCalledTimes(2)
|
||||
expect(warningMessage).not.toHaveBeenCalled()
|
||||
expect(wrapper.text()).not.toContain('装柜操作失败')
|
||||
|
||||
@@ -549,15 +549,19 @@ function candidateBlocked(candidate: SmartLoadingCandidateRow) {
|
||||
}
|
||||
async function recommend() {
|
||||
if (!plan.value) return
|
||||
const scope = {
|
||||
customerId: String(appliedQuery.value.customerId || ''),
|
||||
inboundCode: String(appliedQuery.value.inboundCode || '').trim(),
|
||||
}
|
||||
await mutate(async () => {
|
||||
try {
|
||||
acceptPlan(await recommendSmartLoading(plan.value!.id, plan.value!.version))
|
||||
acceptPlan(await recommendSmartLoading(plan.value!.id, plan.value!.version, scope))
|
||||
} catch (error) {
|
||||
const details = getApiErrorDetails(error, '智能推荐失败')
|
||||
if (details.code !== 'A0409' || !/(版本|并发|已被修改|已变化)/.test(details.message)) throw error
|
||||
await loadSelectedPlan()
|
||||
if (!plan.value) throw error
|
||||
acceptPlan(await recommendSmartLoading(plan.value.id, plan.value.version))
|
||||
acceptPlan(await recommendSmartLoading(plan.value.id, plan.value.version, scope))
|
||||
}
|
||||
await loadCandidateData()
|
||||
ElMessage.success('智能推荐已生成')
|
||||
|
||||
Reference in New Issue
Block a user