fix:mlogb中批次输入扫码(wm||wb)

This commit is contained in:
shijing 2025-01-15 15:51:56 +08:00
parent 6088b9c633
commit 7831d87869
1 changed files with 70 additions and 16 deletions

View File

@ -121,10 +121,13 @@ export default {
]
},
wm_in:'',
mlogbIns:[],
options: [],
mlogbInOptions:[],
materialOptions: [],
mgroup_code:'',
mlogbInId:'',
hasMlogbIn:false,
visible: false,
isSaveing: false,
setFiltersVisible: false,
@ -140,6 +143,7 @@ export default {
this.params.mlog = this.mlog;
let arr = this.$route.path.split("/");
this.mgroup_code = arr[2];
this.getMlogbIn();
this.getMtask();
this.getMaterial();
this.getParentList();
@ -148,6 +152,16 @@ export default {
open() {
this.visible = true;
},
getMlogbIn(){
let that = this;
let params = {};
params.page= 0;
params.mlog= that.mlog;
params.material_in__isnull=0;
this.$API.wpm.mlogb.list.req(params).then((res) => {
that.mlogbIns = res;
})
},
getParentList(){
let that = this;
that.$API.wpm.mlogb.list.req(that.params).then((res) => {
@ -188,17 +202,40 @@ export default {
let arrs = code.split("#");
keys = arrs[0];
codeId = arrs[1];
that.scanKyes = keys;
if(keys=='wpr'){//
that.$API.wpm.wpr.item.req(codeId).then((res) => {
if(res){
let bwitem = {};
bwitem.mlogb="";
bwitem.number=res.number;
bwitem.wpr=res.id;
arr = that.materialOptions.filter((item) => {
return item.id == res.wm;
})
if (arr.length > 0) {
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
if (arr.length > 0) {//
let batch = arr[0].batch;
that.wm_in = arr[0].batch;
that.form.count_use =1;
console.log('batch',batch);
//
let arr0= that.mlogbIns.filter((item)=>{
return item.batch == batch;
})
console.log('arr0',arr0)
if (arr0.length > 0) {
that.hasMlogbIn = true;
bwitem.mlogb = arr0[0].id;
that.form.parent = '';
console.log('bwitem',bwitem)
}else{
that.form.batch = arr[0].batch;
that.form.wm_in = arr[0].id;
that.form.count_use = 1;
that.wm_in = arr[0].batch;
}
that.bwItemForm = bwitem;
console.log('that.bwItemForm',that.bwItemForm)
}else{
that.wm_in = '';
that.$message.error("批次号不存在");
@ -248,18 +285,35 @@ export default {
//
submit() {
let that = this;
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in.req(that.form).then((res) => {
that.$message.success("添加成功");
that.$emit("success");
that.wm_in = '';
that.form.mtask = '';
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
that.$emit("closed");
that.visible = false;
}).catch((err) => {});
if(that.hasMlogbIn){
that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {
that.$message.success("添加成功");
that.wm_in = '';
that.form.mtask = '';
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
that.$emit("closed");
that.visible = false;
})
}else{
that.form.mlog = that.mlog;
that.$API.wpm.mlogb.in.req(that.form).then((res) => {
that.$message.success("添加成功");
that.$emit("success");
that.wm_in = '';
that.form.mtask = '';
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
if(that.scanKyes=='wpr'){
that.bwItemForm.mlogb = res.id;
that.$API.wpm.mlogbw.create.req(that.bwItemForm).then((res) => {})
}
that.$emit("closed");
that.visible = false;
}).catch((err) => {});
}
},
//
setFilters(filters) {