fix:玻纤输入物料时wpr选择最后一个

This commit is contained in:
shijing 2025-03-13 14:34:19 +08:00
parent 6bcdb0a9d8
commit 7b0c2b5368
1 changed files with 14 additions and 6 deletions

View File

@ -141,6 +141,11 @@ export default {
mlog: "", mlog: "",
material_in__isnull: 0, material_in__isnull: 0,
}, },
bwItemForm:{
wpr:"",
mlogb:"",
number:"",
},
}; };
}, },
mounted() { mounted() {
@ -238,6 +243,7 @@ export default {
that.$message.error("批次号不存在"); that.$message.error("批次号不存在");
}); });
}else{ }else{
that.scanKyes = "";
if(that.tracking==10){// if(that.tracking==10){//
arr = that.materialOptions.filter((item) => { arr = that.materialOptions.filter((item) => {
return item.batch == code; return item.batch == code;
@ -254,12 +260,13 @@ export default {
}else{// }else{//
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => { that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
if(res.length>0){ if(res.length>0){
let index = res.length-1;
let bwitem = {}; let bwitem = {};
bwitem.mlogb=""; bwitem.mlogb="";
bwitem.number=res[0].number; bwitem.number=res[index].number;
bwitem.wpr=res[0].id; bwitem.wpr=res[index].id;
let arr = that.materialOptions.filter((item) => { let arr = that.materialOptions.filter((item) => {
return item.id == res[0].wm; return item.id == res[index].wm;
}) })
if(arr.length>0){ // if(arr.length>0){ //
let batch = arr[0].batch; let batch = arr[0].batch;
@ -309,20 +316,21 @@ export default {
that.form.mlog = that.mlog; that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in.req(that.form).then((res) => { that.$API.wpm.mlogb.in.req(that.form).then((res) => {
that.$message.success("添加成功"); that.$message.success("添加成功");
that.$emit("success");
that.wm_in = ''; that.wm_in = '';
that.form.mtask = ''; that.form.mtask = '';
that.form.batch = ''; that.form.batch = '';
that.form.parent = ''; that.form.parent = '';
that.form.count_use = 0; that.form.count_use = 0;
// that.scanKyes!=='mat'&&that.mlogbInCount>1
// that.bwItemForm.wpr!=""
if(that.scanKyes!=='mat'&&that.mlogbInCount>1){ if(that.scanKyes!=='mat'&&that.mlogbInCount>1){
//1
that.bwItemForm.mlogb = res.id; that.bwItemForm.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => { that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
that.$emit("closed"); that.$emit("closed");
}) })
}else{
that.$emit("closed");
} }
that.$emit("closed");
that.visible = false; that.visible = false;
}).catch((err) => {}); }).catch((err) => {});
} }