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