fix:mlogb和handoverb扫码添加

This commit is contained in:
shijing 2025-01-14 10:31:33 +08:00
parent 2dc9099409
commit 70ca59a680
6 changed files with 139 additions and 45 deletions

View File

@ -485,9 +485,17 @@ export default {
}, },
}, },
wpr:{ wpr:{
name: "动态产品", list: {
req: async function (data) { name: "动态产品",
return await http.get(`${config.API_URL}/wpmw/wpr/`, data); req: async function (data) {
return await http.get(`${config.API_URL}/wpmw/wpr/`, data);
},
},
item: {
name: "动态产品",
req: async function (id) {
return await http.get(`${config.API_URL}/wpmw/wpr/${id}/`);
},
}, },
}, },
}; };

View File

@ -45,7 +45,8 @@ export default {
this.closed(); this.closed();
}, },
closed(){ closed(){
this.visible = false; this.codeText = '';
// this.visible = false;
} }
} }
} }

View File

@ -547,30 +547,79 @@ export default {
return; return;
} }
let that = this; let that = this;
let keys = data.split('#')[0];
let id = data.split('#')[1]; let id = data.split('#')[1];
console.log('id',id); if(keys=='wpr'){
this.$API.cm.labelmat.item.req(id).then((res) => { that.$API.wpm.wpr.item.req(id).then((res) => {
let arr = that.form.handoverb.filter((item) => { if(res){
return item.batch == res.batch; let indexs = 0;
}) let arr = that.form.handoverb.filter((item,index) => {
if(arr.length>0){ indexs = index;
that.$message.error("该批次已存在") return item.wm == res.wm;
}else{ })
that.materialOptions.forEach((item) => { //handoverb
if(item.batch == res.batch){ if(arr.length>0){
let obj = {}; //wprwpr
obj.wm = item.id; if(arr[0].handoverbw&&arr[0].handoverbw.length>0){
obj.batch = item.batch; let arr1 = [];
obj.counts = item.count; arr1 = arr[0].handoverbw.filter((item1) => {
obj.count = item.count; item1.wpr = item1.id;
that.form.handoverb.push(obj) })
that.$refs.scanDialog.closed(); if(arr1.length>0){
that.$message.error("该物料已存在");
}else{
let obj1 = {};
obj1.wpr = res.id;
that.form.handoverb[indexs].handoverbw.push(obj1);
}
}else{
that.form.handoverb[indexs].handoverbw = [];
let obj1 = {};
obj1.wpr = res.id;
that.form.handoverb[indexs].handoverbw.push(obj1);
}
}else{//handoverb
that.materialOptions.forEach((item) => {
console.log('item.id',item.id);
if(item.id == res.wm){
let obj2 = {};
obj2.wm = item.id;
obj2.batch = item.batch;
obj2.counts = item.count;
obj2.handoverbw = [];
obj2.count = 1;
let obj3 = {};
obj3.wpr = res.id;
obj2.handoverbw.push(obj3);
that.form.handoverb.push(obj2);
}
})
} }
}
})
}else{
this.$API.cm.labelmat.item.req(id).then((res) => {
let arr = that.form.handoverb.filter((item) => {
return item.batch == res.batch;
}) })
} if(arr.length>0){
}) that.$message.error("该批次已存在")
}else{
that.materialOptions.forEach((item) => {
if(item.batch == res.batch){
let obj = {};
obj.wm = item.id;
obj.batch = item.batch;
obj.counts = item.count;
obj.count = item.count;
that.form.handoverb.push(obj)
}
})
}
})
}
// //
this.scanVisible = false; // this.scanVisible = false;
}, },
}, },
}; };

View File

@ -280,7 +280,7 @@ export default {
visibleDrawer: false, visibleDrawer: false,
wprVisibleDrawer:false, wprVisibleDrawer:false,
setNameVisible:false, setNameVisible:false,
wprApiObj:this.$API.wpm.wpr, wprApiObj:this.$API.wpm.wpr.list,
apiObjPrint:this.$API.cm.labelmat.fromWm, apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name"), printer_name:localStorage.getItem("printer_name"),
mgroup_name:'', mgroup_name:'',
@ -379,7 +379,7 @@ export default {
that.wprParams.wm=''; that.wprParams.wm='';
that.wprParams.wm = row.id; that.wprParams.wm = row.id;
that.wprVisibleDrawer = true; that.wprVisibleDrawer = true;
// that.$API.wpm.wpr.req({ wm: row.id,page:0 }).then((res) => { // that.$API.wpm.wpr.list.req({ wm: row.id,page:0 }).then((res) => {
// that.wprList = res; // that.wprList = res;
// }) // })
}, },

View File

@ -182,32 +182,68 @@ export default {
}, },
// //
formWminChange(code){ formWminChange(code){
let that = this,codeId='',arr=[]; console.log('code',code)
let that = this,codeId='',keys="",arr=[];
if(code.indexOf("#")>-1){ if(code.indexOf("#")>-1){
let arrs = code.split("#"); let arrs = code.split("#");
keys = arrs[0];
codeId = arrs[1]; codeId = arrs[1];
} if(keys=='wpr'){//
this.$API.cm.labelmat.item.req(codeId).then((res) => { that.$API.wpm.wpr.item.req(codeId).then((res) => {
if(res){ if(res){
arr = that.materialOptions.filter((item) => { arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.material==res.material&&item.state==res.state; return item.id == res.wm;
}) })
if (arr.length > 0) { if (arr.length > 0) {
that.form.batch = arr[0].batch; that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id; that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count; that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch; that.wm_in = arr[0].batch;
}else{ }else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}
}).catch((err) => {})
}else{//
this.$API.cm.labelmat.item.req(codeId).then((res) => {
if(res){
arr = that.materialOptions.filter((item) => {
return item.batch == res.batch&&item.material==res.material&&item.state==res.state;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
}
}else{
that.wm_in = '';
}
}).catch((err) => {
that.wm_in = ''; that.wm_in = '';
that.$message.error("批次号不存在"); that.$message.error("批次号不存在");
} });
}
}else{
arr = that.materialOptions.filter((item) => {
return item.batch == code;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
that.wm_in = arr[0].batch;
}else{ }else{
that.wm_in = ''; that.wm_in = '';
that.$message.error("批次号不存在");
} }
}).catch((err) => { }
that.wm_in = '';
that.$message.error("批次号不存在");
});
}, },
// //
submit() { submit() {

View File

@ -234,7 +234,7 @@ export default {
}, },
getOptions(){ getOptions(){
let that = this; let that = this;
that.$API.wpm.wpr.req({wm:that.wm,page:0}).then((res) => { that.$API.wpm.wpr.list.req({wm:that.wm,page:0}).then((res) => {
that.options = res; that.options = res;
}) })
}, },