From c18899be5c715b4b5c6e0ab206c3c3eda7b91d40 Mon Sep 17 00:00:00 2001 From: shijing Date: Tue, 28 Jul 2026 17:02:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=8F=91=E8=B4=A7=E6=97=B6=E6=9D=BF?= =?UTF-8?q?=E6=AE=B5=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inm/mioitem.vue | 2 ++ src/views/inm/mioitem_form.vue | 28 ++++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/views/inm/mioitem.vue b/src/views/inm/mioitem.vue index 1b56d3a8..f0c7538f 100644 --- a/src/views/inm/mioitem.vue +++ b/src/views/inm/mioitem.vue @@ -439,7 +439,9 @@ export default { tableData.forEach(item => { let obj = {}; obj.batch = item.batch; + obj.mb = item.mb; obj.count = Number(item.count); + obj.mioitemw = Array.isArray(item.mioitemw) ? item.mioitemw : []; datas.push(obj); }); that.tableDatas = datas; diff --git a/src/views/inm/mioitem_form.vue b/src/views/inm/mioitem_form.vue index 289da345..9feeb779 100644 --- a/src/views/inm/mioitem_form.vue +++ b/src/views/inm/mioitem_form.vue @@ -689,29 +689,20 @@ export default { } if(items){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ - let count = 0; + // 收集同批次已在明细中占用的 wpr id,避免再次选到同一板段 + let usedWprIds = new Set(); if(that.tableDatas.length>0){ that.tableDatas.forEach((item0) => { - if(item0.batch == that.selectBatch.batch){ - count += item0.count; + if(item0.mb === items.id && Array.isArray(item0.mioitemw)){ + item0.mioitemw.forEach(w => { + if(w && w.wpr) usedWprIds.add(w.wpr); + }) } }) } - let canDo = Number(items.count_canmio); that.$API.wpm.wpr.list.req({ page: 0, mb: items.id,querys:"{id,number,number_out}" }).then((res) => { - if (canDo>50) { - res.forEach((item,index) => { - if(index>=count&&index<50+count){ - that.wprList.push(item); - } - }) - }else{ - res.forEach((item,index) => { - if(index>=count){ - that.wprList.push(item); - } - }) - } + let available = res.filter(item => !usedWprIds.has(item.id)); + that.wprList = available.slice(0, 50); if(that.wprList.length>0){ that.wprList.forEach((item1,index) => { if(item1.number_out!==null){ @@ -721,7 +712,8 @@ export default { } that.form.batch = items.batch; that.form.mb = items.id; - that.form.count =canDo>50?50: canDo; + that.form.count = that.wprList.length; + that.batchcount = that.wprList.length; that.form.warehouse = items.warehouse; that.inputBatchDisable = true; })