fix:将已扫板段对应的批次预填入多选,避免手动添加把扫描数据顶掉

This commit is contained in:
shijing 2026-05-28 13:28:49 +08:00
parent aa81a28d1c
commit bbf58b9167
1 changed files with 51 additions and 5 deletions

View File

@ -665,7 +665,16 @@ export default {
});
},
addMaterial(){
this.addShow = true;
let that = this;
that.addShow = true;
//
if(that.form.handoverb && that.form.handoverb.length > 0){
that.form.handoverb.forEach(item => {
if(item.wm && that.selectItems.indexOf(item.wm) === -1){
that.selectItems.push(item.wm);
}
});
}
},
delMaterial(index){
this.selectItems.splice(index,1);
@ -715,6 +724,15 @@ export default {
},
materialChange() {
let that = this;
// shangpaipingmo
let scannedMap = {};
if(that.route_code == 'shangpaipingmo'){
(that.form.handoverb || []).forEach(h => {
if(h.wm && h.handoverbw && h.handoverbw.length > 0){
scannedMap[h.wm] = h;
}
});
}
that.form.new_batch = that.route_code=='shangpaipingmo'?that.form.new_batch:"";
let totalCount = 0,data = [];
if(that.selectItems.length>0){
@ -755,15 +773,31 @@ export default {
}
data.forEach((item,index)=>{
item.wm = item.id;
item.count = item.count_canhandover;
totalCount += Number(item.count_canhandover);
item.tracking = item.material_.tracking;
if(item.material_.process_name){
item.process = item.material_.process_name;
}
item.handoverbw = [];
that.getWprList(item.id,index);
let scanned = scannedMap[item.id];
if(scanned){
// handoverbw
item.handoverbw = scanned.handoverbw;
item.count = scanned.count;
totalCount += Number(scanned.count);
} else {
item.count = item.count_canhandover;
totalCount += Number(item.count_canhandover);
item.handoverbw = [];
that.getWprList(item.id,index);
}
})
// checkedStatus handoverbw
that.checkedStatus = data.map(item => {
let scanned = scannedMap[item.id];
if(scanned && scanned.handoverbw && scanned.handoverbw.length > 0){
return scanned.handoverbw.every(w => w.checked !== false);
}
return true;
});
}
that.totalCount = totalCount;
that.form.handoverb = data;
@ -1049,16 +1083,22 @@ export default {
let obj1 = {};
obj1.wpr = res[0].id;
obj1.number = res[0].number;
obj1.checked = true;
that.form.handoverb[indexs].count+=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
that.checkedStatus.push(true)
that.selectItems.push(res[0].id)
}
}else{
that.form.handoverb[indexs].handoverbw = [];
let obj1 = {};
obj1.wpr = res[0].id;
obj1.checked = true;
obj1.number = res[0].number;
that.form.handoverb[indexs].count=1;
that.form.handoverb[indexs].handoverbw.push(obj1);
that.checkedStatus.push(true)
that.selectItems.push(res[0].id)
}
}else{//handoverb
if(that.new_wm==''){
@ -1082,9 +1122,12 @@ export default {
obj2.count = 1;
let obj3 = {};
obj3.wpr = res[0].id;
obj3.checked = true;
obj3.number = res[0].number;
obj2.handoverbw.push(obj3);
that.form.handoverb.push(obj2);
that.checkedStatus.push(true)
that.selectItems.push(res[0].id)
}
})
}else{
@ -1097,9 +1140,12 @@ export default {
obj2.count = 1;
let obj3 = {};
obj3.wpr = res[0].id;
obj3.checked = true;
obj3.number = res[0].number;
obj2.handoverbw.push(obj3);
that.form.handoverb.push(obj2);
that.checkedStatus.push(true)
that.selectItems.push(res[0].id)
}
}
}else{