fix(pick): wavePickTaskBindCart 防重检查不再按任务状态放过——仅以 is_active=1 为准,阻止一车多绑
This commit is contained in:
parent
de9eb2b657
commit
0b77a1c63e
@ -2418,8 +2418,7 @@ class PickSystemService extends Service {
|
|||||||
SELECT
|
SELECT
|
||||||
b.id,
|
b.id,
|
||||||
b.task_id,
|
b.task_id,
|
||||||
t.task_no,
|
t.task_no
|
||||||
t.status AS task_status
|
|
||||||
FROM wms_pick_task_cart_binding b
|
FROM wms_pick_task_cart_binding b
|
||||||
INNER JOIN wms_wave_pick_task t
|
INNER JOIN wms_wave_pick_task t
|
||||||
ON t.id = b.task_id
|
ON t.id = b.task_id
|
||||||
@ -2442,7 +2441,6 @@ class PickSystemService extends Service {
|
|||||||
: null;
|
: null;
|
||||||
if (cartActiveBinding) {
|
if (cartActiveBinding) {
|
||||||
const boundTaskId = Number(cartActiveBinding.task_id || 0);
|
const boundTaskId = Number(cartActiveBinding.task_id || 0);
|
||||||
const boundTaskStatus = Number(cartActiveBinding.task_status || 0);
|
|
||||||
if (boundTaskId === taskId) {
|
if (boundTaskId === taskId) {
|
||||||
throw this.createBusinessError('该任务已绑定此拣货车,无需重复绑定', 409, {
|
throw this.createBusinessError('该任务已绑定此拣货车,无需重复绑定', 409, {
|
||||||
task_id: taskId,
|
task_id: taskId,
|
||||||
@ -2450,14 +2448,13 @@ class PickSystemService extends Service {
|
|||||||
cart_code: targetCartCode,
|
cart_code: targetCartCode,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ([ 0, 1 ].includes(boundTaskStatus)) {
|
// 车已有其他活跃绑定,无论旧任务状态如何均应阻止
|
||||||
throw this.createBusinessError('该拣货车已绑定其他活动任务,请先解绑后再重新绑定', 409, {
|
throw this.createBusinessError('该拣货车已绑定其他任务,请先解绑后再重新绑定', 409, {
|
||||||
task_id: boundTaskId,
|
task_id: boundTaskId,
|
||||||
task_no: String(cartActiveBinding.task_no || '').trim() || null,
|
task_no: String(cartActiveBinding.task_no || '').trim() || null,
|
||||||
cart_id: targetCartId,
|
cart_id: targetCartId,
|
||||||
cart_code: targetCartCode,
|
cart_code: targetCartCode,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await ctx.model.query(`
|
await ctx.model.query(`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user