From 5d4b61e8937f126ce2b879b6c9dc179c013ab799 Mon Sep 17 00:00:00 2001 From: shijing Date: Thu, 11 Sep 2025 14:07:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=98=B2=E6=AD=A2=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E6=85=A2=E6=97=B6=E6=89=AB=E7=A0=81=E4=B9=B1=E6=89=B9=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wpm_bx/handover_form.vue | 236 ++++++++++++++--------------- 1 file changed, 117 insertions(+), 119 deletions(-) diff --git a/src/views/wpm_bx/handover_form.vue b/src/views/wpm_bx/handover_form.vue index f284322a..ba533c47 100644 --- a/src/views/wpm_bx/handover_form.vue +++ b/src/views/wpm_bx/handover_form.vue @@ -17,8 +17,10 @@ 手动添加 @@ -344,6 +346,7 @@ export default { bwVisible:false, scanVisible:false, isSaveing: false, + imputDisable:false, change_batch:false, setFiltersVisible: false, }; @@ -733,69 +736,73 @@ export default { let that = this; that.scanVisible = true; }, - formWminChange(data){ + async formWminChange(data){ + this.imputDisable = true; + await this.getInputText(data); + this.imputDisable = false; + this.$refs.codeInput.focus(); + }, + async getInputText(data){ if(data==''){ return; } let that = this; + that.wm_in = ''; if(data.indexOf('#')>-1){ let id = data.split('#')[1]; - this.$API.cm.labelmat.item.req(id).then((res) => { - let arr = []; - if(that.form.handoverb&&that.form.handoverb.length>0){ - that.form.handoverb.forEach((item) => { - if(item.batch == res.batch&&item.state==res.state&&item.defect==res.defect){ - arr.push(item); - } - }) - } - if(arr.length>0){ - that.wm_in = ""; - that.$message.error("该批次已存在") - }else{ - let hasArr = []; - that.materialOptions.forEach((item) => { - if(item.batch == res.batch){ - hasArr.push(item); - let params = {material: item.material,type: that.type}; - that.$API.wpm.handover.mgroups.req(params).then((res0) => { - that.mgroupOptions = res0; - if(res0.length==1){ - that.form.recive_mgroup = res0[0].id; - that.getUserList2(); - } - }) - let obj = {}; - obj.wm = item.id; - obj.batch = item.batch; - if(item.material_.process_name){ - obj.process = item.material_.process_name; - } - obj.count_cando = item.count_canhandover; - obj.count = item.count_canhandover; - obj.state = res.state; - obj.defect = res.defect; - obj.handoverbw = []; - that.$API.wpm.wpr.list.req({wm:item.id,page:0}).then((res) => { - let handoverbw = []; - let list = res; - list.forEach(item1=>{ - let obj1 = {}; - obj1.wpr = item1.id; - obj1.number = item1.number; - handoverbw.push(obj1); - }) - obj.handoverbw = handoverbw; - that.form.handoverb.push(obj); - that.wm_in = ""; - }) - } - }) - if(hasArr.length>0){}else{ - that.$message.error("该批次不存在") + let res = await this.$API.cm.labelmat.item.req(id); + let arr = []; + if(that.form.handoverb&&that.form.handoverb.length>0){ + that.form.handoverb.forEach((item) => { + if(item.batch == res.batch&&item.state==res.state&&item.defect==res.defect){ + arr.push(item); } + }) + } + if(arr.length>0){ + that.$message.error("该批次已存在") + }else{ + let hasArr = []; + that.materialOptions.forEach((item) => { + if(item.batch == res.batch){ + hasArr.push(item); + let params = {material: item.material,type: that.type}; + that.$API.wpm.handover.mgroups.req(params).then((res0) => { + that.mgroupOptions = res0; + if(res0.length==1){ + that.form.recive_mgroup = res0[0].id; + that.getUserList2(); + } + }) + let obj = {}; + obj.wm = item.id; + obj.batch = item.batch; + if(item.material_.process_name){ + obj.process = item.material_.process_name; + } + obj.count_cando = item.count_canhandover; + obj.count = item.count_canhandover; + obj.state = res.state; + obj.defect = res.defect; + obj.handoverbw = []; + that.$API.wpm.wpr.list.req({wm:item.id,page:0}).then((res) => { + let handoverbw = []; + let list = res; + list.forEach(item1=>{ + let obj1 = {}; + obj1.wpr = item1.id; + obj1.number = item1.number; + handoverbw.push(obj1); + }) + obj.handoverbw = handoverbw; + that.form.handoverb.push(obj); + }) + } + }) + if(hasArr.length>0){}else{ + that.$message.error("该批次不存在") } - }) + } }else{//wpr的number let arr = []; arr = that.materialOptions.filter((item) => { @@ -809,7 +816,6 @@ export default { }) } if(arr2.length>0){ - that.wm_in = ""; that.$message.error("该批次已存在") }else{ let params = {material: arr[0].material,type: that.type}; @@ -825,79 +831,71 @@ export default { obj2.count_cando = arr[0].count_canhandover; obj2.count = arr[0].count_canhandover; that.form.handoverb.push(obj2); - that.wm_in = ""; } }else{//单件 - that.$API.wpm.wpr.list.req({number:data,page:0}).then((res) => { - if(res.length>0){ - let indexs = 0,arr =[]; - if( that.form.handoverb&&that.form.handoverb.length>0){ - arr = that.form.handoverb.filter((item,index) => { - if(item.wm == res[0].wm){ - indexs = index; - } - return item.wm == res[0].wm; + let res = await that.$API.wpm.wpr.list.req({number:data,page:0}); + if(res.length>0){ + let indexs = 0,arr =[]; + if( that.form.handoverb&&that.form.handoverb.length>0){ + that.form.handoverb.forEach((item,index) => { + if(item.wm == res[0].wm){ + indexs = index; + arr.push(item); + } + }) + } + //handoverb里有这个物料批次 + if(arr.length>0){ + //判断是否有wpr,若无将wpr放进去 + if(that.form.handoverb[indexs].handoverbw&&that.form.handoverb[indexs].handoverbw.length>0){ + let arr1 = []; + arr1 = that.form.handoverb[indexs].handoverbw.filter((item1) => { + return item1.wpr == res[0].id; }) - } - //handoverb里有这个物料批次 - if(arr.length>0){ - //判断是否有wpr,若无将wpr放进去 - if(that.form.handoverb[indexs].handoverbw&&that.form.handoverb[indexs].handoverbw.length>0){ - let arr1 = []; - arr1 = that.form.handoverb[indexs].handoverbw.filter((item1) => { - return item1.wpr == res[0].id; - }) - if(arr1.length>0){ - that.wm_in = ""; - that.$message.error("该物料已存在"); - }else{ - let obj1 = {}; - obj1.wpr = res[0].id; - obj1.number = res[0].number; - that.form.handoverb[indexs].count+=1; - that.form.handoverb[indexs].handoverbw.push(obj1); - that.wm_in = ""; - } + if(arr1.length>0){ + that.$message.error("该物料已存在"); }else{ - that.form.handoverb[indexs].handoverbw = []; let obj1 = {}; obj1.wpr = res[0].id; obj1.number = res[0].number; - that.form.handoverb[indexs].count=1; + that.form.handoverb[indexs].count+=1; that.form.handoverb[indexs].handoverbw.push(obj1); - that.wm_in = ""; } - }else{//handoverb里没有有这个物料批次 - that.materialOptions.forEach((item) => { - if(item.id == res[0].wm){ - let params = {material: item.material,type: that.type}; - that.$API.wpm.handover.mgroups.req(params).then((res1) => { - that.mgroupOptions = res1; - }) - let obj2 = {}; - obj2.wm = item.id; - obj2.batch = item.batch; - if(item.material_.process_name){ - obj2.process = item.material_.process_name; - } - obj2.count_cando = item.count_canhandover; - obj2.handoverbw = []; - obj2.count = 1; - let obj3 = {}; - obj3.wpr = res[0].id; - obj3.number = res[0].number; - obj2.handoverbw.push(obj3); - // that.form.handoverb = []; - that.form.handoverb.push(obj2); - } - }) - that.wm_in = ""; + }else{ + that.form.handoverb[indexs].handoverbw = []; + let obj1 = {}; + obj1.wpr = res[0].id; + obj1.number = res[0].number; + that.form.handoverb[indexs].count=1; + that.form.handoverb[indexs].handoverbw.push(obj1); } - }else{ - that.wm_in = ""; - that.$message.error("该批次不存在") + }else{//handoverb里没有有这个物料批次 + that.materialOptions.forEach((item) => { + if(item.id == res[0].wm){ + let params = {material: item.material,type: that.type}; + that.$API.wpm.handover.mgroups.req(params).then((res1) => { + that.mgroupOptions = res1; + }) + let obj2 = {}; + obj2.wm = item.id; + obj2.batch = item.batch; + if(item.material_.process_name){ + obj2.process = item.material_.process_name; + } + obj2.count_cando = item.count_canhandover; + obj2.handoverbw = []; + obj2.count = 1; + let obj3 = {}; + obj3.wpr = res[0].id; + obj3.number = res[0].number; + obj2.handoverbw.push(obj3); + that.form.handoverb.push(obj2); + } + }) } - }) + }else{ + that.$message.error("该批次不存在") + } } } setTimeout(() => {