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