fix:发货时板段重复

This commit is contained in:
shijing 2026-07-28 17:02:13 +08:00
parent 349a650171
commit c18899be5c
2 changed files with 12 additions and 18 deletions

View File

@ -439,7 +439,9 @@ export default {
tableData.forEach(item => { tableData.forEach(item => {
let obj = {}; let obj = {};
obj.batch = item.batch; obj.batch = item.batch;
obj.mb = item.mb;
obj.count = Number(item.count); obj.count = Number(item.count);
obj.mioitemw = Array.isArray(item.mioitemw) ? item.mioitemw : [];
datas.push(obj); datas.push(obj);
}); });
that.tableDatas = datas; that.tableDatas = datas;

View File

@ -689,29 +689,20 @@ export default {
} }
if(items){ if(items){
if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){
let count = 0; // wpr id
let usedWprIds = new Set();
if(that.tableDatas.length>0){ if(that.tableDatas.length>0){
that.tableDatas.forEach((item0) => { that.tableDatas.forEach((item0) => {
if(item0.batch == that.selectBatch.batch){ if(item0.mb === items.id && Array.isArray(item0.mioitemw)){
count += item0.count; 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) => { that.$API.wpm.wpr.list.req({ page: 0, mb: items.id,querys:"{id,number,number_out}" }).then((res) => {
if (canDo>50) { let available = res.filter(item => !usedWprIds.has(item.id));
res.forEach((item,index) => { that.wprList = available.slice(0, 50);
if(index>=count&&index<50+count){
that.wprList.push(item);
}
})
}else{
res.forEach((item,index) => {
if(index>=count){
that.wprList.push(item);
}
})
}
if(that.wprList.length>0){ if(that.wprList.length>0){
that.wprList.forEach((item1,index) => { that.wprList.forEach((item1,index) => {
if(item1.number_out!==null){ if(item1.number_out!==null){
@ -721,7 +712,8 @@ export default {
} }
that.form.batch = items.batch; that.form.batch = items.batch;
that.form.mb = items.id; 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.form.warehouse = items.warehouse;
that.inputBatchDisable = true; that.inputBatchDisable = true;
}) })